Skip to contentSkip to conversation

AM43xx-ePOS-EVM audio support with TLV320AIC31XX driver

PATCH In review Jyri Sarha 6 participants 21 messages Mar 4, 2014 – Mar 10, 2014 8 messages not in the archive

Subsystems (4)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

v2 cover AM43xx-ePOS-EVM audio support with TLV320AIC31XX driver

Since the RFC version of the patches [1] I have addressed Mark Browns comments [2] as described in my mail here [3].

Besr regards,
Jyri

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-February/073289.html

[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/073703.html

    http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/073704.html
    http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/073705.html

[3] http://mailman.alsa-project.org/pipermail/alsa-devel/2014-March/073807.html

Jyri Sarha (4):
ASoC: tlv320aic31xx: Add basic codec driver implementation
ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support
ASoC: davinci: Add SND_AM43XX_SOC_EPOS_EVM build option
ASoC: tlv320aic32x4: Sort Makefile in alphabetic order

 .../bindings/sound/davinci-evm-audio.txt           |    9 +-
 .../devicetree/bindings/sound/tlv320aic31xx.txt    |   58 +
 include/dt-bindings/sound/tlv320aic31xx-micbias.h  |    9 +
 sound/soc/codecs/Kconfig                           |    4 +
 sound/soc/codecs/Makefile                          |    6 +-
 sound/soc/codecs/tlv320aic31xx.c                   | 1345 ++++++++++++++++++++
 sound/soc/codecs/tlv320aic31xx.h                   |  258 ++++
 sound/soc/davinci/Kconfig                          |   12 +
 sound/soc/davinci/Makefile                         |    1 +
 sound/soc/davinci/davinci-evm.c                    |   41 +
 10 files changed, 1738 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
 create mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h
 create mode 100644 sound/soc/codecs/tlv320aic31xx.c
 create mode 100644 sound/soc/codecs/tlv320aic31xx.h
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

PATCH v2 1/4 ASoC: tlv320aic31xx: Add basic codec driver implementation

This commit adds a bare bones driver support for TLV320AIC31XX family audio codecs. The driver adds basic stereo playback trough headphone and speaker outputs and mono capture trough microphone inputs.

The driver is currently missing support at least for mini DSP features and jack detection. I have tested the driver only on TLV320AIC3111, but based on the data sheets TLV320AIC3100, TLV320AIC3110, and TLV320AIC3120 should work Ok too.

The base for the implementation was taken from:
[email protected]:ti-codecs/ti-codecs.git ajitk/topics/k3.10.1-aic31xx -branch at commit 77504eba0294764e9e63b4a0c696b44db187cd13.

---
 .../devicetree/bindings/sound/tlv320aic31xx.txt    |   58 +
 include/dt-bindings/sound/tlv320aic31xx-micbias.h  |    9 +
 sound/soc/codecs/Kconfig                           |    4 +
 sound/soc/codecs/Makefile                          |    2 +
 sound/soc/codecs/tlv320aic31xx.c                   | 1345 ++++++++++++++++++++
 sound/soc/codecs/tlv320aic31xx.h                   |  258 ++++
 6 files changed, 1676 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/tlv320aic31xx.txt
 create mode 100644 include/dt-bindings/sound/tlv320aic31xx-micbias.h
 create mode 100644 sound/soc/codecs/tlv320aic31xx.c
 create mode 100644 sound/soc/codecs/tlv320aic31xx.h
Documentation/devicetree/bindings/sound/tlv320aic31xx.txt new file +58 -0
new file mode 100644
index 0000000..885668b
@@ -0,0 +1,58 @@
+Texas Instruments - tlv320aic31xx Codec module
+
+The tlv320aic31xx serial control bus communicates through I2C protocols
+
+Required properties:
+
+- compatible - "string" - One of:
+    "ti,tlv320aic310x" - Generic TLV320AIC31xx with mono speaker amp
+    "ti,tlv320aic311x" - Generic TLV320AIC31xx with stereo speaker amp
+    "ti,tlv320aic3100" - TLV320AIC3100 (mono speaker amp, no MiniDSP)
+    "ti,tlv320aic3110" - TLV320AIC3110 (stereo speaker amp, no MiniDSP)
+    "ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP)
+    "ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP)
+
+- reg - <int> -  I2C slave address
+
+
+Optional properties:
+
+- gpio-reset - gpio pin number used for codec reset
+- ai31xx-micbias-vg - MicBias Voltage required.
+        MICBIAS_OFF - MICBIAS output it not powered
+        MICBIAS_2_0V - MICBIAS output is powered to 2.0V
+        MICBIAS_2_5V - MICBIAS output is powered to 2.5V
+        MICBIAS_AVDD - MICBIAS output is connected to AVDD
+	If this node is not mentioned or if the value is unknown, then
+	micbias	is set to 2.0V.
+- HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply,
+  DVDD-supply : power supplies for the device as covered in
+  Documentation/devicetree/bindings/regulator/regulator.txt
+
+CODEC output pins:
+  * HPL
+  * HPR
+  * SPL, devices with stereo speaker amp
+  * SPR, devices with stereo speaker amp
+  * SPK, devices with mono speaker amp
+
+CODEC input pins:
+  * MIC1LP
+  * MIC1RP
+  * MIC1LM
+
+The pins can be used in referring sound node's audio-routing property.
+
+Example:
+
+tlv320aic31xx: tlv320aic31xx@18 {
+	compatible = "ti,tlv320aic311x";
+	reg = <0x18>;
+
+	HPVDD-supply = <&regulator>;
+	SPRVDD-supply = <&regulator>;
+	SPLVDD-supply = <&regulator>;
+	AVDD-supply = <&regulator>;
+	IOVDD-supply = <&regulator>;
+	DVDD-supply = <&regulator>;
+};
include/dt-bindings/sound/tlv320aic31xx-micbias.h new file +9 -0
new file mode 100644
index 0000000..da9360f
@@ -0,0 +1,9 @@
+#ifndef __DT_TLV320AIC31XX_MICBIAS_H
+#define __DT_TLV320AIC31XX_MICBIAS_H
+
+#define MICBIAS_OFF		0
+#define MICBIAS_2_0V		1
+#define MICBIAS_2_5V		2
+#define MICBIAS_AVDDV		3
+
+#endif /* __DT_TLV320AIC31XX_MICBIAS_H */
sound/soc/codecs/Kconfig +4 -0
index 983d087a..66f6c53 100644
@@ -73,6 +73,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_TAS5086 if I2C
 	select SND_SOC_TLV320AIC23 if I2C
 	select SND_SOC_TLV320AIC26 if SPI_MASTER
+	select SND_SOC_TLV320AIC31XX if I2C
 	select SND_SOC_TLV320AIC32X4 if I2C
 	select SND_SOC_TLV320AIC3X if I2C
 	select SND_SOC_TPA6130A2 if I2C
@@ -361,6 +362,9 @@ config SND_SOC_TLV320AIC26
 	tristate
 	depends on SPI
 
+config SND_SOC_TLV320AIC31XX
+        tristate
+
 config SND_SOC_TLV320AIC32X4
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index bc12676..23f8042 100644
@@ -64,6 +64,7 @@ snd-soc-stac9766-objs := stac9766.o
 snd-soc-tas5086-objs := tas5086.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic26-objs := tlv320aic26.o
+snd-soc-tlv320aic31xx-objs := tlv320aic31xx.o
 snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o
 snd-soc-tlv320dac33-objs := tlv320dac33.o
@@ -194,6 +195,7 @@ obj-$(CONFIG_SND_SOC_STAC9766)	+= snd-soc-stac9766.o
 obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
+obj-$(CONFIG_SND_SOC_TLV320AIC31XX)     += snd-soc-tlv320aic31xx.o
 obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
 obj-$(CONFIG_SND_SOC_TLV320AIC32X4)     += snd-soc-tlv320aic32x4.o
 obj-$(CONFIG_SND_SOC_TLV320DAC33)	+= snd-soc-tlv320dac33.o
sound/soc/codecs/tlv320aic31xx.c new file +1345 -0

1,345 lines not on this page · raw message

sound/soc/codecs/tlv320aic31xx.h new file +258 -0

258 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): ba9718f573ca9195c80075a15fe114e0d4557da0.1393941102.git.jsarha-l0cyMroinI0@public.gmane.org

