aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-10-19 22:54:13 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-20 10:02:26 -0400
commitf96c255df75782c97dca8e2529bc09cb80425fe7 (patch)
treede4bcb1e8e12906af315454afacee593eff96c53 /sound
parentcf0feafbc306718292dcda499bf299fc60cc8cc6 (diff)
ASoC: ak4671: Use snd_soc_update_bits for read-modify-write
Use snd_soc_update_bits for read-modify-write register access instead of open-coding it using snd_soc_read and snd_soc_write Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ak4671.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index 41e3d5541bd4..de9ff66d3721 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -168,18 +168,15 @@ static int ak4671_out2_event(struct snd_soc_dapm_widget *w,
168 struct snd_kcontrol *kcontrol, int event) 168 struct snd_kcontrol *kcontrol, int event)
169{ 169{
170 struct snd_soc_codec *codec = w->codec; 170 struct snd_soc_codec *codec = w->codec;
171 u8 reg;
172 171
173 switch (event) { 172 switch (event) {
174 case SND_SOC_DAPM_POST_PMU: 173 case SND_SOC_DAPM_POST_PMU:
175 reg = snd_soc_read(codec, AK4671_LOUT2_POWER_MANAGERMENT); 174 snd_soc_update_bits(codec, AK4671_LOUT2_POWER_MANAGERMENT,
176 reg |= AK4671_MUTEN; 175 AK4671_MUTEN, AK4671_MUTEN);
177 snd_soc_write(codec, AK4671_LOUT2_POWER_MANAGERMENT, reg);
178 break; 176 break;
179 case SND_SOC_DAPM_PRE_PMD: 177 case SND_SOC_DAPM_PRE_PMD:
180 reg = snd_soc_read(codec, AK4671_LOUT2_POWER_MANAGERMENT); 178 snd_soc_update_bits(codec, AK4671_LOUT2_POWER_MANAGERMENT,
181 reg &= ~AK4671_MUTEN; 179 AK4671_MUTEN, 0);
182 snd_soc_write(codec, AK4671_LOUT2_POWER_MANAGERMENT, reg);
183 break; 180 break;
184 } 181 }
185 182
@@ -575,15 +572,12 @@ static int ak4671_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
575static int ak4671_set_bias_level(struct snd_soc_codec *codec, 572static int ak4671_set_bias_level(struct snd_soc_codec *codec,
576 enum snd_soc_bias_level level) 573 enum snd_soc_bias_level level)
577{ 574{
578 u8 reg;
579
580 switch (level) { 575 switch (level) {
581 case SND_SOC_BIAS_ON: 576 case SND_SOC_BIAS_ON:
582 case SND_SOC_BIAS_PREPARE: 577 case SND_SOC_BIAS_PREPARE:
583 case SND_SOC_BIAS_STANDBY: 578 case SND_SOC_BIAS_STANDBY:
584 reg = snd_soc_read(codec, AK4671_AD_DA_POWER_MANAGEMENT); 579 snd_soc_update_bits(codec, AK4671_AD_DA_POWER_MANAGEMENT,
585 snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 580 AK4671_PMVCM, AK4671_PMVCM);
586 reg | AK4671_PMVCM);
587 break; 581 break;
588 case SND_SOC_BIAS_OFF: 582 case SND_SOC_BIAS_OFF:
589 snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); 583 snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00);