aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-controls.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-controls.c')
-rw-r--r--drivers/media/video/cx18/cx18-controls.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
index 855313359370..f46c7e5ed747 100644
--- a/drivers/media/video/cx18/cx18-controls.c
+++ b/drivers/media/video/cx18/cx18-controls.c
@@ -101,16 +101,24 @@ int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu)
101 cx2341x_ctrl_get_menu(&cx->params, qmenu->id)); 101 cx2341x_ctrl_get_menu(&cx->params, qmenu->id));
102} 102}
103 103
104int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) 104static int cx18_try_ctrl(struct file *file, void *fh,
105 struct v4l2_ext_control *vctrl)
105{ 106{
106 struct cx18_open_id *id = fh; 107 struct v4l2_queryctrl qctrl;
107 struct cx18 *cx = id->cx; 108 const char **menu_items = NULL;
108 int ret; 109 int err;
109 110
110 ret = v4l2_prio_check(&cx->prio, &id->prio); 111 qctrl.id = vctrl->id;
111 if (ret) 112 err = cx18_queryctrl(file, fh, &qctrl);
112 return ret; 113 if (err)
114 return err;
115 if (qctrl.type == V4L2_CTRL_TYPE_MENU)
116 menu_items = v4l2_ctrl_get_menu(qctrl.id);
117 return v4l2_ctrl_check(vctrl, &qctrl, menu_items);
118}
113 119
120static int cx18_s_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
121{
114 switch (vctrl->id) { 122 switch (vctrl->id) {
115 /* Standard V4L2 controls */ 123 /* Standard V4L2 controls */
116 case V4L2_CID_BRIGHTNESS: 124 case V4L2_CID_BRIGHTNESS:
@@ -134,10 +142,8 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
134 return 0; 142 return 0;
135} 143}
136 144
137int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) 145static int cx18_g_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
138{ 146{
139 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
140
141 switch (vctrl->id) { 147 switch (vctrl->id) {
142 /* Standard V4L2 controls */ 148 /* Standard V4L2 controls */
143 case V4L2_CID_BRIGHTNESS: 149 case V4L2_CID_BRIGHTNESS:
@@ -211,7 +217,7 @@ int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
211 for (i = 0; i < c->count; i++) { 217 for (i = 0; i < c->count; i++) {
212 ctrl.id = c->controls[i].id; 218 ctrl.id = c->controls[i].id;
213 ctrl.value = c->controls[i].value; 219 ctrl.value = c->controls[i].value;
214 err = cx18_g_ctrl(file, fh, &ctrl); 220 err = cx18_g_ctrl(cx, &ctrl);
215 c->controls[i].value = ctrl.value; 221 c->controls[i].value = ctrl.value;
216 if (err) { 222 if (err) {
217 c->error_idx = i; 223 c->error_idx = i;
@@ -243,7 +249,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
243 for (i = 0; i < c->count; i++) { 249 for (i = 0; i < c->count; i++) {
244 ctrl.id = c->controls[i].id; 250 ctrl.id = c->controls[i].id;
245 ctrl.value = c->controls[i].value; 251 ctrl.value = c->controls[i].value;
246 err = cx18_s_ctrl(file, fh, &ctrl); 252 err = cx18_s_ctrl(cx, &ctrl);
247 c->controls[i].value = ctrl.value; 253 c->controls[i].value = ctrl.value;
248 if (err) { 254 if (err) {
249 c->error_idx = i; 255 c->error_idx = i;
@@ -287,6 +293,19 @@ int cx18_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
287{ 293{
288 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 294 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
289 295
296 if (c->ctrl_class == V4L2_CTRL_CLASS_USER) {
297 int i;
298 int err = 0;
299
300 for (i = 0; i < c->count; i++) {
301 err = cx18_try_ctrl(file, fh, &c->controls[i]);
302 if (err) {
303 c->error_idx = i;
304 break;
305 }
306 }
307 return err;
308 }
290 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) 309 if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
291 return cx2341x_ext_ctrls(&cx->params, 310 return cx2341x_ext_ctrls(&cx->params,
292 atomic_read(&cx->ana_capturing), 311 atomic_read(&cx->ana_capturing),