#4 lore raw

Re: [PATCH v2 1/4] ASoC: tlv320aic31xx: Add basic codec driver implementation

Quoted 2 lines · Jyri Sarha
+- ai31xx-micbias-vg - MicBias Voltage required.
+        MICBIAS_OFF - MICBIAS output it not powered

Same comment as last time - why is this something which can be selected in the binding?

Documentation/devicetree/bindings/sound/tlv320aic31xx.txt line 25

Quoted 3 lines
Documentation/devicetree/bindings/sound/tlv320aic31xx.txt new file +3 -0
+        MICBIAS_2_0V - MICBIAS output is powered to 2.0V
+        MICBIAS_2_5V - MICBIAS output is powered to 2.5V
+        MICBIAS_AVDD - MICBIAS output is connected to AVDD

The numbers still need to be defined in the binding, the point with the defines is to make both code and DTs more readable but we need to know what is actually going to go into the binary.

sound/soc/codecs/tlv320aic31xx.c line 566

Quoted 3 lines
sound/soc/codecs/tlv320aic31xx.c new file +3 -0
+	/* Mic Bias */
+	SND_SOC_DAPM_SUPPLY("Mic Bias", SND_SOC_NOPM, 0, 0, mic_bias_event,
+			    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),

The idiomatic thing would be to use the pin name.

