Skip to content

Commit

Permalink
ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk
Browse files Browse the repository at this point in the history
Do not rewrite the whole register, but only update the needed
bits in set_dai_sysclk functions.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Oct 19, 2009
1 parent 3da8e68 commit d8707ce
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions sound/soc/codecs/twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -1785,19 +1785,21 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
{
struct snd_soc_codec *codec = codec_dai->codec;
struct twl4030_priv *twl4030 = codec->private_data;
u8 infreq;
u8 apll_ctrl;

apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
apll_ctrl &= ~TWL4030_APLL_INFREQ;
switch (freq) {
case 19200000:
infreq = TWL4030_APLL_INFREQ_19200KHZ;
apll_ctrl |= TWL4030_APLL_INFREQ_19200KHZ;
twl4030->sysclk = 19200;
break;
case 26000000:
infreq = TWL4030_APLL_INFREQ_26000KHZ;
apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
twl4030->sysclk = 26000;
break;
case 38400000:
infreq = TWL4030_APLL_INFREQ_38400KHZ;
apll_ctrl |= TWL4030_APLL_INFREQ_38400KHZ;
twl4030->sysclk = 38400;
break;
default:
Expand All @@ -1806,8 +1808,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
return -EINVAL;
}

infreq |= TWL4030_APLL_EN;
twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);

return 0;
}
Expand Down Expand Up @@ -1989,20 +1990,21 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_codec *codec = codec_dai->codec;
u8 infreq;
u8 apll_ctrl;

apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL);
apll_ctrl &= ~TWL4030_APLL_INFREQ;
switch (freq) {
case 26000000:
infreq = TWL4030_APLL_INFREQ_26000KHZ;
apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ;
break;
default:
printk(KERN_ERR "TWL4030 voice set sysclk: unknown rate %d\n",
freq);
return -EINVAL;
}

infreq |= TWL4030_APLL_EN;
twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq);
twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl);

return 0;
}
Expand Down

0 comments on commit d8707ce

Please sign in to comment.