aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2014-01-03 08:27:55 -0500
committerMark Brown <broonie@linaro.org>2014-01-08 07:48:53 -0500
commita450aa6f507542d87ad237cb402b8b6e56329924 (patch)
tree49ffbfe7a43318ed3a774b8a49ede40c0a77a235 /sound
parent7ded5fe020e670befeab6777e7b8bc4bec272a3f (diff)
ASoC: twl4030: Move the ctl cache update local to twl4030_write() function
There's no other users of this functionality, the code can be moved inside of twl4030_write. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/twl4030.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 7a5b91e70f98..c3c15f891270 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -86,25 +86,6 @@ static void tw4030_init_ctl_cache(struct twl4030_priv *twl4030)
86 } 86 }
87} 87}
88 88
89static void twl4030_update_ctl_cache(struct snd_soc_codec *codec,
90 unsigned int reg, unsigned int value)
91{
92 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
93
94 switch (reg) {
95 case TWL4030_REG_EAR_CTL:
96 case TWL4030_REG_PREDL_CTL:
97 case TWL4030_REG_PREDR_CTL:
98 case TWL4030_REG_PRECKL_CTL:
99 case TWL4030_REG_PRECKR_CTL:
100 case TWL4030_REG_HS_GAIN_SET:
101 twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL] = value;
102 break;
103 default:
104 break;
105 }
106}
107
108static unsigned int twl4030_read(struct snd_soc_codec *codec, unsigned int reg) 89static unsigned int twl4030_read(struct snd_soc_codec *codec, unsigned int reg)
109{ 90{
110 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec); 91 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
@@ -174,7 +155,22 @@ static bool twl4030_can_write_to_chip(struct snd_soc_codec *codec,
174static int twl4030_write(struct snd_soc_codec *codec, unsigned int reg, 155static int twl4030_write(struct snd_soc_codec *codec, unsigned int reg,
175 unsigned int value) 156 unsigned int value)
176{ 157{
177 twl4030_update_ctl_cache(codec, reg, value); 158 struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
159
160 /* Update the ctl cache */
161 switch (reg) {
162 case TWL4030_REG_EAR_CTL:
163 case TWL4030_REG_PREDL_CTL:
164 case TWL4030_REG_PREDR_CTL:
165 case TWL4030_REG_PRECKL_CTL:
166 case TWL4030_REG_PRECKR_CTL:
167 case TWL4030_REG_HS_GAIN_SET:
168 twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL] = value;
169 break;
170 default:
171 break;
172 }
173
178 if (twl4030_can_write_to_chip(codec, reg)) 174 if (twl4030_can_write_to_chip(codec, reg))
179 return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value, reg); 175 return twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, value, reg);
180 176