mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 23:11:27 +00:00
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>
This commit is contained in:
parent
29c6a01df8
commit
a6785d7df8
1 changed files with 9 additions and 13 deletions
|
@ -430,8 +430,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
|
||||||
/* Always disable the PLL - it is not safe to leave it running
|
/* Always disable the PLL - it is not safe to leave it running
|
||||||
* while reprogramming it.
|
* while reprogramming it.
|
||||||
*/
|
*/
|
||||||
reg = snd_soc_read(codec, WM8580_PWRDN2);
|
snd_soc_update_bits(codec, WM8580_PWRDN2, pwr_mask, pwr_mask);
|
||||||
snd_soc_write(codec, WM8580_PWRDN2, reg | pwr_mask);
|
|
||||||
|
|
||||||
if (!freq_in || !freq_out)
|
if (!freq_in || !freq_out)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -449,8 +448,7 @@ static int wm8580_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
|
||||||
snd_soc_write(codec, WM8580_PLLA4 + offset, reg);
|
snd_soc_write(codec, WM8580_PLLA4 + offset, reg);
|
||||||
|
|
||||||
/* All done, turn it on */
|
/* All done, turn it on */
|
||||||
reg = snd_soc_read(codec, WM8580_PWRDN2);
|
snd_soc_update_bits(codec, WM8580_PWRDN2, pwr_mask, 0);
|
||||||
snd_soc_write(codec, WM8580_PWRDN2, reg & ~pwr_mask);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -748,7 +746,6 @@ static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute)
|
||||||
static int wm8580_set_bias_level(struct snd_soc_codec *codec,
|
static int wm8580_set_bias_level(struct snd_soc_codec *codec,
|
||||||
enum snd_soc_bias_level level)
|
enum snd_soc_bias_level level)
|
||||||
{
|
{
|
||||||
u16 reg;
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case SND_SOC_BIAS_ON:
|
case SND_SOC_BIAS_ON:
|
||||||
case SND_SOC_BIAS_PREPARE:
|
case SND_SOC_BIAS_PREPARE:
|
||||||
|
@ -757,20 +754,19 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
|
||||||
case SND_SOC_BIAS_STANDBY:
|
case SND_SOC_BIAS_STANDBY:
|
||||||
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
|
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
|
||||||
/* Power up and get individual control of the DACs */
|
/* Power up and get individual control of the DACs */
|
||||||
reg = snd_soc_read(codec, WM8580_PWRDN1);
|
snd_soc_update_bits(codec, WM8580_PWRDN1,
|
||||||
reg &= ~(WM8580_PWRDN1_PWDN | WM8580_PWRDN1_ALLDACPD);
|
WM8580_PWRDN1_PWDN |
|
||||||
snd_soc_write(codec, WM8580_PWRDN1, reg);
|
WM8580_PWRDN1_ALLDACPD, 0);
|
||||||
|
|
||||||
/* Make VMID high impedance */
|
/* Make VMID high impedance */
|
||||||
reg = snd_soc_read(codec, WM8580_ADC_CONTROL1);
|
snd_soc_update_bits(codec, WM8580_ADC_CONTROL1,
|
||||||
reg &= ~0x100;
|
0x100, 0);
|
||||||
snd_soc_write(codec, WM8580_ADC_CONTROL1, reg);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SND_SOC_BIAS_OFF:
|
case SND_SOC_BIAS_OFF:
|
||||||
reg = snd_soc_read(codec, WM8580_PWRDN1);
|
snd_soc_update_bits(codec, WM8580_PWRDN1,
|
||||||
snd_soc_write(codec, WM8580_PWRDN1, reg | WM8580_PWRDN1_PWDN);
|
WM8580_PWRDN1_PWDN, WM8580_PWRDN1_PWDN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
codec->dapm.bias_level = level;
|
codec->dapm.bias_level = level;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue