diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-09-28 08:25:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:28:41 -0400 |
commit | 7ae77ee92fea7c115324096372a2a125d8bc26d7 (patch) | |
tree | 26fcb2f4c92ab3b16791a1d695a0bb7016d6d601 /drivers/media/video/soc_camera.c | |
parent | 07f92448045a23d27dbc3ece3abcb6bafc618d43 (diff) |
[media] V4L: soc-camera: add 2 new ioctl() handlers
This patch adds two new ioctl() handlers: .vidioc_create_bufs() and
.vidioc_prepare_buf() for compliant vb2 soc-camera hosts.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r-- | drivers/media/video/soc_camera.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index b56f4b78273d..8d5c421a803c 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -318,6 +318,32 @@ static int soc_camera_dqbuf(struct file *file, void *priv, | |||
318 | return vb2_dqbuf(&icd->vb2_vidq, p, file->f_flags & O_NONBLOCK); | 318 | return vb2_dqbuf(&icd->vb2_vidq, p, file->f_flags & O_NONBLOCK); |
319 | } | 319 | } |
320 | 320 | ||
321 | static int soc_camera_create_bufs(struct file *file, void *priv, | ||
322 | struct v4l2_create_buffers *create) | ||
323 | { | ||
324 | struct soc_camera_device *icd = file->private_data; | ||
325 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | ||
326 | |||
327 | /* videobuf2 only */ | ||
328 | if (ici->ops->init_videobuf) | ||
329 | return -EINVAL; | ||
330 | else | ||
331 | return vb2_create_bufs(&icd->vb2_vidq, create); | ||
332 | } | ||
333 | |||
334 | static int soc_camera_prepare_buf(struct file *file, void *priv, | ||
335 | struct v4l2_buffer *b) | ||
336 | { | ||
337 | struct soc_camera_device *icd = file->private_data; | ||
338 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | ||
339 | |||
340 | /* videobuf2 only */ | ||
341 | if (ici->ops->init_videobuf) | ||
342 | return -EINVAL; | ||
343 | else | ||
344 | return vb2_prepare_buf(&icd->vb2_vidq, b); | ||
345 | } | ||
346 | |||
321 | /* Always entered with .video_lock held */ | 347 | /* Always entered with .video_lock held */ |
322 | static int soc_camera_init_user_formats(struct soc_camera_device *icd) | 348 | static int soc_camera_init_user_formats(struct soc_camera_device *icd) |
323 | { | 349 | { |
@@ -1041,6 +1067,7 @@ static int soc_camera_probe(struct soc_camera_device *icd) | |||
1041 | if (!control || !control->driver || !dev_get_drvdata(control) || | 1067 | if (!control || !control->driver || !dev_get_drvdata(control) || |
1042 | !try_module_get(control->driver->owner)) { | 1068 | !try_module_get(control->driver->owner)) { |
1043 | icl->del_device(icd); | 1069 | icl->del_device(icd); |
1070 | ret = -ENODEV; | ||
1044 | goto enodrv; | 1071 | goto enodrv; |
1045 | } | 1072 | } |
1046 | } | 1073 | } |
@@ -1312,19 +1339,21 @@ static int soc_camera_device_register(struct soc_camera_device *icd) | |||
1312 | 1339 | ||
1313 | static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { | 1340 | static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = { |
1314 | .vidioc_querycap = soc_camera_querycap, | 1341 | .vidioc_querycap = soc_camera_querycap, |
1342 | .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap, | ||
1315 | .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap, | 1343 | .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap, |
1316 | .vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap, | ||
1317 | .vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap, | 1344 | .vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap, |
1345 | .vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap, | ||
1318 | .vidioc_enum_input = soc_camera_enum_input, | 1346 | .vidioc_enum_input = soc_camera_enum_input, |
1319 | .vidioc_g_input = soc_camera_g_input, | 1347 | .vidioc_g_input = soc_camera_g_input, |
1320 | .vidioc_s_input = soc_camera_s_input, | 1348 | .vidioc_s_input = soc_camera_s_input, |
1321 | .vidioc_s_std = soc_camera_s_std, | 1349 | .vidioc_s_std = soc_camera_s_std, |
1322 | .vidioc_enum_framesizes = soc_camera_enum_fsizes, | 1350 | .vidioc_enum_framesizes = soc_camera_enum_fsizes, |
1323 | .vidioc_reqbufs = soc_camera_reqbufs, | 1351 | .vidioc_reqbufs = soc_camera_reqbufs, |
1324 | .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap, | ||
1325 | .vidioc_querybuf = soc_camera_querybuf, | 1352 | .vidioc_querybuf = soc_camera_querybuf, |
1326 | .vidioc_qbuf = soc_camera_qbuf, | 1353 | .vidioc_qbuf = soc_camera_qbuf, |
1327 | .vidioc_dqbuf = soc_camera_dqbuf, | 1354 | .vidioc_dqbuf = soc_camera_dqbuf, |
1355 | .vidioc_create_bufs = soc_camera_create_bufs, | ||
1356 | .vidioc_prepare_buf = soc_camera_prepare_buf, | ||
1328 | .vidioc_streamon = soc_camera_streamon, | 1357 | .vidioc_streamon = soc_camera_streamon, |
1329 | .vidioc_streamoff = soc_camera_streamoff, | 1358 | .vidioc_streamoff = soc_camera_streamoff, |
1330 | .vidioc_cropcap = soc_camera_cropcap, | 1359 | .vidioc_cropcap = soc_camera_cropcap, |