aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-controls.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-25 05:32:44 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:12:23 -0400
commitadb65bc71c8fef53822870cc9018f05b11131233 (patch)
treee169680cdf319bc35b645b2735ec569980ef5e92 /drivers/media/video/ivtv/ivtv-controls.c
parentd8799b4699af008290e141804b40c5ebf3d7dc35 (diff)
V4L/DVB (8113): ivtv/cx18: remove s/g_ctrl, now all controls are handled through s/g_ext_ctrl
videodev converts old-style controls to an extended control so the ivtv and cx18 drivers no longer have to handle both. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-controls.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-controls.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
index 6a5b70912959..48e103be7183 100644
--- a/drivers/media/video/ivtv/ivtv-controls.c
+++ b/drivers/media/video/ivtv/ivtv-controls.c
@@ -98,10 +98,24 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
98 cx2341x_ctrl_get_menu(&itv->params, qmenu->id)); 98 cx2341x_ctrl_get_menu(&itv->params, qmenu->id));
99} 99}
100 100
101int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) 101static int ivtv_try_ctrl(struct file *file, void *fh,
102 struct v4l2_ext_control *vctrl)
102{ 103{
103 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 104 struct v4l2_queryctrl qctrl;
105 const char **menu_items = NULL;
106 int err;
107
108 qctrl.id = vctrl->id;
109 err = ivtv_queryctrl(file, fh, &qctrl);
110 if (err)
111 return err;
112 if (qctrl.type == V4L2_CTRL_TYPE_MENU)
113 menu_items = v4l2_ctrl_get_menu(qctrl.id);
114 return v4l2_ctrl_check(vctrl, &qctrl, menu_items);
115}
104 116
117static int ivtv_s_ctrl(struct ivtv *itv, struct v4l2_control *vctrl)
118{
105 switch (vctrl->id) { 119 switch (vctrl->id) {
106 /* Standard V4L2 controls */ 120 /* Standard V4L2 controls */
107 case V4L2_CID_BRIGHTNESS: 121 case V4L2_CID_BRIGHTNESS:
@@ -125,10 +139,8 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
125 return 0; 139 return 0;
126} 140}
127 141
128int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) 142static int ivtv_g_ctrl(struct ivtv *itv, struct v4l2_control *vctrl)
129{ 143{
130 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
131
132 switch (vctrl->id) { 144 switch (vctrl->id) {
133 /* Standard V4L2 controls */ 145 /* Standard V4L2 controls */
134 case V4L2_CID_BRIGHTNESS: 146 case V4L2_CID_BRIGHTNESS:
@@ -203,7 +215,7 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
203 for (i = 0; i < c->count; i++) { 215 for (i = 0; i < c->count; i++) {
204 ctrl.id = c->controls[i].id; 216 ctrl.id = c->controls[i].id;
205 ctrl.value = c->controls[i].value; 217 ctrl.value = c->controls[i].value;
206 err = ivtv_g_ctrl(file, fh, &ctrl); 218 err = ivtv_g_ctrl(itv, &ctrl);
207 c->controls[i].value = ctrl.value; 219 c->controls[i].value = ctrl.value;
208 if (err) { 220 if (err) {
209 c->error_idx = i; 221 c->error_idx = i;
@@ -229,7 +241,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
229 for (i = 0; i < c->count; i++) { 241 for (i = 0; i < c->count; i++) {
230 ctrl.id = c->controls[i].id; 242 ctrl.id = c->controls[i].id;
231 ctrl.value = c->controls[i].value; 243 ctrl.value = c->controls[i].value;
232 err = ivtv_s_ctrl(file, fh, &ctrl); 244 err = ivtv_s_ctrl(itv, &ctrl);
233 c->controls[i].value = ctrl.value; 245 c->controls[i].value = ctrl.value;
234 if (err) { 246 if (err) {
235 c->error_idx = i; 247 c->error_idx = i;
@@ -277,6 +289,19 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
277{ 289{
278 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 290 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
279 291
292 if (c->ctrl_class == V4L2_CTRL_CLASS_USER) {
293 int i;
294 int err = 0;
295
296 for (i = 0; i < c->count; i++) {
297 err = ivtv_try_ctrl(file, fh, &c->controls[i]);
298 if (err) {
299 c->error_idx = i;
300 break;
301 }
302 }
303 return err;
304 }
280 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 305 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
281 return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); 306 return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS);
282 return -EINVAL; 307 return -EINVAL;