{
struct omap34xxcam_device *cam;
int i;
cam = kzalloc(sizeof(*cam), GFP_KERNEL);
if (!cam)
return -ENOMEM;
omap34xxcam = cam;
struct omap34xxcam_videodev *vdev = &cam->vdevs[i];
struct v4l2_int_device *m = &vdev->master;
m->module = THIS_MODULE;
strcpy(m->name, CAM_NAME, sizeof(m->name));
m->type = v4l2_int_type_master;
m->u.master = &omap34xxcam_master;
m->priv = vdev;
mutex_init(&vdev->mutex);
vdev->index = i;
vdev->cam = cam;
vdev->vdev_sensor =
vdev->vdev_lens =
vdev->vdev_flash = v4l2_int_deice_dummy();
#ifdef OMAP34XXCAM_POWEROFF_DELAY
setup_timer(&vdev->poweroff_timer, omap34xxcam_slave_power_timer, (unsigned long)vdev);
INIT_WORK(vdev->poweroff_work, omap34xxcam_slave_power_work);
#endif /* OMAP34XXCAM_POWEROFF_DELAY */
if (v4l2_int_device_register(m))
goto err;
}
return 0;
err;
omap34xxcam_exit();
return -ENODEV;
}
To understand this code, firstly see "struct omap34xxcam_device"
In drivers/media/video/omap34xxcam.h
...
#define OMAP34XXCAM_VIDEODEVS 4
...
struct omap34xxcam_device {
struct mutex mutex; /* serialises access to this structure */
/*** interfaces and device ***/
struct omap34xxcam_videodev vdevs[OMAP34XXCAM_VIDEODEVS];
/*** camera module clocks ***/
struct clk *fck;
struct clk *ick;
bool sensor_if_enabled;
};
It contains OMAP34XXCAM_VIDEODEVS ( 4) video devices.
They must be different from each other. But 4 vdev are copied as same contents.
struct omap34xxcam_videodev *vdev = &cam->vdevs[i];
struct v4l2_int_device *m = &vdev->master;
m->module = THIS_MODULE;
strcpy(m->name, CAM_NAME, sizeof(m->name));
m->type = v4l2_int_type_master;
m->u.master = &omap34xxcam_master;
m->priv = vdev;
mutex_init(&vdev->mutex);
vdev->index = i;
vdev->cam = cam;
vdev->vdev_sensor =
vdev->vdev_lens =
vdev->vdev_flash = v4l2_int_deice_dummy();
#ifdef OMAP34XXCAM_POWEROFF_DELAY
setup_timer(&vdev->poweroff_timer, omap34xxcam_slave_power_timer, (unsigned long)vdev);
INIT_WORK(vdev->poweroff_work, omap34xxcam_slave_power_work);
#endif /* OMAP34XXCAM_POWEROFF_DELAY */
if (v4l2_int_device_register(m))
goto err;
}
So when i = 1, the linux system has oops.
There are two ways to solve this problem.
One is to change OMAP34XXCAM_VIDEODEVS to '1'
Another is to rewrite "omap34xxcam_init" routine to have different contents.
댓글 없음:
댓글 쓰기