提交 f96c255d 编写于 作者: A Axel Lin 提交者: Mark Brown

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: NAxel Lin <axel.lin@gmail.com>
Acked-by: NLiam Girdwood <lrg@ti.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 cf0feafb
...@@ -168,18 +168,15 @@ static int ak4671_out2_event(struct snd_soc_dapm_widget *w, ...@@ -168,18 +168,15 @@ static int ak4671_out2_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = w->codec; struct snd_soc_codec *codec = w->codec;
u8 reg;
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
reg = snd_soc_read(codec, AK4671_LOUT2_POWER_MANAGERMENT); snd_soc_update_bits(codec, AK4671_LOUT2_POWER_MANAGERMENT,
reg |= AK4671_MUTEN; AK4671_MUTEN, AK4671_MUTEN);
snd_soc_write(codec, AK4671_LOUT2_POWER_MANAGERMENT, reg);
break; break;
case SND_SOC_DAPM_PRE_PMD: case SND_SOC_DAPM_PRE_PMD:
reg = snd_soc_read(codec, AK4671_LOUT2_POWER_MANAGERMENT); snd_soc_update_bits(codec, AK4671_LOUT2_POWER_MANAGERMENT,
reg &= ~AK4671_MUTEN; AK4671_MUTEN, 0);
snd_soc_write(codec, AK4671_LOUT2_POWER_MANAGERMENT, reg);
break; break;
} }
...@@ -575,15 +572,12 @@ static int ak4671_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -575,15 +572,12 @@ static int ak4671_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int ak4671_set_bias_level(struct snd_soc_codec *codec, static int ak4671_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
u8 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:
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
reg = snd_soc_read(codec, AK4671_AD_DA_POWER_MANAGEMENT); snd_soc_update_bits(codec, AK4671_AD_DA_POWER_MANAGEMENT,
snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, AK4671_PMVCM, AK4671_PMVCM);
reg | AK4671_PMVCM);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00); snd_soc_write(codec, AK4671_AD_DA_POWER_MANAGEMENT, 0x00);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册