Skip to contentSkip to conversation

ASoC: ad183x: add support for more multiple parts

PATCH In review Mike Frysinger 2 participants 2 messages Mar 26, 2011

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

PATCH 1/1 ASoC: ad183x: add support for more multiple parts

From: Barry Song <[email protected]>

This extends the AD1836 codec driver to also support the parts:
- AD1835A
- AD1837A
- AD1838A
- AD1839A

---
 sound/soc/codecs/Kconfig  |    4 +-
 sound/soc/codecs/Makefile |    4 +-
 sound/soc/codecs/ad1836.c |  338 --------------------------------
 sound/soc/codecs/ad1836.h |   63 ------
 sound/soc/codecs/ad183x.c |  474 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/ad183x.h |   57 ++++++
 6 files changed, 535 insertions(+), 405 deletions(-)
 delete mode 100644 sound/soc/codecs/ad1836.c
 delete mode 100644 sound/soc/codecs/ad1836.h
 create mode 100644 sound/soc/codecs/ad183x.c
 create mode 100644 sound/soc/codecs/ad183x.h
sound/soc/codecs/Kconfig +2 -2
index 6943e24..dc6d253 100644
@@ -13,7 +13,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_88PM860X if MFD_88PM860X
 	select SND_SOC_L3
 	select SND_SOC_AC97_CODEC if SND_SOC_AC97_BUS
-	select SND_SOC_AD1836 if SPI_MASTER
+	select SND_SOC_AD183X if SPI_MASTER
 	select SND_SOC_AD193X if SND_SOC_I2C_AND_SPI
 	select SND_SOC_AD1980 if SND_SOC_AC97_BUS
 	select SND_SOC_ADS117X
@@ -115,7 +115,7 @@ config SND_SOC_AC97_CODEC
 	tristate
 	select SND_AC97_CODEC
 
-config SND_SOC_AD1836
+config SND_SOC_AD183X
 	tristate
 
 config SND_SOC_AD193X
sound/soc/codecs/Makefile +2 -2
index 379bc55..44d3278 100644
@@ -1,6 +1,6 @@
 snd-soc-88pm860x-objs := 88pm860x-codec.o
 snd-soc-ac97-objs := ac97.o
-snd-soc-ad1836-objs := ad1836.o
+snd-soc-ad183x-objs := ad183x.o
 snd-soc-ad193x-objs := ad193x.o
 snd-soc-ad1980-objs := ad1980.o
 snd-soc-ad73311-objs := ad73311.o
@@ -87,7 +87,7 @@ snd-soc-wm9090-objs := wm9090.o
 
 obj-$(CONFIG_SND_SOC_88PM860X)	+= snd-soc-88pm860x.o
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
-obj-$(CONFIG_SND_SOC_AD1836)	+= snd-soc-ad1836.o
+obj-$(CONFIG_SND_SOC_AD183X)	+= snd-soc-ad183x.o
 obj-$(CONFIG_SND_SOC_AD193X)	+= snd-soc-ad193x.o
 obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
 obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
sound/soc/codecs/ad1836.c deleted +0 -338

338 lines not on this page · raw message

sound/soc/codecs/ad1836.h deleted +0 -63

63 lines not on this page · raw message

sound/soc/codecs/ad183x.c new file +474 -0

474 lines not on this page · raw message

sound/soc/codecs/ad183x.h new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#1 lore raw

sound/soc/codecs/ad1836.c line 50

Quoted 6 lines · Mike Frysinger

From: Barry Song <[email protected]>

sound/soc/codecs/ad1836.c deleted +0 -4
-static const struct snd_kcontrol_new ad1836_snd_controls[] = {
-	/* DAC volume control */
-	SOC_DOUBLE_R("DAC1 Volume", AD1836_DAC_L1_VOL,
-			AD1836_DAC_R1_VOL, 0, 0x3FF, 0),

One thing I've noticed about a lot of your drivers is that there's no TLV information - it'd be good to provide this so applications can make use of it.

Quoted 8 lines
sound/soc/codecs/ad1836.c deleted +0 -8
-	/* default setting for ad1836 */
-	/* de-emphasis: 48kHz, power-on dac */
-	snd_soc_write(codec, AD1836_DAC_CTRL1, 0x300);
-	/* unmute dac channels */
-	snd_soc_write(codec, AD1836_DAC_CTRL2, 0x0);
-	/* high-pass filter enable, power-on adc */
-	snd_soc_write(codec, AD1836_ADC_CTRL1, 0x100);
-	/* unmute adc channles, adc aux mode */

sound/soc/codecs/ad1836.c line 250

Quoted 10 lines
sound/soc/codecs/ad1836.c deleted +0 -10
-	snd_soc_write(codec, AD1836_ADC_CTRL2, 0x180);
-	/* left/right diff:PGA/MUX */
-	snd_soc_write(codec, AD1836_ADC_CTRL3, 0x3A);
-	/* volume */
-	snd_soc_write(codec, AD1836_DAC_L1_VOL, 0x3FF);
-	snd_soc_write(codec, AD1836_DAC_R1_VOL, 0x3FF);
-	snd_soc_write(codec, AD1836_DAC_L2_VOL, 0x3FF);
-	snd_soc_write(codec, AD1836_DAC_R2_VOL, 0x3FF);
-	snd_soc_write(codec, AD1836_DAC_L3_VOL, 0x3FF);
-	snd_soc_write(codec, AD1836_DAC_R3_VOL, 0x3FF);

I appreciate that this is all in the old driver but this should all be removed, the driver should be using the register configuration provided by the chip and allowing the user to configure things as needed for their system at runtime. The appropriate configuration will typically be application specific and providing them in the driver suggests to people that they should be configuring in the kernel which creates problems when multiple users try to merge into mainline. Generally the chip defaults will at least be safe and they avoid arguments about who's defaults to choose.

There are some things which the driver can reasonably configure as there's very little reason to ever choose a different configuration - zero cross is the classic example - but routing and volume control aren't them.

Please supply a patch removing this configuration before the patch doing the rename so we can fix this for 2.6.40.