sound/soc/codecs/tlv320aic31xx.c line 615

Quoted 2 lines
sound/soc/codecs/tlv320aic31xx.c new file +2 -0
+	/* Make ADC turn on when recording even if not mixed from any inputs */
+	{"ADC", NULL, "Internal ADC Source"},

Don't do this (or the equivalent from the DACs) - we don't do this for any other drivers, we shouldn't do it for this one. If we're going to do something like this it should be generic not per driver hacks.

sound/soc/codecs/tlv320aic31xx.c line 1076

Quoted 7 lines
sound/soc/codecs/tlv320aic31xx.c new file +7 -0
+	case SND_SOC_BIAS_STANDBY:
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+			aic31xx_set_power(codec, 1);
+		break;
+	case SND_SOC_BIAS_OFF:
+		aic31xx_set_power(codec, 0);
+		break;

Just inline the set power function, or at the very least split it into separate on and off functions - there is zero shared code between the power on and off paths.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#6 lore raw

Re: [PATCH v2 1/4] ASoC: tlv320aic31xx: Add basic codec driver implementation

Quoted 8 lines · Mark Brown
Quoted 2 lines · Jyri Sarha
+- ai31xx-micbias-vg - MicBias Voltage required.
+        MICBIAS_OFF - MICBIAS output it not powered

Same comment as last time - why is this something which can be selected in the binding?

Fixed.

Quoted 8 lines

Documentation/devicetree/bindings/sound/tlv320aic31xx.txt line 25

Quoted 3 lines
Documentation/devicetree/bindings/sound/tlv320aic31xx.txt new file +3 -0
+        MICBIAS_2_0V - MICBIAS output is powered to 2.0V
+        MICBIAS_2_5V - MICBIAS output is powered to 2.5V
+        MICBIAS_AVDD - MICBIAS output is connected to AVDD

The numbers still need to be defined in the binding, the point with the defines is to make both code and DTs more readable but we need to know what is actually going to go into the binary.

Numbers added.

Quoted 6 lines

sound/soc/codecs/tlv320aic31xx.c line 566

Quoted 3 lines
sound/soc/codecs/tlv320aic31xx.c new file +3 -0
+	/* Mic Bias */
+	SND_SOC_DAPM_SUPPLY("Mic Bias", SND_SOC_NOPM, 0, 0, mic_bias_event,
+			    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),

The idiomatic thing would be to use the pin name.

In this case the mic bias comes out of the chip trough a separate pin and it is up to board designer to connect it with any (or all) of the three mic pins.

Quoted 7 lines

sound/soc/codecs/tlv320aic31xx.c line 615

Quoted 2 lines
sound/soc/codecs/tlv320aic31xx.c new file +2 -0
+	/* Make ADC turn on when recording even if not mixed from any inputs */
+	{"ADC", NULL, "Internal ADC Source"},

Don't do this (or the equivalent from the DACs) - we don't do this for any other drivers, we shouldn't do it for this one. If we're going to do something like this it should be generic not per driver hacks.

Similar approach is used at least in wm8400.c, wm8990.c, wm8991.c, and in ab8500-codec.c. But I see your point. I'll roll back that change. I moved the clock enable/disable code to set_bias_level() to avoid unwanted behavior (codec clocks not turning on at playback/capture start if damp switches are not set correctly).

