Skip to contentSkip to conversation

ARM: dt: tegra: Enable device tree audio on PAZ00 board.

PATCH Superseded Leon Romanovsky 3 participants 5 messages Jan 25, 2012 – Jan 27, 2012 3 messages not in the archive

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ARM: dt: tegra: Enable device tree audio on PAZ00 board.

This patch adds initial device tree support of ALC5632 sound codec and machine driver for PAZ00 board. The implementation is based on the WM8903 codec.

---
 .../devicetree/bindings/sound/alc5632.txt          |   24 ++++++
 .../bindings/sound/tegra-audio-alc5632.txt         |   55 ++++++++++++++
 arch/arm/boot/dts/tegra-paz00.dts                  |   29 ++++++--
 sound/soc/tegra/tegra_alc5632.c                    |   78 ++++++++++++++++++--
 4 files changed, 173 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/alc5632.txt
 create mode 100644 Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt
Documentation/devicetree/bindings/sound/alc5632.txt new file +24 -0
new file mode 100644
index 0000000..8608f74
@@ -0,0 +1,24 @@
+ALC5632 audio CODEC
+
+This device supports I2C only.
+
+Required properties:
+
+  - compatible : "realtek,alc5632"
+
+  - reg : the I2C address of the device.
+
+  - gpio-controller : Indicates this device is a GPIO controller.
+
+  - #gpio-cells : Should be two. The first cell is the pin number and the
+    second cell is used to specify optional parameters (currently unused).
+
+Example:
+
+alc5632: alc5632@1e {
+	compatible = "realtek,alc5632";
+	reg = <0x1a>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+};
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +55 -0

55 lines not on this page · raw message

