Skip to content

Commit 7e845e7

Browse files
larsclausenbroonie
authored andcommitted
ASoC: wm9712: Remove ac97_read/ac97_write wrappers
Since the regmap conversion ac97_read/ac97_write are just simple wrappers around snd_soc_read/snd_soc_write. Use those instead directly and remove the wrappers. Also use snd_soc_update_bits() were appropriate. Signed-off-by: Lars-Peter Clausen <[email protected]> Tested-by: Marek Vasut <[email protected]> Acked-by: Marek Vasut <[email protected]> Acked-by: Charles Keepax <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent b4f4f2e commit 7e845e7

File tree

1 file changed

+9
-26
lines changed

1 file changed

+9
-26
lines changed

sound/soc/codecs/wm9712.c

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -521,53 +521,36 @@ static const struct snd_soc_dapm_route wm9712_audio_map[] = {
521521
{"ROUT2", NULL, "Speaker PGA"},
522522
};
523523

524-
static unsigned int ac97_read(struct snd_soc_codec *codec,
525-
unsigned int reg)
526-
{
527-
return snd_soc_read(codec, reg);
528-
}
529-
530-
static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
531-
unsigned int val)
532-
{
533-
return snd_soc_write(codec, reg, val);
534-
}
535-
536524
static int ac97_prepare(struct snd_pcm_substream *substream,
537525
struct snd_soc_dai *dai)
538526
{
539527
struct snd_soc_codec *codec = dai->codec;
540528
int reg;
541-
u16 vra;
542529
struct snd_pcm_runtime *runtime = substream->runtime;
543530

544-
vra = ac97_read(codec, AC97_EXTENDED_STATUS);
545-
ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
531+
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
546532

547533
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
548534
reg = AC97_PCM_FRONT_DAC_RATE;
549535
else
550536
reg = AC97_PCM_LR_ADC_RATE;
551537

552-
return ac97_write(codec, reg, runtime->rate);
538+
return snd_soc_write(codec, reg, runtime->rate);
553539
}
554540

555541
static int ac97_aux_prepare(struct snd_pcm_substream *substream,
556542
struct snd_soc_dai *dai)
557543
{
558544
struct snd_soc_codec *codec = dai->codec;
559-
u16 vra, xsle;
560545
struct snd_pcm_runtime *runtime = substream->runtime;
561546

562-
vra = ac97_read(codec, AC97_EXTENDED_STATUS);
563-
ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
564-
xsle = ac97_read(codec, AC97_PCI_SID);
565-
ac97_write(codec, AC97_PCI_SID, xsle | 0x8000);
547+
snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
548+
snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000);
566549

567550
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
568551
return -ENODEV;
569552

570-
return ac97_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
553+
return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
571554
}
572555

573556
#define WM9712_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
@@ -619,12 +602,12 @@ static int wm9712_set_bias_level(struct snd_soc_codec *codec,
619602
case SND_SOC_BIAS_PREPARE:
620603
break;
621604
case SND_SOC_BIAS_STANDBY:
622-
ac97_write(codec, AC97_POWERDOWN, 0x0000);
605+
snd_soc_write(codec, AC97_POWERDOWN, 0x0000);
623606
break;
624607
case SND_SOC_BIAS_OFF:
625608
/* disable everything including AC link */
626-
ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
627-
ac97_write(codec, AC97_POWERDOWN, 0xffff);
609+
snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
610+
snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
628611
break;
629612
}
630613
return 0;
@@ -671,7 +654,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec)
671654
snd_soc_codec_init_regmap(codec, regmap);
672655

673656
/* set alc mux to none */
674-
ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
657+
snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000);
675658

676659
return 0;
677660
err_free_ac97_codec:

0 commit comments

Comments
 (0)