aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-01-03 08:27:52 -0500
committerMark Brown <broonie@linaro.org>2014-01-08 07:48:53 -0500
commit8b3bca2966985f559f9ace1effc98955006f2b05 (patch)
treeb7041006495fffd09daa656d3fb2a7bdba416d39 /sound/soc/codecs/twl4030.c
parent0dc41562a44c9e1012bb810c2a84e81c425867b0 (diff)
ASoC: twl4030: Introduce local ctl register cache
Few registers need to be cached in the codec driver level. These registers should only be written when the path is active to avoid pop noise on the given path. This patch adds an array which covers the range where the sensitive registers are located and uppon loadinf the driver the ctl cache will be initialized. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index ab2f22299db2..f88207712d3d 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -150,10 +150,22 @@ struct twl4030_priv {
150 u8 earpiece_enabled; 150 u8 earpiece_enabled;
151 u8 predrivel_enabled, predriver_enabled; 151 u8 predrivel_enabled, predriver_enabled;
152 u8 carkitl_enabled, carkitr_enabled; 152 u8 carkitl_enabled, carkitr_enabled;
153 u8 ctl_cache[TWL4030_REG_PRECKR_CTL - TWL4030_REG_EAR_CTL + 1];
153 154
154 struct twl4030_codec_data *pdata; 155 struct twl4030_codec_data *pdata;
155}; 156};
156 157
158static void tw4030_init_ctl_cache(struct twl4030_priv *twl4030)
159{
160 int i;
161 u8 byte;
162
163 for (i = TWL4030_REG_EAR_CTL; i <= TWL4030_REG_PRECKR_CTL; i++) {
164 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte, i);
165 twl4030->ctl_cache[i - TWL4030_REG_EAR_CTL] = byte;
166 }
167}
168
157/* 169/*
158 * read twl4030 register cache 170 * read twl4030 register cache
159 */ 171 */
@@ -348,6 +360,9 @@ static void twl4030_init_chip(struct snd_soc_codec *codec)
348 } 360 }
349 } 361 }
350 362
363 /* Initialize the local ctl register cache */
364 tw4030_init_ctl_cache(twl4030);
365
351 /* Refresh APLL_CTL register from HW */ 366 /* Refresh APLL_CTL register from HW */
352 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte, 367 twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
353 TWL4030_REG_APLL_CTL); 368 TWL4030_REG_APLL_CTL);