Skip to contentSkip to conversation

ASoC: wm9705: Convert to regmap

PATCH In review Lars-Peter Clausen 2 participants 4 messages Oct 21, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: wm9705: Convert to regmap

Currently the wm9712 driver still uses custom snd_soc_codec_driver IO callbacks. This has been deprecated for a while, so convert the wm9705 driver to use regmap for its IO.

---
Untested, but same changes as for all the other AC97 drivers, so hopefully it will just work.

---
 sound/soc/codecs/Kconfig  |   1 +
 sound/soc/codecs/wm9705.c | 123 ++++++++++++++++++++++++----------------------
 2 files changed, 64 insertions(+), 60 deletions(-)
sound/soc/codecs/Kconfig +1 -0
index 091c0f0..a92ea7c 100644
@@ -1059,6 +1059,7 @@ config SND_SOC_WM9090
 
 config SND_SOC_WM9705
 	tristate
+	select REGMAP_AC97
 
 config SND_SOC_WM9712
 	tristate
sound/soc/codecs/wm9705.c +63 -60

193 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 ASoC: wm9705: 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() where appropriate.

---
 sound/soc/codecs/wm9705.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
sound/soc/codecs/wm9705.c +3 -16
index 70ab607..e73ff61 100644
@@ -226,33 +226,20 @@ static const struct snd_soc_dapm_route wm9705_audio_map[] = {
 	{"Right ADC", NULL, "ADC PGA"},
 };
 
-static unsigned int ac97_read(struct snd_soc_codec *codec, unsigned int reg)
-{
-	return snd_soc_read(codec, reg);
-}
-
-static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
-	unsigned int val)
-{
-	return snd_soc_write(codec, reg, val);
-}
-
 static int ac97_prepare(struct snd_pcm_substream *substream,
 			struct snd_soc_dai *dai)
 {
 	struct snd_soc_codec *codec = dai->codec;
 	int reg;
-	u16 vra;
 
-	vra = ac97_read(codec, AC97_EXTENDED_STATUS);
-	ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
+	snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1);
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		reg = AC97_PCM_FRONT_DAC_RATE;
 	else
 		reg = AC97_PCM_LR_ADC_RATE;
 
-	return ac97_write(codec, reg, substream->runtime->rate);
+	return snd_soc_write(codec, reg, substream->runtime->rate);
 }
 
 #define WM9705_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | \
@@ -299,7 +286,7 @@ static struct snd_soc_dai_driver wm9705_dai[] = {
 static int wm9705_soc_suspend(struct snd_soc_codec *codec)
 {
 	regcache_cache_bypass(codec->component.regmap, true);
-	ac97_write(codec, AC97_POWERDOWN, 0xffff);
+	snd_soc_write(codec, AC97_POWERDOWN, 0xffff);
 	regcache_cache_bypass(codec->component.regmap, false);
 
 	return 0;
Signature · 1 line
2.1.4
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ASoC: wm9705: Remove ac97_read/ac97_write wrappers

Quoted 8 lines · Lars-Peter Clausen

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() where appropriate.

---

Thanks,
Charles

Acked-by on v1 1/2
#3 lore raw
In reply to Lars-Peter Clausen
Quoted 9 lines · Lars-Peter Clausen

Currently the wm9712 driver still uses custom snd_soc_codec_driver IO callbacks. This has been deprecated for a while, so convert the wm9705 driver to use regmap for its IO.

---
Untested, but same changes as for all the other AC97 drivers, so hopefully it will just work.
---

Thanks,
Charles