aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2011-08-26 06:35:14 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-09-21 08:52:21 -0400
commit88365105d683187e02a4f75220eaf51fd0c0b6e0 (patch)
treeacbc18b9e8eb7f74630fb7fd709cb35eafd30f54
parent74a45790861f659058e8f8b565d98e5a1fdd8440 (diff)
[media] v4l2-ctrls: replace is_volatile with V4L2_CTRL_FLAG_VOLATILE
With the new flag there is no need anymore to have a separate is_volatile field. Modify all users to use the new flag. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--Documentation/video4linux/v4l2-controls.txt13
-rw-r--r--drivers/media/radio/radio-wl1273.c2
-rw-r--r--drivers/media/radio/wl128x/fmdrv_v4l2.c2
-rw-r--r--drivers/media/video/adp1653.c2
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c10
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_dec.c4
-rw-r--r--drivers/media/video/s5p-mfc/s5p_mfc_enc.c2
-rw-r--r--drivers/media/video/saa7115.c2
-rw-r--r--drivers/media/video/v4l2-ctrls.c36
-rw-r--r--include/media/v4l2-ctrls.h12
10 files changed, 36 insertions, 49 deletions
diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt
index 9346fc8cbf2b..f92ee3053940 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -285,11 +285,11 @@ implement g_volatile_ctrl like this:
285Note that you use the 'new value' union as well in g_volatile_ctrl. In general 285Note that you use the 'new value' union as well in g_volatile_ctrl. In general
286controls that need to implement g_volatile_ctrl are read-only controls. 286controls that need to implement g_volatile_ctrl are read-only controls.
287 287
288To mark a control as volatile you have to set the is_volatile flag: 288To mark a control as volatile you have to set V4L2_CTRL_FLAG_VOLATILE:
289 289
290 ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...); 290 ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...);
291 if (ctrl) 291 if (ctrl)
292 ctrl->is_volatile = 1; 292 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
293 293
294For try/s_ctrl the new values (i.e. as passed by the user) are filled in and 294For try/s_ctrl the new values (i.e. as passed by the user) are filled in and
295you can modify them in try_ctrl or set them in s_ctrl. The 'cur' union 295you can modify them in try_ctrl or set them in s_ctrl. The 'cur' union
@@ -367,8 +367,7 @@ Driver specific controls can be created using v4l2_ctrl_new_custom():
367The last argument is the priv pointer which can be set to driver-specific 367The last argument is the priv pointer which can be set to driver-specific
368private data. 368private data.
369 369
370The v4l2_ctrl_config struct also has fields to set the is_private and is_volatile 370The v4l2_ctrl_config struct also has a field to set the is_private flag.
371flags.
372 371
373If the name field is not set, then the framework will assume this is a standard 372If the name field is not set, then the framework will assume this is a standard
374control and will fill in the name, type and flags fields accordingly. 373control and will fill in the name, type and flags fields accordingly.
@@ -506,8 +505,8 @@ operation should return the value that the hardware's automatic mode set up
506automatically. 505automatically.
507 506
508If the cluster is put in manual mode, then the manual controls should become 507If the cluster is put in manual mode, then the manual controls should become
509active again and the is_volatile flag should be ignored (so g_volatile_ctrl is 508active again and V4L2_CTRL_FLAG_VOLATILE should be ignored (so g_volatile_ctrl
510no longer called while in manual mode). 509is no longer called while in manual mode).
511 510
512Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since 511Finally the V4L2_CTRL_FLAG_UPDATE should be set for the auto control since
513changing that control affects the control flags of the manual controls. 512changing that control affects the control flags of the manual controls.
@@ -520,7 +519,7 @@ void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
520 519
521The first two arguments are identical to v4l2_ctrl_cluster. The third argument 520The first two arguments are identical to v4l2_ctrl_cluster. The third argument
522tells the framework which value switches the cluster into manual mode. The 521tells the framework which value switches the cluster into manual mode. The
523last argument will optionally set the is_volatile flag for the non-auto controls. 522last argument will optionally set V4L2_CTRL_FLAG_VOLATILE for the non-auto controls.
524 523
525The first control of the cluster is assumed to be the 'auto' control. 524The first control of the cluster is assumed to be the 'auto' control.
526 525
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c
index 46cacf845049..6d1e4e750f63 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -2109,7 +2109,7 @@ static int __devinit wl1273_fm_radio_probe(struct platform_device *pdev)
2109 V4L2_CID_TUNE_ANTENNA_CAPACITOR, 2109 V4L2_CID_TUNE_ANTENNA_CAPACITOR,
2110 0, 255, 1, 255); 2110 0, 255, 1, 255);
2111 if (ctrl) 2111 if (ctrl)
2112 ctrl->is_volatile = 1; 2112 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
2113 2113
2114 if (radio->ctrl_handler.error) { 2114 if (radio->ctrl_handler.error) {
2115 r = radio->ctrl_handler.error; 2115 r = radio->ctrl_handler.error;
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c
index 478d1e93ada6..aaee74752a85 100644
--- a/drivers/media/radio/wl128x/fmdrv_v4l2.c
+++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c
@@ -559,7 +559,7 @@ int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
559 255, 1, 255); 559 255, 1, 255);
560 560
561 if (ctrl) 561 if (ctrl)
562 ctrl->is_volatile = 1; 562 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
563 563
564 return 0; 564 return 0;
565} 565}
diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c
index 279d75d38188..d0e8ac1f9cde 100644
--- a/drivers/media/video/adp1653.c
+++ b/drivers/media/video/adp1653.c
@@ -258,7 +258,7 @@ static int adp1653_init_controls(struct adp1653_flash *flash)
258 if (flash->ctrls.error) 258 if (flash->ctrls.error)
259 return flash->ctrls.error; 259 return flash->ctrls.error;
260 260
261 fault->is_volatile = 1; 261 fault->flags |= V4L2_CTRL_FLAG_VOLATILE;
262 262
263 flash->subdev.ctrl_handler = &flash->ctrls; 263 flash->subdev.ctrl_handler = &flash->ctrls;
264 return 0; 264 return 0;
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index 8c70e64444e7..6873bf50869f 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -640,7 +640,7 @@ static int pwc_set_awb(struct pwc_device *pdev)
640 return ret; 640 return ret;
641 641
642 /* Update val when coming from auto or going to a preset */ 642 /* Update val when coming from auto or going to a preset */
643 if (pdev->red_balance->is_volatile || 643 if ((pdev->red_balance->flags & V4L2_CTRL_FLAG_VOLATILE) ||
644 pdev->auto_white_balance->val == awb_indoor || 644 pdev->auto_white_balance->val == awb_indoor ||
645 pdev->auto_white_balance->val == awb_outdoor || 645 pdev->auto_white_balance->val == awb_outdoor ||
646 pdev->auto_white_balance->val == awb_fl) { 646 pdev->auto_white_balance->val == awb_fl) {
@@ -654,12 +654,12 @@ static int pwc_set_awb(struct pwc_device *pdev)
654 &pdev->blue_balance->val); 654 &pdev->blue_balance->val);
655 } 655 }
656 if (pdev->auto_white_balance->val == awb_auto) { 656 if (pdev->auto_white_balance->val == awb_auto) {
657 pdev->red_balance->is_volatile = true; 657 pdev->red_balance->flags |= V4L2_CTRL_FLAG_VOLATILE;
658 pdev->blue_balance->is_volatile = true; 658 pdev->blue_balance->flags |= V4L2_CTRL_FLAG_VOLATILE;
659 pdev->color_bal_valid = false; /* Force cache update */ 659 pdev->color_bal_valid = false; /* Force cache update */
660 } else { 660 } else {
661 pdev->red_balance->is_volatile = false; 661 pdev->red_balance->flags &= ~V4L2_CTRL_FLAG_VOLATILE;
662 pdev->blue_balance->is_volatile = false; 662 pdev->blue_balance->flags &= ~V4L2_CTRL_FLAG_VOLATILE;
663 } 663 }
664 } 664 }
665 665
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
index 32f898979809..bfbe08432050 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c
@@ -165,7 +165,7 @@ static struct mfc_control controls[] = {
165 .maximum = 32, 165 .maximum = 32,
166 .step = 1, 166 .step = 1,
167 .default_value = 1, 167 .default_value = 1,
168 .is_volatile = 1, 168 .flags = V4L2_CTRL_FLAG_VOLATILE,
169 }, 169 },
170}; 170};
171 171
@@ -1020,7 +1020,7 @@ int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx)
1020 return ctx->ctrl_handler.error; 1020 return ctx->ctrl_handler.error;
1021 } 1021 }
1022 if (controls[i].is_volatile && ctx->ctrls[i]) 1022 if (controls[i].is_volatile && ctx->ctrls[i])
1023 ctx->ctrls[i]->is_volatile = 1; 1023 ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE;
1024 } 1024 }
1025 return 0; 1025 return 0;
1026} 1026}
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
index 14ddbd26ebf4..4c90e53bd964 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c
@@ -1814,7 +1814,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx)
1814 return ctx->ctrl_handler.error; 1814 return ctx->ctrl_handler.error;
1815 } 1815 }
1816 if (controls[i].is_volatile && ctx->ctrls[i]) 1816 if (controls[i].is_volatile && ctx->ctrls[i])
1817 ctx->ctrls[i]->is_volatile = 1; 1817 ctx->ctrls[i]->flags |= V4L2_CTRL_FLAG_VOLATILE;
1818 } 1818 }
1819 return 0; 1819 return 0;
1820} 1820}
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index f2ae405c74ac..e443d0d54f8f 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1601,7 +1601,7 @@ static int saa711x_probe(struct i2c_client *client,
1601 V4L2_CID_CHROMA_AGC, 0, 1, 1, 1); 1601 V4L2_CID_CHROMA_AGC, 0, 1, 1, 1);
1602 state->gain = v4l2_ctrl_new_std(hdl, &saa711x_ctrl_ops, 1602 state->gain = v4l2_ctrl_new_std(hdl, &saa711x_ctrl_ops,
1603 V4L2_CID_CHROMA_GAIN, 0, 127, 1, 40); 1603 V4L2_CID_CHROMA_GAIN, 0, 127, 1, 40);
1604 state->gain->is_volatile = 1; 1604 state->gain->flags |= V4L2_CTRL_FLAG_VOLATILE;
1605 sd->ctrl_handler = hdl; 1605 sd->ctrl_handler = hdl;
1606 if (hdl->error) { 1606 if (hdl->error) {
1607 int err = hdl->error; 1607 int err = hdl->error;
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 06b6014d4fb4..166762182f8e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -43,7 +43,7 @@ struct v4l2_ctrl_helper {
43}; 43};
44 44
45/* Small helper function to determine if the autocluster is set to manual 45/* Small helper function to determine if the autocluster is set to manual
46 mode. In that case the is_volatile flag should be ignored. */ 46 mode. */
47static bool is_cur_manual(const struct v4l2_ctrl *master) 47static bool is_cur_manual(const struct v4l2_ctrl *master)
48{ 48{
49 return master->is_auto && master->cur.val == master->manual_mode_value; 49 return master->is_auto && master->cur.val == master->manual_mode_value;
@@ -1394,10 +1394,8 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
1394 type, min, max, 1394 type, min, max,
1395 is_menu ? cfg->menu_skip_mask : step, 1395 is_menu ? cfg->menu_skip_mask : step,
1396 def, flags, qmenu, priv); 1396 def, flags, qmenu, priv);
1397 if (ctrl) { 1397 if (ctrl)
1398 ctrl->is_private = cfg->is_private; 1398 ctrl->is_private = cfg->is_private;
1399 ctrl->is_volatile = cfg->is_volatile;
1400 }
1401 return ctrl; 1399 return ctrl;
1402} 1400}
1403EXPORT_SYMBOL(v4l2_ctrl_new_custom); 1401EXPORT_SYMBOL(v4l2_ctrl_new_custom);
@@ -1519,12 +1517,12 @@ void v4l2_ctrl_auto_cluster(unsigned ncontrols, struct v4l2_ctrl **controls,
1519 master->manual_mode_value = manual_val; 1517 master->manual_mode_value = manual_val;
1520 master->flags |= V4L2_CTRL_FLAG_UPDATE; 1518 master->flags |= V4L2_CTRL_FLAG_UPDATE;
1521 flag = is_cur_manual(master) ? 0 : V4L2_CTRL_FLAG_INACTIVE; 1519 flag = is_cur_manual(master) ? 0 : V4L2_CTRL_FLAG_INACTIVE;
1520 if (set_volatile)
1521 flag |= V4L2_CTRL_FLAG_VOLATILE;
1522 1522
1523 for (i = 1; i < ncontrols; i++) 1523 for (i = 1; i < ncontrols; i++)
1524 if (controls[i]) { 1524 if (controls[i])
1525 controls[i]->is_volatile = set_volatile;
1526 controls[i]->flags |= flag; 1525 controls[i]->flags |= flag;
1527 }
1528} 1526}
1529EXPORT_SYMBOL(v4l2_ctrl_auto_cluster); 1527EXPORT_SYMBOL(v4l2_ctrl_auto_cluster);
1530 1528
@@ -1579,9 +1577,6 @@ EXPORT_SYMBOL(v4l2_ctrl_grab);
1579static void log_ctrl(const struct v4l2_ctrl *ctrl, 1577static void log_ctrl(const struct v4l2_ctrl *ctrl,
1580 const char *prefix, const char *colon) 1578 const char *prefix, const char *colon)
1581{ 1579{
1582 int fl_inact = ctrl->flags & V4L2_CTRL_FLAG_INACTIVE;
1583 int fl_grabbed = ctrl->flags & V4L2_CTRL_FLAG_GRABBED;
1584
1585 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY)) 1580 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY))
1586 return; 1581 return;
1587 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) 1582 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS)
@@ -1612,14 +1607,17 @@ static void log_ctrl(const struct v4l2_ctrl *ctrl,
1612 printk(KERN_CONT "unknown type %d", ctrl->type); 1607 printk(KERN_CONT "unknown type %d", ctrl->type);
1613 break; 1608 break;
1614 } 1609 }
1615 if (fl_inact && fl_grabbed) 1610 if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE |
1616 printk(KERN_CONT " (inactive, grabbed)\n"); 1611 V4L2_CTRL_FLAG_GRABBED |
1617 else if (fl_inact) 1612 V4L2_CTRL_FLAG_VOLATILE)) {
1618 printk(KERN_CONT " (inactive)\n"); 1613 if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE)
1619 else if (fl_grabbed) 1614 printk(KERN_CONT " inactive");
1620 printk(KERN_CONT " (grabbed)\n"); 1615 if (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)
1621 else 1616 printk(KERN_CONT " grabbed");
1622 printk(KERN_CONT "\n"); 1617 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE)
1618 printk(KERN_CONT " volatile");
1619 }
1620 printk(KERN_CONT "\n");
1623} 1621}
1624 1622
1625/* Log all controls owned by the handler */ 1623/* Log all controls owned by the handler */
@@ -2004,7 +2002,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
2004 2002
2005 v4l2_ctrl_lock(master); 2003 v4l2_ctrl_lock(master);
2006 /* g_volatile_ctrl will update the current control values */ 2004 /* g_volatile_ctrl will update the current control values */
2007 if (ctrl->is_volatile && !is_cur_manual(master)) { 2005 if ((ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) && !is_cur_manual(master)) {
2008 for (i = 0; i < master->ncontrols; i++) 2006 for (i = 0; i < master->ncontrols; i++)
2009 cur_to_new(master->cluster[i]); 2007 cur_to_new(master->cluster[i]);
2010 ret = call_op(master, g_volatile_ctrl); 2008 ret = call_op(master, g_volatile_ctrl);
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 13fe4d744aba..bd6a4a7370df 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -65,10 +65,6 @@ struct v4l2_ctrl_ops {
65 * @is_private: If set, then this control is private to its handler and it 65 * @is_private: If set, then this control is private to its handler and it
66 * will not be added to any other handlers. Drivers can set 66 * will not be added to any other handlers. Drivers can set
67 * this flag. 67 * this flag.
68 * @is_volatile: If set, then this control is volatile. This means that the
69 * control's current value cannot be cached and needs to be
70 * retrieved through the g_volatile_ctrl op. Drivers can set
71 * this flag.
72 * @is_auto: If set, then this control selects whether the other cluster 68 * @is_auto: If set, then this control selects whether the other cluster
73 * members are in 'automatic' mode or 'manual' mode. This is 69 * members are in 'automatic' mode or 'manual' mode. This is
74 * used for autogain/gain type clusters. Drivers should never 70 * used for autogain/gain type clusters. Drivers should never
@@ -118,7 +114,6 @@ struct v4l2_ctrl {
118 114
119 unsigned int is_new:1; 115 unsigned int is_new:1;
120 unsigned int is_private:1; 116 unsigned int is_private:1;
121 unsigned int is_volatile:1;
122 unsigned int is_auto:1; 117 unsigned int is_auto:1;
123 unsigned int manual_mode_value:8; 118 unsigned int manual_mode_value:8;
124 119
@@ -208,9 +203,6 @@ struct v4l2_ctrl_handler {
208 * must be NULL. 203 * must be NULL.
209 * @is_private: If set, then this control is private to its handler and it 204 * @is_private: If set, then this control is private to its handler and it
210 * will not be added to any other handlers. 205 * will not be added to any other handlers.
211 * @is_volatile: If set, then this control is volatile. This means that the
212 * control's current value cannot be cached and needs to be
213 * retrieved through the g_volatile_ctrl op.
214 */ 206 */
215struct v4l2_ctrl_config { 207struct v4l2_ctrl_config {
216 const struct v4l2_ctrl_ops *ops; 208 const struct v4l2_ctrl_ops *ops;
@@ -225,7 +217,6 @@ struct v4l2_ctrl_config {
225 u32 menu_skip_mask; 217 u32 menu_skip_mask;
226 const char * const *qmenu; 218 const char * const *qmenu;
227 unsigned int is_private:1; 219 unsigned int is_private:1;
228 unsigned int is_volatile:1;
229}; 220};
230 221
231/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID. 222/** v4l2_ctrl_fill() - Fill in the control fields based on the control ID.
@@ -389,8 +380,7 @@ void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls);
389 * @manual_val: The value for the first control in the cluster that equals the 380 * @manual_val: The value for the first control in the cluster that equals the
390 * manual setting. 381 * manual setting.
391 * @set_volatile: If true, then all controls except the first auto control will 382 * @set_volatile: If true, then all controls except the first auto control will
392 * have is_volatile set to true. If false, then is_volatile will not 383 * be volatile.
393 * be touched.
394 * 384 *
395 * Use for control groups where one control selects some automatic feature and 385 * Use for control groups where one control selects some automatic feature and
396 * the other controls are only active whenever the automatic feature is turned 386 * the other controls are only active whenever the automatic feature is turned