Quoted 12 lines

sound/soc/codecs/tlv320aic31xx.c line 1076

Quoted 7 lines
sound/soc/codecs/tlv320aic31xx.c new file +7 -0
+	case SND_SOC_BIAS_STANDBY:
+		if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
+			aic31xx_set_power(codec, 1);
+		break;
+	case SND_SOC_BIAS_OFF:
+		aic31xx_set_power(codec, 0);
+		break;

Just inline the set power function, or at the very least split it into separate on and off functions - there is zero shared code between the power on and off paths.

After adding the clock enable/disable code to set_bias_level, it started to look hairy when everything was inlined. I split the set_power function to *_on and *_off functions.

In addition to these, after rebasing on top of linux-next branch, I started to use use the new SOC_DOUBLE_R_S_TLV macro for the signed integer mixers.

Best regards,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH v2 1/4] ASoC: tlv320aic31xx: Add basic codec driver implementation

Quoted 11 lines · Jyri Sarha
Quoted 5 lines · Mark Brown

sound/soc/codecs/tlv320aic31xx.c line 566

Quoted 3 lines
sound/soc/codecs/tlv320aic31xx.c new file +3 -0
+	/* Mic Bias */
+	SND_SOC_DAPM_SUPPLY("Mic Bias", SND_SOC_NOPM, 0, 0, mic_bias_event,
+			    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),

The idiomatic thing would be to use the pin name.

In this case the mic bias comes out of the chip trough a separate pin and it is up to board designer to connect it with any (or all) of the three mic pins.

Yes, exactly - you should be using the name of the pin that supplies the bias. This is how essentially all microphone biases work.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#10 lore raw

Re: [PATCH v2 1/4] ASoC: tlv320aic31xx: Add basic codec driver implementation

Quoted 9 lines · Mark Brown
Quoted 7 lines · Jyri Sarha
Quoted 5 lines · Mark Brown

Review

Quoted 3 lines
(quoted diff) +3 -0
+	/* Mic Bias */
+	SND_SOC_DAPM_SUPPLY("Mic Bias", SND_SOC_NOPM, 0, 0, mic_bias_event,
+			    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),

The idiomatic thing would be to use the pin name.

Quoted 7 lines
Quoted 3 lines

In this case the mic bias comes out of the chip trough a separate pin and it is up to board designer to connect it with any (or all) of the three mic pins.

Yes, exactly - you should be using the name of the pin that supplies the bias. This is how essentially all microphone biases work.

Changed widget name from "Mic Bias" to "MICBIAS".

BR,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#11 lore raw

PATCH v2 3/4 ASoC: davinci: Add SND_AM43XX_SOC_EPOS_EVM build option

In reply to a message not in the archive

Add support for am335x and am43x based boards with tlv320aic31xx compatible codec connected to McASP.

---
 sound/soc/davinci/Kconfig  |   12 ++++++++++++
 sound/soc/davinci/Makefile |    1 +
 2 files changed, 13 insertions(+)
sound/soc/davinci/Kconfig +12 -0
index a8ec1fc..e1e3663 100644
@@ -26,6 +26,18 @@ config SND_AM33XX_SOC_EVM
 	  AM335X-EVMSK, and BeagelBone with AudioCape boards have this
 	  setup.
 
+config SND_AM43XX_SOC_EPOS_EVM
+	tristate "SoC Audio for the AM33XX/AM43XX and TLV320AIC31XX based board"
+	depends on SND_DAVINCI_SOC
+	depends on SOC_AM33XX || SOC_AM43XX
+	select SND_SOC_TLV320AIC31XX
+	select SND_DAVINCI_SOC_MCASP
+	help
+	  Say Y or M if you want to add support for SoC audio on
+	  AM335X/AM43XX boards using McASP to connect to a codec of
+	  TLV320AIC31XX series. For example AM43XX-EPOS-EVM has such a
+	  setup.
+
 config SND_DAVINCI_SOC_EVM
 	tristate "SoC Audio support for DaVinci DM6446, DM355 or DM365 EVM"
 	depends on SND_DAVINCI_SOC
