diff options
author | Jim Paris <jim@jtan.com> | 2008-12-10 04:02:42 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:39:01 -0500 |
commit | 627a5ef7893fa127925b99e2597c8210202c75aa (patch) | |
tree | f7b542b02bb4888dc3efe3b250c823d17931905e /drivers | |
parent | c06eb61941459b1981817fb675d0104ac0cd6df8 (diff) |
V4L/DVB (9876): gspca - main: Allow subdrivers to handle v4l2_streamparm requests.
Add get_streamparm and set_streamparm operations so subdrivers can
get/set stream parameters such as framerate.
Signed-off-by: Jim Paris <jim@jtan.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 22 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.h | 4 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index a5c21ca959d8..76cfb096e4f8 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
@@ -1327,6 +1327,17 @@ static int vidioc_g_parm(struct file *filp, void *priv, | |||
1327 | memset(parm, 0, sizeof *parm); | 1327 | memset(parm, 0, sizeof *parm); |
1328 | parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1328 | parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1329 | parm->parm.capture.readbuffers = gspca_dev->nbufread; | 1329 | parm->parm.capture.readbuffers = gspca_dev->nbufread; |
1330 | |||
1331 | if (gspca_dev->sd_desc->get_streamparm) { | ||
1332 | int ret; | ||
1333 | |||
1334 | if (mutex_lock_interruptible(&gspca_dev->usb_lock)) | ||
1335 | return -ERESTARTSYS; | ||
1336 | ret = gspca_dev->sd_desc->get_streamparm(gspca_dev, parm); | ||
1337 | mutex_unlock(&gspca_dev->usb_lock); | ||
1338 | return ret; | ||
1339 | } | ||
1340 | |||
1330 | return 0; | 1341 | return 0; |
1331 | } | 1342 | } |
1332 | 1343 | ||
@@ -1341,6 +1352,17 @@ static int vidioc_s_parm(struct file *filp, void *priv, | |||
1341 | parm->parm.capture.readbuffers = gspca_dev->nbufread; | 1352 | parm->parm.capture.readbuffers = gspca_dev->nbufread; |
1342 | else | 1353 | else |
1343 | gspca_dev->nbufread = n; | 1354 | gspca_dev->nbufread = n; |
1355 | |||
1356 | if (gspca_dev->sd_desc->set_streamparm) { | ||
1357 | int ret; | ||
1358 | |||
1359 | if (mutex_lock_interruptible(&gspca_dev->usb_lock)) | ||
1360 | return -ERESTARTSYS; | ||
1361 | ret = gspca_dev->sd_desc->set_streamparm(gspca_dev, parm); | ||
1362 | mutex_unlock(&gspca_dev->usb_lock); | ||
1363 | return ret; | ||
1364 | } | ||
1365 | |||
1344 | return 0; | 1366 | return 0; |
1345 | } | 1367 | } |
1346 | 1368 | ||
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h index 15db13296b83..79cef31a5e33 100644 --- a/drivers/media/video/gspca/gspca.h +++ b/drivers/media/video/gspca/gspca.h | |||
@@ -74,6 +74,8 @@ typedef void (*cam_v_op) (struct gspca_dev *); | |||
74 | typedef int (*cam_cf_op) (struct gspca_dev *, const struct usb_device_id *); | 74 | typedef int (*cam_cf_op) (struct gspca_dev *, const struct usb_device_id *); |
75 | typedef int (*cam_jpg_op) (struct gspca_dev *, | 75 | typedef int (*cam_jpg_op) (struct gspca_dev *, |
76 | struct v4l2_jpegcompression *); | 76 | struct v4l2_jpegcompression *); |
77 | typedef int (*cam_streamparm_op) (struct gspca_dev *, | ||
78 | struct v4l2_streamparm *); | ||
77 | typedef int (*cam_qmnu_op) (struct gspca_dev *, | 79 | typedef int (*cam_qmnu_op) (struct gspca_dev *, |
78 | struct v4l2_querymenu *); | 80 | struct v4l2_querymenu *); |
79 | typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev, | 81 | typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev, |
@@ -106,6 +108,8 @@ struct sd_desc { | |||
106 | cam_jpg_op get_jcomp; | 108 | cam_jpg_op get_jcomp; |
107 | cam_jpg_op set_jcomp; | 109 | cam_jpg_op set_jcomp; |
108 | cam_qmnu_op querymenu; | 110 | cam_qmnu_op querymenu; |
111 | cam_streamparm_op get_streamparm; | ||
112 | cam_streamparm_op set_streamparm; | ||
109 | }; | 113 | }; |
110 | 114 | ||
111 | /* packet types when moving from iso buf to frame buf */ | 115 | /* packet types when moving from iso buf to frame buf */ |