diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2011-06-10 04:43:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:53:17 -0400 |
commit | ddac5c107942d9584a9f55701aad405b57618726 (patch) | |
tree | bb658b1179f6c763730157d0b4c10d0d287fe410 /drivers/media/radio/wl128x | |
parent | 18d171badf47a436045589668f785b7d278f4e4d (diff) |
[media] v4l2-ctrls: fix and improve volatile control handling
If you have a cluster of controls that is a mix of volatile and non-volatile
controls, then requesting the value of the volatile control would fail if the
master control of that cluster was non-volatile. The code assumed that the
volatile state of the master control was the same for all other controls in
the cluster.
This is now fixed.
In addition, it was clear from bugs in some drivers that it was confusing that
the ctrl->cur union had to be used in g_volatile_ctrl. Several drivers used the
'new' values instead. The framework was changed so that drivers now set the new
value instead of the current value.
This has an additional benefit as well: the volatile values are now only stored
in the 'new' value, leaving the current value alone. This is useful for
autofoo/foo control clusters where you want to have a 'foo' control act like a
volatile control if 'autofoo' is on, but as a normal control when it is off.
Since with this change the cur value is no longer overwritten when g_volatile_ctrl
is called, you can use it to remember the original 'foo' value. For example:
autofoo = 0, foo = 10 and foo is non-volatile.
Now autofoo is set to 1 and foo is marked volatile. Retrieving the foo value
will get the volatile value. Set autofoo back to 0, which marks foo as non-
volatile again, and retrieving foo will get the old current value of 10.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/wl128x')
-rw-r--r-- | drivers/media/radio/wl128x/fmdrv_v4l2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index a4f05e018ca6..8c0e19276970 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c | |||
@@ -190,7 +190,7 @@ static int fm_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
190 | 190 | ||
191 | switch (ctrl->id) { | 191 | switch (ctrl->id) { |
192 | case V4L2_CID_TUNE_ANTENNA_CAPACITOR: | 192 | case V4L2_CID_TUNE_ANTENNA_CAPACITOR: |
193 | ctrl->cur.val = fm_tx_get_tune_cap_val(fmdev); | 193 | ctrl->val = fm_tx_get_tune_cap_val(fmdev); |
194 | break; | 194 | break; |
195 | default: | 195 | default: |
196 | fmwarn("%s: Unknown IOCTL: %d\n", __func__, ctrl->id); | 196 | fmwarn("%s: Unknown IOCTL: %d\n", __func__, ctrl->id); |