diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2009-10-19 08:42:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-10-19 11:12:17 -0400 |
commit | d8707cecdf396bdb506252829d03837b2c67c939 (patch) | |
tree | 8a25da418c449a5bbec033fbfde451d1a624e2f5 /sound/soc/codecs/twl4030.c | |
parent | 3da8e6885ec2dea67321c904d721be90e00cd748 (diff) |
ASoC: TWL4030: Only update the needed bits in *set_dai_sysclk
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>
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 4df7c6c61c76..559e9b279289 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -1785,19 +1785,21 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
1785 | { | 1785 | { |
1786 | struct snd_soc_codec *codec = codec_dai->codec; | 1786 | struct snd_soc_codec *codec = codec_dai->codec; |
1787 | struct twl4030_priv *twl4030 = codec->private_data; | 1787 | struct twl4030_priv *twl4030 = codec->private_data; |
1788 | u8 infreq; | 1788 | u8 apll_ctrl; |
1789 | 1789 | ||
1790 | apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL); | ||
1791 | apll_ctrl &= ~TWL4030_APLL_INFREQ; | ||
1790 | switch (freq) { | 1792 | switch (freq) { |
1791 | case 19200000: | 1793 | case 19200000: |
1792 | infreq = TWL4030_APLL_INFREQ_19200KHZ; | 1794 | apll_ctrl |= TWL4030_APLL_INFREQ_19200KHZ; |
1793 | twl4030->sysclk = 19200; | 1795 | twl4030->sysclk = 19200; |
1794 | break; | 1796 | break; |
1795 | case 26000000: | 1797 | case 26000000: |
1796 | infreq = TWL4030_APLL_INFREQ_26000KHZ; | 1798 | apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ; |
1797 | twl4030->sysclk = 26000; | 1799 | twl4030->sysclk = 26000; |
1798 | break; | 1800 | break; |
1799 | case 38400000: | 1801 | case 38400000: |
1800 | infreq = TWL4030_APLL_INFREQ_38400KHZ; | 1802 | apll_ctrl |= TWL4030_APLL_INFREQ_38400KHZ; |
1801 | twl4030->sysclk = 38400; | 1803 | twl4030->sysclk = 38400; |
1802 | break; | 1804 | break; |
1803 | default: | 1805 | default: |
@@ -1806,8 +1808,7 @@ static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
1806 | return -EINVAL; | 1808 | return -EINVAL; |
1807 | } | 1809 | } |
1808 | 1810 | ||
1809 | infreq |= TWL4030_APLL_EN; | 1811 | twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl); |
1810 | twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq); | ||
1811 | 1812 | ||
1812 | return 0; | 1813 | return 0; |
1813 | } | 1814 | } |
@@ -1989,11 +1990,13 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
1989 | int clk_id, unsigned int freq, int dir) | 1990 | int clk_id, unsigned int freq, int dir) |
1990 | { | 1991 | { |
1991 | struct snd_soc_codec *codec = codec_dai->codec; | 1992 | struct snd_soc_codec *codec = codec_dai->codec; |
1992 | u8 infreq; | 1993 | u8 apll_ctrl; |
1993 | 1994 | ||
1995 | apll_ctrl = twl4030_read_reg_cache(codec, TWL4030_REG_APLL_CTL); | ||
1996 | apll_ctrl &= ~TWL4030_APLL_INFREQ; | ||
1994 | switch (freq) { | 1997 | switch (freq) { |
1995 | case 26000000: | 1998 | case 26000000: |
1996 | infreq = TWL4030_APLL_INFREQ_26000KHZ; | 1999 | apll_ctrl |= TWL4030_APLL_INFREQ_26000KHZ; |
1997 | break; | 2000 | break; |
1998 | default: | 2001 | default: |
1999 | printk(KERN_ERR "TWL4030 voice set sysclk: unknown rate %d\n", | 2002 | printk(KERN_ERR "TWL4030 voice set sysclk: unknown rate %d\n", |
@@ -2001,8 +2004,7 @@ static int twl4030_voice_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
2001 | return -EINVAL; | 2004 | return -EINVAL; |
2002 | } | 2005 | } |
2003 | 2006 | ||
2004 | infreq |= TWL4030_APLL_EN; | 2007 | twl4030_write(codec, TWL4030_REG_APLL_CTL, apll_ctrl); |
2005 | twl4030_write(codec, TWL4030_REG_APLL_CTL, infreq); | ||
2006 | 2008 | ||
2007 | return 0; | 2009 | return 0; |
2008 | } | 2010 | } |