diff options
| -rw-r--r-- | sound/soc/codecs/twl4030.c | 36 |
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 | ||
| 89 | static 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 | |||
| 108 | static unsigned int twl4030_read(struct snd_soc_codec *codec, unsigned int reg) | 89 | static 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, | |||
| 174 | static int twl4030_write(struct snd_soc_codec *codec, unsigned int reg, | 155 | static 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 | ||