arch/arm/boot/dts/tegra-paz00.dts +23 -6
index 4d1bcdc..692d20c 100644
@@ -12,6 +12,13 @@
 
 	i2c@7000c000 {
 		clock-frequency = <400000>;
+
+		alc5632: alc5632@1e {
+			compatible = "realtek,alc5632";
+			reg = <0x1e>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
 	};
 
 	i2c@7000c400 {
@@ -37,16 +44,26 @@
 		clock-frequency = <400000>;
 	};
 
-	i2s@70002800 {
-		status = "disable";
-	};
-
 	i2s@70002a00 {
 		status = "disable";
 	};
 
-	das@70000c00 {
-		status = "disable";
+	sound {
+		compatible = "nvidia,tegra-audio-alc5632-paz00",
+		"nvidia,tegra-audio-alc5632";
+
+		nvidia,model = "Compal PAZ00";
+
+		nvidia,audio-routing =
+			"Int Spk", "SPKOUT",
+			"Int Spk", "SPKOUTN",
+			"MIC1", "MICBIAS1",
+			"MICBIAS1", "Headset Mic",
+			"Headset Stereophone", "HPR",
+			"Headset Stereophone", "HPL";
+
+		nvidia,audio-codec = <&alc5632>;
+		nvidia,i2s-controller = <&tegra_i2s1>;
 	};
 
 	serial@70006000 {
sound/soc/tegra/tegra_alc5632.c +71 -7

121 lines not on this page · raw message

Signature · 1 line
1.7.3.4

A message that is not in the archive (sent off-list or not yet received): 1327517363-29698-1-git-send-email-leon-2ukJVAZIZ/[email protected]

#2 lore raw

Leon Romanovsky wrote at Wednesday, January 25, 2012 11:49 AM:

Quoted 7 lines

This patch adds initial device tree support of ALC5632 sound codec and machine driver for PAZ00 board. The implementation is based on the WM8903 codec.

 .../devicetree/bindings/sound/alc5632.txt          |   24 ++++++
 .../bindings/sound/tegra-audio-alc5632.txt         |   55 ++++++++++++++
 arch/arm/boot/dts/tegra-paz00.dts                  |   29 ++++++--
 sound/soc/tegra/tegra_alc5632.c                    |   78 ++++++++++++++++++--

I worry this patch does a little too much at once; perhaps it should be split up a little?

Quoted 1 line
(quoted diff) +0 -0

...

Documentation/devicetree/bindings/sound/alc5632.txt line 7

Quoted 3 lines
Documentation/devicetree/bindings/sound/alc5632.txt new file +3 -0
+Required properties:
+
+  - compatible : "realtek,alc5632"

You should update Documentation/devicetree/bindings/vendor-prefixes.txt too. Separately from this patch is probably fine.

Quoted 14 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +7 -0
new file mode 100644
index 0000000..315213f
@@ -0,0 +1,55 @@
+NVIDIA Tegra audio complex
+
+Required properties:
+- compatible : "nvidia,tegra-audio-alc5632"
+- nvidia,model : The user-visible name of this sound complex.
+- nvidia,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +10 -0
+  the second being the connection's source. Valid names for sources and
+  sinks are the ALC5632's pins:
+
+  ALC5632 pins:
+
+  * SPKOUT
+  * SPKOUTN
+  * HPL
+  * HPR
+  * AUXOUT

My copy of the ALC5632 datasheet indicates there are both AUX_OUT_P and AUX_OUTN pins. Are they always used together such that it makes sense to group them together in the device tree binding?

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 21

Quoted 4 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +4 -0
+  * LINEINL
+  * LINEINR
+  * PHONEP
+  * PHONEP

PHONEN

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 23

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MIC1
+  * MIC2

Same as above; the datasheet lists MIC1_P, MIC1_N, MIC2_P, MIC2_N.

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 25

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MICBIAS1
+  * MICBIAS2

I only see MICBIAS1 in the datasheet, not MICBIAS2.

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 32

Quoted 7 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +7 -0
+
+  Board connectors:
+
+  * Headset Stereophone
+  * Int Spk
+  * MIC1
+  * MICBIAS1

Those last two are codec pins, not board connectors.

Don't you need "Headset Mic" in the list too?

...

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 49

Quoted 5 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +5 -0
+	nvidia,audio-routing =
+				"Int Spk", "SPKOUT",
+				"Int Spk", "SPKOUTN",
+				"MIC1", "MICBIAS1",
+				"MICBIAS1", "Headset Mic",

I think those last two lines should read:

				"Headset Mic", "MICBIAS1",
				"MIC1", " Headset Mic",

The DAPM route table in the driver probably needs updating to say the same thing too.

(all the comments on the example above apply to the copy in the .dts file too)

...

arch/arm/boot/dts/tegra-paz00.dts line 53

Quoted 5 lines
arch/arm/boot/dts/tegra-paz00.dts +3 -0
 
+	sound {
+		compatible = "nvidia,tegra-audio-alc5632-paz00",
+		"nvidia,tegra-audio-alc5632";

That last line needs some extra indent.

Quoted 3 lines
sound/soc/tegra/tegra_alc5632.c +0 -0
@@ -163,26 +164,80 @@ static __devinit int tegra_alc5632_probe(struct platform_device *pdev)

...

sound/soc/tegra/tegra_alc5632.c static __devinit int tegra_alc5632_probe(struct platform_device *pdev) · line 178

Quoted 4 lines
sound/soc/tegra/tegra_alc5632.c +4 -0
+	alc5632->pcm_dev = ERR_PTR(-EINVAL);
+
+	if (!(pdev->dev.of_node)) {
+		dev_err(&pdev->dev, "No platform data supplied\n");

I think I'd phrase that more like "Must be instantiated using device tree".

sound/soc/tegra/tegra_alc5632.c static __devinit int tegra_alc5632_probe(struct platform_device *pdev) · line 191

Quoted 1 line
sound/soc/tegra/tegra_alc5632.c +1 -0
+	tegra_alc5632_dai.codec_name = NULL;

Given you're only supporting instantiation using device tree now, why not just not initialize that field, and remove that assignment?

sound/soc/tegra/tegra_alc5632.c static __devinit int tegra_alc5632_probe(struct platform_device *pdev) · line 193

Quoted 2 lines
sound/soc/tegra/tegra_alc5632.c +2 -0
+	tegra_alc5632_dai.codec_of_node = of_parse_phandle(
+	pdev->dev.of_node, "nvidia,audio-codec", 0);

Indent that last line a bit more.

sound/soc/tegra/tegra_alc5632.c static __devinit int tegra_alc5632_probe(struct platform_device *pdev) · line 202

Quoted 1 line
sound/soc/tegra/tegra_alc5632.c +1 -0
+	tegra_alc5632_dai.cpu_dai_name = NULL;

Same comment; you can remove that.

sound/soc/tegra/tegra_alc5632.c static __devinit int tegra_alc5632_probe(struct platform_device *pdev) · line 204

Quoted 2 lines
sound/soc/tegra/tegra_alc5632.c +2 -0
+	tegra_alc5632_dai.cpu_dai_of_node = of_parse_phandle(
+	pdev->dev.of_node, "nvidia,i2s-controller", 0);

Indent that last line a bit more.

Overall, this looks like the same structure as the Tegra+WM8903 bindings, so it works for me.

Signature · 1 line
nvpublic

A message that is not in the archive (sent off-list or not yet received): 74CDBE0F657A3D45AFBB94109FB122FF178CB821B2-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org

#4 lore raw
Quoted 19 lines · Stephen Warren

Leon Romanovsky wrote at Wednesday, January 25, 2012 11:49 AM:

Quoted 18 lines

This patch adds initial device tree support of ALC5632 sound codec and machine driver for PAZ00 board. The implementation is based on the WM8903 codec.

+++ b/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +13 -0
@@ -0,0 +1,55 @@
+NVIDIA Tegra audio complex
+
+Required properties:
+- compatible : "nvidia,tegra-audio-alc5632"
+- nvidia,model : The user-visible name of this sound complex.
+- nvidia,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,
+  the second being the connection's source. Valid names for sources and
+  sinks are the ALC5632's pins:
+
+  ALC5632 pins:
+
+  * SPKOUT
Quoted 8 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 17

Quoted 4 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +4 -0
+  * SPKOUTN
+  * HPL
+  * HPR
+  * AUXOUT

My copy of the ALC5632 datasheet indicates there are both AUX_OUT_P and AUX_OUTN pins. Are they always used together such that it makes sense to group them together in the device tree binding?

You are right, it must be the same as SPKOUT

Quoted 11 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 21

Quoted 5 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +4 -0
+  * LINEINL
+  * LINEINR
+  * PHONEP
+  * PHONEP

PHONEN

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 23

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MIC1
+  * MIC2
Quoted 6 lines

Same as above; the datasheet lists MIC1_P, MIC1_N, MIC2_P, MIC2_N.

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 25

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MICBIAS1
+  * MICBIAS2

I only see MICBIAS1 in the datasheet, not MICBIAS2.

You are right if you are looking on function block only (page 3), but in register description you can find reference to MICBIAS2 (reg 22h, microphone control).

Quoted 22 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 32

Quoted 8 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +7 -0
+
+  Board connectors:
+
+  * Headset Stereophone
+  * Int Spk
+  * MIC1
+  * MICBIAS1

Those last two are codec pins, not board connectors.

Don't you need "Headset Mic" in the list too?

...

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 49

Quoted 5 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +5 -0
+     nvidia,audio-routing =
+                             "Int Spk", "SPKOUT",
+                             "Int Spk", "SPKOUTN",
+                             "MIC1", "MICBIAS1",
+                             "MICBIAS1", "Headset Mic",

I think those last two lines should read:

Quoted 8 lines

                               "Headset Mic", "MICBIAS1", "MIC1", " Headset Mic",

The DAPM route table in the driver probably needs updating to say the same thing too.

(all the comments on the example above apply to the copy in the .dts file too)

Microphone is not tested at all, so you probably right. I prefer to be close as possible to previous board implementation and provide followup patches to clean the microphone path.

Quoted 7 lines

Overall, this looks like the same structure as the Tegra+WM8903 bindings, so it works for me.

--
nvpublic

Signature · 2 lines
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon-2ukJVAZIZ/[email protected]

A message that is not in the archive (sent off-list or not yet received): CALq1K=+1czTOPyQOU05H8psyGO5RncOHrJm+tLtzOdTLHqtVDQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Leon Romanovsky wrote at Friday, January 27, 2012 9:02 AM:

Quoted 29 lines · Stephen Warren
Quoted 19 lines

Leon Romanovsky wrote at Wednesday, January 25, 2012 11:49 AM:

Quoted 18 lines

This patch adds initial device tree support of ALC5632 sound codec and machine driver for PAZ00 board. The implementation is based on the WM8903 codec.

+++ b/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +13 -0
@@ -0,0 +1,55 @@
+NVIDIA Tegra audio complex
+
+Required properties:
+- compatible : "nvidia,tegra-audio-alc5632"
+- nvidia,model : The user-visible name of this sound complex.
+- nvidia,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,
+  the second being the connection's source. Valid names for sources and
+  sinks are the ALC5632's pins:
+
+  ALC5632 pins:
+
+  * SPKOUT
Quoted 8 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 17

Quoted 4 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +4 -0
+  * SPKOUTN
+  * HPL
+  * HPR
+  * AUXOUT

My copy of the ALC5632 datasheet indicates there are both AUX_OUT_P and AUX_OUTN pins. Are they always used together such that it makes sense to group them together in the device tree binding?

Quoted 1 line

You are right, it must be the same as SPKOUT

I think the opposite; AUXOUT and SPKOUT aren't the same pin. I meant that AUX_OUT_P and AUX_OUT_N are different pins, so I'm asking why they're a single pin in the above pin list (and in the ASoC codec driver). In contrast, SPKOUT is represented explicitly as two pins which seems to make more sense.

Quoted 12 lines
Quoted 12 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 21

Quoted 4 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +4 -0
+  * LINEINL
+  * LINEINR
+  * PHONEP
+  * PHONEP

PHONEN

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 23

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MIC1
+  * MIC2

Same as above; the datasheet lists MIC1_P, MIC1_N, MIC2_P, MIC2_N.

Quoted 8 lines
Quoted 4 lines

Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt line 25

Quoted 2 lines
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +2 -0
+  * MICBIAS1
+  * MICBIAS2

I only see MICBIAS1 in the datasheet, not MICBIAS2.

You are right if you are looking on function block only (page 3), but in register description you can find reference to MICBIAS2 (reg 22h, microphone control).

I do see that register bit, but the pinout doesn't include it in the codec's own datasheet nor the AC100 schematics. I suspect that there really is no MICBIAS2 feature and the register documentation is simply incorrect, perhaps a carry-over from some other codec? Still, I suppose that just in case the signal really is routed to one of the pins labeled "NC" in the datasheet, there isn't too much harm including it in the driver, and this binding.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt new file +1 -0
+  Board connectors:

...

Quoted 1 line
Quoted 1 line

Don't you need "Headset Mic" in the list too?

...

Quoted 1 line
Quoted 1 line
Quoted 1 line

+     nvidia,audio-routing =

...

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

+                             "MIC1", "MICBIAS1",
+                             "MICBIAS1", "Headset Mic",

I think those last two lines should read:

                               "Headset Mic", "MICBIAS1", "MIC1", " Headset Mic",

Quoted 6 lines
Quoted 2 lines

The DAPM route table in the driver probably needs updating to say the same thing too.

Microphone is not tested at all, so you probably right. I prefer to be close as possible to previous board implementation and provide followup patches to clean the microphone path.

I guess that doesn't actually affect the structure of the binding, just the data contained in the properties, so it's not a big deal if it goes in like this. Mark might have a different opinion though, since it's a simple fix...

Signature · 1 line
nvpublic
#7 lore raw
Quoted 30 lines · Stephen Warren

Leon Romanovsky wrote at Friday, January 27, 2012 9:02 AM:

Quoted 29 lines · Stephen Warren
Quoted 27 lines

Leon Romanovsky wrote at Wednesday, January 25, 2012 11:49 AM:

Quoted 12 lines

This patch adds initial device tree support of ALC5632 sound codec and machine driver for PAZ00 board. The implementation is based on the WM8903 codec.

+++ b/Documentation/devicetree/bindings/sound/tegra-audio-alc5632.txt

(quoted diff) +7 -0
@@ -0,0 +1,55 @@
+NVIDIA Tegra audio complex
+
+Required properties:
+- compatible : "nvidia,tegra-audio-alc5632"
+- nvidia,model : The user-visible name of this sound complex.
+- nvidia,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,

Review line 17

Quoted 10 lines
(quoted diff) +10 -0
+  the second being the connection's source. Valid names for sources and
+  sinks are the ALC5632's pins:
+
+  ALC5632 pins:
+
+  * SPKOUT
+  * SPKOUTN
+  * HPL
+  * HPR
+  * AUXOUT

My copy of the ALC5632 datasheet indicates there are both AUX_OUT_P and AUX_OUTN pins. Are they always used together such that it makes sense to group them together in the device tree binding?

Quoted 7 lines
Quoted 1 line

You are right, it must be the same as SPKOUT

I think the opposite; AUXOUT and SPKOUT aren't the same pin. I meant that AUX_OUT_P and AUX_OUT_N are different pins, so I'm asking why they're a single pin in the above pin list (and in the ASoC codec driver). In contrast, SPKOUT is represented explicitly as two pins which seems to make more sense.

Sorry for the misunderstanding, This is what i wanted to say.

Quoted 22 lines
Quoted 13 lines
Quoted 13 lines

Review line 21

Quoted 5 lines
(quoted diff) +4 -0
+  * LINEINL
+  * LINEINR
+  * PHONEP
+  * PHONEP

PHONEN

Review line 23

Quoted 2 lines
(quoted diff) +2 -0
+  * MIC1
+  * MIC2

Same as above; the datasheet lists MIC1_P, MIC1_N, MIC2_P, MIC2_N.

Quoted 8 lines
Quoted 4 lines

Review line 25

Quoted 2 lines
(quoted diff) +2 -0
+  * MICBIAS1
+  * MICBIAS2

I only see MICBIAS1 in the datasheet, not MICBIAS2.

You are right if you are looking on function block only (page 3), but in register description you can find reference to MICBIAS2 (reg 22h, microphone control).

Quoted 7 lines

I do see that register bit, but the pinout doesn't include it in the codec's own datasheet nor the AC100 schematics. I suspect that there really is no MICBIAS2 feature and the register documentation is simply incorrect, perhaps a carry-over from some other codec? Still, I suppose that just in case the signal really is routed to one of the pins labeled "NC" in the datasheet, there isn't too much harm including it in the driver, and this binding.

Sure

Quoted 30 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +1 -0
+  Board connectors:

...

Quoted 1 line
Quoted 1 line

Don't you need "Headset Mic" in the list too?

...

Quoted 1 line
Quoted 1 line
Quoted 1 line

+     nvidia,audio-routing =

...

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

+                             "MIC1", "MICBIAS1",
+                             "MICBIAS1", "Headset Mic",

I think those last two lines should read:

                               "Headset Mic", "MICBIAS1", "MIC1", " Headset Mic",

Quoted 6 lines
Quoted 2 lines

The DAPM route table in the driver probably needs updating to say the same thing too.

Microphone is not tested at all, so you probably right. I prefer to be close as possible to previous board implementation and provide followup patches to clean the microphone path.

I guess that doesn't actually affect the structure of the binding, just the data contained in the properties, so it's not a big deal if it goes in like this. Mark might have a different opinion though, since it's a simple fix...

--
nvpublic

Signature · 2 lines
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | [email protected]