sound/soc/davinci/Makefile +1 -0
index 744d4d9..d61998f 100644
@@ -13,3 +13,4 @@ obj-$(CONFIG_SND_DAVINCI_SOC_VCIF) += snd-soc-davinci-vcif.o
 snd-soc-evm-objs := davinci-evm.o
 
 obj-$(CONFIG_SND_DAVINCI_SOC_GENERIC_EVM) += snd-soc-evm.o
+obj-$(CONFIG_SND_AM43XX_SOC_EPOS_EVM) += snd-soc-evm.o
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#12 lore raw

PATCH v2 4/4 ASoC: tlv320aic32x4: Sort Makefile in alphabetic order

In reply to a message not in the archive

The tlv320aic32x4 related files were wrongly placed after tlv320aic3x files.

---
 sound/soc/codecs/Makefile |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/Makefile +2 -2
index 23f8042..ff1775c 100644
@@ -65,8 +65,8 @@ snd-soc-tas5086-objs := tas5086.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic26-objs := tlv320aic26.o
 snd-soc-tlv320aic31xx-objs := tlv320aic31xx.o
-snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o
+snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 snd-soc-tlv320dac33-objs := tlv320dac33.o
 snd-soc-twl4030-objs := twl4030.o
 snd-soc-twl6040-objs := twl6040.o
@@ -196,8 +196,8 @@ obj-$(CONFIG_SND_SOC_TAS5086)	+= snd-soc-tas5086.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
 obj-$(CONFIG_SND_SOC_TLV320AIC31XX)     += snd-soc-tlv320aic31xx.o
-obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
 obj-$(CONFIG_SND_SOC_TLV320AIC32X4)     += snd-soc-tlv320aic32x4.o
+obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
 obj-$(CONFIG_SND_SOC_TLV320DAC33)	+= snd-soc-tlv320dac33.o
 obj-$(CONFIG_SND_SOC_TWL4030)	+= snd-soc-twl4030.o
 obj-$(CONFIG_SND_SOC_TWL6040)	+= snd-soc-twl6040.o
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 80b0f9ecd29b8bfb52fed22a0ca059591f89683d.1393941102.git.jsarha-l0cyMroinI0@public.gmane.org

#14 lore raw

Re: [PATCH v2 4/4] ASoC: tlv320aic32x4: Sort Makefile in alphabetic order

Quoted 1 line · Jyri Sarha

The tlv320aic32x4 related files were wrongly placed after tlv320aic3x files.

This doesn't apply against current code, please check and resend.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#16 lore raw

Re: [PATCH v2 4/4] ASoC: tlv320aic32x4: Sort Makefile in alphabetic order

Quoted 5 lines · Mark Brown
Quoted 1 line · Jyri Sarha

The tlv320aic32x4 related files were wrongly placed after tlv320aic3x files.

This doesn't apply against current code, please check and resend.

That is because it depends on the first patch in this series. I'll move it to first in the next one.

Best regards,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

PATCH v2 2/4 ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

In reply to Jyri Sarha

Add machine driver support for AM43xx-ePOS-EVM and update associated device tree binding document.

---
 .../bindings/sound/davinci-evm-audio.txt           |    9 +++--
 sound/soc/davinci/davinci-evm.c                    |   41 ++++++++++++++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sound/davinci-evm-audio.txt +6 -3
index 865178d..356cba1 100644
@@ -2,8 +2,10 @@
 
 Required properties:
 - compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx
+  	     : "ti,am43xx-epos-evm-audio" : for am43xx-epos-evm
 - ti,model : The user-visible name of this sound complex.
-- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
+- ti,audio-codec : The phandle of the TLV320AIC3x audio codec,
+  		   or the TLV320AIC31xx audio codec.
 - ti,mcasp-controller : The phandle of the McASP controller
 - ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec
 - ti,audio-routing : A list of the connections between audio components.
@@ -14,9 +16,10 @@ Required properties:
   Board connectors:
 
   * Headphone Jack
-  * Line Out
+  * Line Out - "ti,da830-evm-audio" only
   * Mic Jack
-  * Line In
+  * Line In - "ti,da830-evm-audio" only
+  * Speaker - "ti,am43xx-epos-evm-audio" only
 
 
 Example:
sound/soc/davinci/davinci-evm.c +41 -0

58 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#18 lore raw

Re: [PATCH v2 2/4] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

sound/soc/davinci/davinci-evm.c static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) · line 141

