Commit bc6ae96a authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: tlv320aic32x4: 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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 694b0001
...@@ -528,40 +528,33 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, ...@@ -528,40 +528,33 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
u8 value;
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
if (aic32x4->master) { if (aic32x4->master) {
/* Switch on PLL */ /* Switch on PLL */
value = snd_soc_read(codec, AIC32X4_PLLPR); snd_soc_update_bits(codec, AIC32X4_PLLPR,
snd_soc_write(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, AIC32X4_PLLEN);
(value | AIC32X4_PLLEN));
/* Switch on NDAC Divider */ /* Switch on NDAC Divider */
value = snd_soc_read(codec, AIC32X4_NDAC); snd_soc_update_bits(codec, AIC32X4_NDAC,
snd_soc_write(codec, AIC32X4_NDAC, AIC32X4_NDACEN, AIC32X4_NDACEN);
value | AIC32X4_NDACEN);
/* Switch on MDAC Divider */ /* Switch on MDAC Divider */
value = snd_soc_read(codec, AIC32X4_MDAC); snd_soc_update_bits(codec, AIC32X4_MDAC,
snd_soc_write(codec, AIC32X4_MDAC, AIC32X4_MDACEN, AIC32X4_MDACEN);
value | AIC32X4_MDACEN);
/* Switch on NADC Divider */ /* Switch on NADC Divider */
value = snd_soc_read(codec, AIC32X4_NADC); snd_soc_update_bits(codec, AIC32X4_NADC,
snd_soc_write(codec, AIC32X4_NADC, AIC32X4_NADCEN, AIC32X4_NADCEN);
value | AIC32X4_MDACEN);
/* Switch on MADC Divider */ /* Switch on MADC Divider */
value = snd_soc_read(codec, AIC32X4_MADC); snd_soc_update_bits(codec, AIC32X4_MADC,
snd_soc_write(codec, AIC32X4_MADC, AIC32X4_MADCEN, AIC32X4_MADCEN);
value | AIC32X4_MDACEN);
/* Switch on BCLK_N Divider */ /* Switch on BCLK_N Divider */
value = snd_soc_read(codec, AIC32X4_BCLKN); snd_soc_update_bits(codec, AIC32X4_BCLKN,
snd_soc_write(codec, AIC32X4_BCLKN, AIC32X4_BCLKEN, AIC32X4_BCLKEN);
value | AIC32X4_BCLKEN);
} }
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
...@@ -569,34 +562,28 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec, ...@@ -569,34 +562,28 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (aic32x4->master) { if (aic32x4->master) {
/* Switch off PLL */ /* Switch off PLL */
value = snd_soc_read(codec, AIC32X4_PLLPR); snd_soc_update_bits(codec, AIC32X4_PLLPR,
snd_soc_write(codec, AIC32X4_PLLPR, AIC32X4_PLLEN, 0);
(value & ~AIC32X4_PLLEN));
/* Switch off NDAC Divider */ /* Switch off NDAC Divider */
value = snd_soc_read(codec, AIC32X4_NDAC); snd_soc_update_bits(codec, AIC32X4_NDAC,
snd_soc_write(codec, AIC32X4_NDAC, AIC32X4_NDACEN, 0);
value & ~AIC32X4_NDACEN);
/* Switch off MDAC Divider */ /* Switch off MDAC Divider */
value = snd_soc_read(codec, AIC32X4_MDAC); snd_soc_update_bits(codec, AIC32X4_MDAC,
snd_soc_write(codec, AIC32X4_MDAC, AIC32X4_MDACEN, 0);
value & ~AIC32X4_MDACEN);
/* Switch off NADC Divider */ /* Switch off NADC Divider */
value = snd_soc_read(codec, AIC32X4_NADC); snd_soc_update_bits(codec, AIC32X4_NADC,
snd_soc_write(codec, AIC32X4_NADC, AIC32X4_NADCEN, 0);
value & ~AIC32X4_NDACEN);
/* Switch off MADC Divider */ /* Switch off MADC Divider */
value = snd_soc_read(codec, AIC32X4_MADC); snd_soc_update_bits(codec, AIC32X4_MADC,
snd_soc_write(codec, AIC32X4_MADC, AIC32X4_MADCEN, 0);
value & ~AIC32X4_MDACEN);
value = snd_soc_read(codec, AIC32X4_BCLKN);
/* Switch off BCLK_N Divider */ /* Switch off BCLK_N Divider */
snd_soc_write(codec, AIC32X4_BCLKN, snd_soc_update_bits(codec, AIC32X4_BCLKN,
value & ~AIC32X4_BCLKEN); AIC32X4_BCLKEN, 0);
} }
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment