Skip to content

Commit

Permalink
ASoC: Avoid a redundant read in cs42l51_pdn_event
Browse files Browse the repository at this point in the history
snd_soc_update_bits already does read-modify-write,
no need to read the register before calling snd_soc_update_bits.

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 Nov 8, 2011
1 parent 65ff03f commit e94de1e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions sound/soc/codecs/cs42l51.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,21 +175,18 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
unsigned long value;

value = snd_soc_read(w->codec, CS42L51_POWER_CTL1);
value &= ~CS42L51_POWER_CTL1_PDN;

switch (event) {
case SND_SOC_DAPM_PRE_PMD:
value |= CS42L51_POWER_CTL1_PDN;
snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
CS42L51_POWER_CTL1_PDN,
CS42L51_POWER_CTL1_PDN);
break;
default:
case SND_SOC_DAPM_POST_PMD:
snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
CS42L51_POWER_CTL1_PDN, 0);
break;
}
snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
CS42L51_POWER_CTL1_PDN, value);

return 0;
}
Expand Down

0 comments on commit e94de1e

Please sign in to comment.