summaryrefslogtreecommitdiffstats
path: root/sound/i2c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-05-19 11:19:06 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 16:04:12 -0300
commit40e006aea811afb15e56164383b914cff7a078c7 (patch)
tree723453b8c42f5bae203d8e60156899f0cb6154dc /sound/i2c
parent5daf53a6eb5c54c618c9def388d81c2769fd11a0 (diff)
downloadop-kernel-dev-40e006aea811afb15e56164383b914cff7a078c7.zip
op-kernel-dev-40e006aea811afb15e56164383b914cff7a078c7.tar.gz
[media] snd_tea575x: set_freq: update cached freq to the actual achieved frequency
Signed-off-by: Hans de Goede <hdegoede@redhat.com> CC: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'sound/i2c')
-rw-r--r--sound/i2c/other/tea575x-tuner.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index ac62ee7..7eca25f 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -120,9 +120,9 @@ static u32 snd_tea575x_read(struct snd_tea575x *tea)
return data;
}
-static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
+static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
{
- u32 freq = snd_tea575x_read(tea) & TEA575X_BIT_FREQ_MASK;
+ u32 freq = val & TEA575X_BIT_FREQ_MASK;
if (freq == 0)
return freq;
@@ -139,6 +139,11 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */
}
+static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
+{
+ return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
+}
+
static void snd_tea575x_set_freq(struct snd_tea575x *tea)
{
u32 freq = tea->freq;
@@ -156,6 +161,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
tea->val &= ~TEA575X_BIT_FREQ_MASK;
tea->val |= freq & TEA575X_BIT_FREQ_MASK;
snd_tea575x_write(tea, tea->val);
+ tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
}
/*
OpenPOWER on IntegriCloud