Skip to content

Commit

Permalink
[media] snd_tea575x: set_freq: update cached freq to the actual achie…
Browse files Browse the repository at this point in the history
…ved frequency

Signed-off-by: Hans de Goede <[email protected]>
CC: Ondrej Zary <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jwrdegoede authored and Mauro Carvalho Chehab committed Jun 11, 2012
1 parent 5daf53a commit 40e006a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sound/i2c/other/tea575x-tuner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}

/*
Expand Down

0 comments on commit 40e006a

Please sign in to comment.