Skip to content

Commit

Permalink
ASoC: wm8991: Use snd_soc_update_bits for read-modify-write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Mark Brown committed Oct 14, 2011
1 parent 3f387a2 commit c639adc
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions sound/soc/codecs/wm8991.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,6 @@ static int wm8991_probe(struct snd_soc_codec *codec)
{
struct wm8991_priv *wm8991;
int ret;
unsigned int reg;

wm8991 = snd_soc_codec_get_drvdata(codec);

Expand All @@ -1282,19 +1281,18 @@ static int wm8991_probe(struct snd_soc_codec *codec)

wm8991_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

reg = snd_soc_read(codec, WM8991_AUDIO_INTERFACE_4);
snd_soc_write(codec, WM8991_AUDIO_INTERFACE_4, reg | WM8991_ALRCGPIO1);
snd_soc_update_bits(codec, WM8991_AUDIO_INTERFACE_4,
WM8991_ALRCGPIO1, WM8991_ALRCGPIO1);

reg = snd_soc_read(codec, WM8991_GPIO1_GPIO2) &
~WM8991_GPIO1_SEL_MASK;
snd_soc_write(codec, WM8991_GPIO1_GPIO2, reg | 1);
snd_soc_update_bits(codec, WM8991_GPIO1_GPIO2,
WM8991_GPIO1_SEL_MASK, 1);

reg = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_1);
snd_soc_write(codec, WM8991_POWER_MANAGEMENT_1, reg | WM8991_VREF_ENA|
WM8991_VMID_MODE_MASK);
snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_1,
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK,
WM8991_VREF_ENA | WM8991_VMID_MODE_MASK);

reg = snd_soc_read(codec, WM8991_POWER_MANAGEMENT_2);
snd_soc_write(codec, WM8991_POWER_MANAGEMENT_2, reg | WM8991_OPCLK_ENA);
snd_soc_update_bits(codec, WM8991_POWER_MANAGEMENT_2,
WM8991_OPCLK_ENA, WM8991_OPCLK_ENA);

snd_soc_write(codec, WM8991_DAC_CTRL, 0);
snd_soc_write(codec, WM8991_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
Expand Down

0 comments on commit c639adc

Please sign in to comment.