aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-05-19 10:19:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 15:04:12 -0400
commit40e006aea811afb15e56164383b914cff7a078c7 (patch)
tree723453b8c42f5bae203d8e60156899f0cb6154dc /sound
parent5daf53a6eb5c54c618c9def388d81c2769fd11a0 (diff)
[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')
-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 ac62ee791a60..7eca25fae413 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)
120 return data; 120 return data;
121} 121}
122 122
123static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) 123static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
124{ 124{
125 u32 freq = snd_tea575x_read(tea) & TEA575X_BIT_FREQ_MASK; 125 u32 freq = val & TEA575X_BIT_FREQ_MASK;
126 126
127 if (freq == 0) 127 if (freq == 0)
128 return freq; 128 return freq;
@@ -139,6 +139,11 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ 139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */
140} 140}
141 141
142static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
143{
144 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
145}
146
142static void snd_tea575x_set_freq(struct snd_tea575x *tea) 147static void snd_tea575x_set_freq(struct snd_tea575x *tea)
143{ 148{
144 u32 freq = tea->freq; 149 u32 freq = tea->freq;
@@ -156,6 +161,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
156 tea->val &= ~TEA575X_BIT_FREQ_MASK; 161 tea->val &= ~TEA575X_BIT_FREQ_MASK;
157 tea->val |= freq & TEA575X_BIT_FREQ_MASK; 162 tea->val |= freq & TEA575X_BIT_FREQ_MASK;
158 snd_tea575x_write(tea, tea->val); 163 snd_tea575x_write(tea, tea->val);
164 tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
159} 165}
160 166
161/* 167/*