Quoted 12 lines
sound/soc/davinci/davinci-evm.c +11 -0
+static const struct snd_soc_dapm_widget aic31xx_dapm_widgets[] = {
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_SPK("Speaker", NULL),
+	SND_SOC_DAPM_MIC("Mic Jack", NULL),
+};
+
+/* Logic for EVMs with an aic31xx */
+static int evm_aic31xx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_dapm_context *dapm = &codec->dapm;

Machine level DAPM elements should go into the card's DAPM context, not the CODEC context. Also use rtd->card to get a pointer to the card instead of rtd->codec->card.

Quoted 15 lines
sound/soc/davinci/davinci-evm.c +15 -0
+	struct device_node *np = codec->card->dev->of_node;
+	int ret;
+
+	snd_soc_dapm_new_controls(dapm, aic31xx_dapm_widgets,
+				  ARRAY_SIZE(aic31xx_dapm_widgets));
+
+	if (np) {
+		ret = snd_soc_of_parse_audio_routing(codec->card,
+						     "ti,audio-routing");
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}

A message that is not in the archive (sent off-list or not yet received): 5315DF41.1090302-Qo5EllUWu/[email protected]

author
#20 lore raw

Re: [alsa-devel] [PATCH v2 2/4] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 17 lines · Lars-Peter Clausen

sound/soc/davinci/davinci-evm.c static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) · line 141

Quoted 12 lines
sound/soc/davinci/davinci-evm.c +11 -0
+static const struct snd_soc_dapm_widget aic31xx_dapm_widgets[] = {
+    SND_SOC_DAPM_HP("Headphone Jack", NULL),
+    SND_SOC_DAPM_SPK("Speaker", NULL),
+    SND_SOC_DAPM_MIC("Mic Jack", NULL),
+};
+
+/* Logic for EVMs with an aic31xx */
+static int evm_aic31xx_init(struct snd_soc_pcm_runtime *rtd)
+{
+    struct snd_soc_codec *codec = rtd->codec;
+    struct snd_soc_dapm_context *dapm = &codec->dapm;

Machine level DAPM elements should go into the card's DAPM context, not the CODEC context. Also use rtd->card to get a pointer to the card instead of rtd->codec->card.

Thanks, I'll fix those.

Best regards,
Jyri
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw

PATCH v3 1/1 ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

In reply to Lars-Peter Clausen

Add machine driver support for AM43xx-ePOS-EVM and update associated device tree binding document.

---
 .../bindings/sound/davinci-evm-audio.txt           |    9 +++--
 sound/soc/davinci/davinci-evm.c                    |   42 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sound/davinci-evm-audio.txt +6 -3
index 865178d..356cba1 100644
@@ -2,8 +2,10 @@
 
 Required properties:
 - compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx
+  	     : "ti,am43xx-epos-evm-audio" : for am43xx-epos-evm
 - ti,model : The user-visible name of this sound complex.
-- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
+- ti,audio-codec : The phandle of the TLV320AIC3x audio codec,
+  		   or the TLV320AIC31xx audio codec.
 - ti,mcasp-controller : The phandle of the McASP controller
 - ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec
 - ti,audio-routing : A list of the connections between audio components.
@@ -14,9 +16,10 @@ Required properties:
   Board connectors:
 
   * Headphone Jack
-  * Line Out
+  * Line Out - "ti,da830-evm-audio" only
   * Mic Jack
-  * Line In
+  * Line In - "ti,da830-evm-audio" only
+  * Speaker - "ti,am43xx-epos-evm-audio" only
 
 
 Example:
sound/soc/davinci/davinci-evm.c +42 -0

59 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#22 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 2 lines · Jyri Sarha

Add machine driver support for AM43xx-ePOS-EVM and update associated device tree binding document.

Don't send new patches in replies to the middle of threads, that is just confusing and hard to follow. Send a new series.

Quoted 8 lines
sound/soc/davinci/davinci-evm.c +8 -0
+/* Logic for EVMs with an aic31xx */
+static int evm_aic31xx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_card *card = rtd->card;
+	struct snd_soc_dapm_context *dapm = &card->dapm;
+	struct device_node *np = card->dev->of_node;
+	int ret;

sound/soc/davinci/davinci-evm.c static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) · line 154

Quoted 10 lines
sound/soc/davinci/davinci-evm.c +10 -0
+
+	snd_soc_dapm_new_controls(dapm, aic31xx_dapm_widgets,
+				  ARRAY_SIZE(aic31xx_dapm_widgets));
+
+	if (np) {
+		ret = snd_soc_of_parse_audio_routing(codec->card,
+						     "ti,audio-routing");
+		if (ret)
+			return ret;
+	}

Why not add the DAPM widget table to...

sound/soc/davinci/davinci-evm.c static struct snd_soc_dai_link evm_dai_tlv320aic3x = { · line 375

Quoted 4 lines
sound/soc/davinci/davinci-evm.c +4 -0
+	{
+		.compatible = "ti,am43xx-epos-evm-audio",
+		.data = &evm_dai_tlv320aic3111,
+	},

...the data here?

Or alternatively should support for the widgets binding that was recently added by added to the kernel - that way the binding becomes more general and doesnn't need individual boards adding? Indeed ideally the simple-card binding (which that was added for) could just be used for these boards.

#23 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 7 lines · Mark Brown
Quoted 2 lines · Jyri Sarha

Add machine driver support for AM43xx-ePOS-EVM and update associated device tree binding document.

Don't send new patches in replies to the middle of threads, that is just confusing and hard to follow. Send a new series.

Ok, won't do that anymore.

Quoted 28 lines
Quoted 8 lines
sound/soc/davinci/davinci-evm.c +8 -0
+/* Logic for EVMs with an aic31xx */
+static int evm_aic31xx_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_card *card = rtd->card;
+	struct snd_soc_dapm_context *dapm = &card->dapm;
+	struct device_node *np = card->dev->of_node;
+	int ret;

sound/soc/davinci/davinci-evm.c static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd) · line 154

Quoted 10 lines
sound/soc/davinci/davinci-evm.c +10 -0
+
+	snd_soc_dapm_new_controls(dapm, aic31xx_dapm_widgets,
+				  ARRAY_SIZE(aic31xx_dapm_widgets));
+
+	if (np) {
+		ret = snd_soc_of_parse_audio_routing(codec->card,
+						     "ti,audio-routing");
+		if (ret)
+			return ret;
+	}

Why not add the DAPM widget table to...

sound/soc/davinci/davinci-evm.c static struct snd_soc_dai_link evm_dai_tlv320aic3x = { · line 375

Quoted 4 lines
sound/soc/davinci/davinci-evm.c +4 -0
+	{
+		.compatible = "ti,am43xx-epos-evm-audio",
+		.data = &evm_dai_tlv320aic3111,
+	},

...the data here?

Quoted 6 lines

Or alternatively should support for the widgets binding that was recently added by added to the kernel - that way the binding becomes more general and doesnn't need individual boards adding? Indeed ideally the simple-card binding (which that was added for) could just be used for these boards.

I got am43x-epos-evm audio working on simple-card directly. I guess we can forget about this patch.

However, I think there is a problem with simple-card. It does not invert bitclock-master and frame-master values when converting them to CB[SM] and CF[SM] for cpu_dai as I think it should. I can get around it by setting the both cpu-dai and the codec as bclk and frame masters in the sound node. I volunteer to fix this if you agree.

Best regards,
Jyri

maintainer
#24 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 6 lines · Jyri Sarha

However, I think there is a problem with simple-card. It does not invert bitclock-master and frame-master values when converting them to CB[SM] and CF[SM] for cpu_dai as I think it should. I can get around it by setting the both cpu-dai and the codec as bclk and frame masters in the sound node. I volunteer to fix this if you agree.

No, it shouldn't do any inversion. If inversion is required one of the drivers is buggy, they are CODEC bit master and CPU bit master so for a CPU driver the sense should be inverted when parsing.

#25 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 11 lines · Mark Brown
Quoted 6 lines · Jyri Sarha
Quoted 6 lines

However, I think there is a problem with simple-card. It does not invert bitclock-master and frame-master values when converting them to CB[SM] and CF[SM] for cpu_dai as I think it should. I can get around it by setting the both cpu-dai and the codec as bclk and frame masters in the sound node. I volunteer to fix this if you agree.

No, it shouldn't do any inversion. If inversion is required one of the drivers is buggy, they are CODEC bit master and CPU bit master so for a CPU driver the sense should be inverted when parsing.

Yes, that is the problem. The same code in simple-card parses the codec node and cpu-dai node and they produce the same SND_SOC_DAIFMT_C??_C?? flags for both codec and cpu-dai drivers.

For example:

	simple-audio-card,cpu {
		sound-dai = <&mcasp1>;
	};

causes SND_SOC_DAIFMT_CBS_CFS flags to be set to mcasp driver in set_dai_fmt() call. So omitting the bitclock-master and frame-master parameters from cpu-dai node strangely indicates that the cpu-dai should be the bitclock and frame master. Can this be right?

If you do not want to have the inversion, could we at least call the parameters codec-bitclock-master and codec-frame-master.

Best regards,
Jyri

maintainer
#26 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 9 lines · Jyri Sarha
Quoted 3 lines · Mark Brown

No, it shouldn't do any inversion. If inversion is required one of the drivers is buggy, they are CODEC bit master and CPU bit master so for a CPU driver the sense should be inverted when parsing.

Yes, that is the problem. The same code in simple-card parses the codec node and cpu-dai node and they produce the same SND_SOC_DAIFMT_C??_C?? flags for both codec and cpu-dai drivers.

Sorry, thinko above - the master flags are specified in terms of the CODEC. Anything interpreting them that isn't a CODEC needs to be inverting the sense.

#27 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 7 lines · Mark Brown
Quoted 5 lines · Jyri Sarha
Quoted 3 lines · Mark Brown

No, it shouldn't do any inversion. If inversion is required one of the drivers is buggy, they are CODEC bit master and CPU bit master so for a CPU driver the sense should be inverted when parsing.

Quoted 7 lines
Quoted 3 lines

Yes, that is the problem. The same code in simple-card parses the codec node and cpu-dai node and they produce the same SND_SOC_DAIFMT_C??_C?? flags for both codec and cpu-dai drivers.

Sorry, thinko above - the master flags are specified in terms of the CODEC. Anything interpreting them that isn't a CODEC needs to be inverting the sense.

Exactly, CBM_CFM means that the codec is the master of both clocks. Codec is configured as master and the cpu side is configured as slave.

But the issue is that with simple card (when you want to have the codec as master for both clocks):

simple-audio-card,codec {
	sound-dai = <&aic3106>;
	bitclock-master;
	frame-master;
};
simple-audio-card,cpu {
	sound-dai = <&mcasp1 0>;
};

The codec will get CBM_CFM, however the cpu_dai will end up having CBS_CFS (since *-master is not specified in the dts).

So when the simple card parses the master/slave configuration it has to invert the cpu_dai settings it got back from snd_soc_of_parse_daifmt() to get it right.

Since:

simple-audio-card,codec {
	sound-dai = <&aic3106>;
};
simple-audio-card,cpu {
	sound-dai = <&mcasp1 0>;
	bitclock-master;
	frame-master;
};

Will end up as: codec is CBS_CFS and cpu_dai as CBM_CFM which means that both cpu and codec is supposed to be slave...

Signature · 1 line
Péter
maintainer
#28 lore raw

Re: [PATCH v3] ASoC: davinci-evm: Add AM43xx-EPOS-EVM audio support

Quoted 12 lines · Peter Ujfalusi

Exactly, CBM_CFM means that the codec is the master of both clocks. Codec is configured as master and the cpu side is configured as slave.

But the issue is that with simple card (when you want to have the codec as master for both clocks):

simple-audio-card,codec {
	sound-dai = <&aic3106>;
	bitclock-master;
	frame-master;
};
Quoted 6 lines
simple-audio-card,cpu {
	sound-dai = <&mcasp1 0>;
};

The codec will get CBM_CFM, however the cpu_dai will end up having CBS_CFS (since *-master is not specified in the dts).

What I would expect the code to be doing here is coming up with the same setting for both ends of the link rather than trying to parse the two ends of the link independently - though that *is* more flexible it's unlikely to actually work in a system. The properties on each end of the link aren't independent of each other.

Quoted 2 lines

So when the simple card parses the master/slave configuration it has to invert the cpu_dai settings it got back from snd_soc_of_parse_daifmt() to get it right.

Or there should just be one unified parse. When reading Jiri's mail the lack of any reference to the code it really sounded like he was asking for the result of a single parse to inverted between passing to the CODEC and CPU sides.

Needs looking at.