aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2011-10-16 23:50:46 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-17 17:49:28 -0400
commita6785d7df8d2790d99a4788a612764a92fb9f498 (patch)
tree897d3ba85a299a6a24e087220e2810a086cc1595 /sound/soc/codecs
parent29c6a01df8de1329303da09ca9793e9f65608216 (diff)
ASoC: wm8580: 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> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r--sound/soc/codecs/wm8580.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index b25672709474..8212b3c8bfdd 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -430,8 +430,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
430 /* Always disable the PLL - it is not safe to leave it running 430 /* Always disable the PLL - it is not safe to leave it running
431 * while reprogramming it. 431 * while reprogramming it.
432 */ 432 */
433 reg = snd_soc_read(codec, WM8580_PWRDN2); 433 snd_soc_update_bits(codec, WM8580_PWRDN2, pwr_mask, pwr_mask);
434 snd_soc_write(codec, WM8580_PWRDN2, reg | pwr_mask);
435 434
436 if (!freq_in || !freq_out) 435 if (!freq_in || !freq_out)
437 return 0; 436 return 0;
@@ -449,8 +448,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
449 snd_soc_write(codec, WM8580_PLLA4 + offset, reg); 448 snd_soc_write(codec, WM8580_PLLA4 + offset, reg);
450 449
451 /* All done, turn it on */ 450 /* All done, turn it on */
452 reg = snd_soc_read(codec, WM8580_PWRDN2); 451 snd_soc_update_bits(codec, WM8580_PWRDN2, pwr_mask, 0);
453 snd_soc_write(codec, WM8580_PWRDN2, reg & ~pwr_mask);
454 452
455 return 0; 453 return 0;
456} 454}
@@ -748,7 +746,6 @@ static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute)
748static int wm8580_set_bias_level(struct snd_soc_codec *codec, 746static int wm8580_set_bias_level(struct snd_soc_codec *codec,
749 enum snd_soc_bias_level level) 747 enum snd_soc_bias_level level)
750{ 748{
751 u16 reg;
752 switch (level) { 749 switch (level) {
753 case SND_SOC_BIAS_ON: 750 case SND_SOC_BIAS_ON:
754 case SND_SOC_BIAS_PREPARE: 751 case SND_SOC_BIAS_PREPARE:
@@ -757,20 +754,19 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
757 case SND_SOC_BIAS_STANDBY: 754 case SND_SOC_BIAS_STANDBY:
758 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 755 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
759 /* Power up and get individual control of the DACs */ 756 /* Power up and get individual control of the DACs */
760 reg = snd_soc_read(codec, WM8580_PWRDN1); 757 snd_soc_update_bits(codec, WM8580_PWRDN1,
761 reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD); 758 WM8580_PWRDN1_PWDN |
762 snd_soc_write(codec, WM8580_PWRDN1, reg); 759 WM8580_PWRDN1_ALLDACPD, 0);
763 760
764 /* Make VMID high impedance */ 761 /* Make VMID high impedance */
765 reg = snd_soc_read(codec, WM8580_ADC_CONTROL1); 762 snd_soc_update_bits(codec, WM8580_ADC_CONTROL1,
766 reg &= ~0x100; 763 0x100, 0);
767 snd_soc_write(codec, WM8580_ADC_CONTROL1, reg);
768 } 764 }
769 break; 765 break;
770 766
771 case SND_SOC_BIAS_OFF: 767 case SND_SOC_BIAS_OFF:
772 reg = snd_soc_read(codec, WM8580_PWRDN1); 768 snd_soc_update_bits(codec, WM8580_PWRDN1,
773 snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN); 769 WM8580_PWRDN1_PWDN, WM8580_PWRDN1_PWDN);
774 break; 770 break;
775 } 771 }
776 codec->dapm.bias_level = level; 772 codec->dapm.bias_level = level;