Skip to contentSkip to conversation

ASoC/ARM: tegra: apalis/colibri t30: sgtl5000 audio

PATCH Superseded Marcel Ziswiler 2 participants 5 messages Sep 10, 2014 – Sep 12, 2014

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ASoC/ARM: tegra: apalis/colibri t30: sgtl5000 audio

This series adds/integrates Freescale SGTL5000 analogue audio codec support.

Changes in v2:
- Using simple-audio-card as suggested by Fabio.

Marcel Ziswiler (2):
ARM: tegra: apalis/colibri t30: integrate audio support
ARM: tegra: enable sgtl5000 audio

 arch/arm/boot/dts/tegra30-apalis.dtsi  | 65 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/tegra30-colibri.dtsi | 65 ++++++++++++++++++++++++++++++++++
 arch/arm/configs/tegra_defconfig       |  2 ++
 3 files changed, 132 insertions(+)
Signature · 1 line
1.9.3
#1 lore raw

PATCH v2 1/2 ARM: tegra: apalis/colibri t30: integrate audio support

Integrate Freescale SGTL5000 analogue audio codec support.

---
Changes in v2:
- Using simple-audio-card as suggested by Fabio.

 arch/arm/boot/dts/tegra30-apalis.dtsi  | 65 ++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/tegra30-colibri.dtsi | 65 ++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+)
arch/arm/boot/dts/tegra30-apalis.dtsi +65 -0
index a5446cb..fa3bc92 100644
@@ -47,6 +47,24 @@
 		pinctrl-0 = <&state_default>;
 
 		state_default: pinmux {
+			/* Apalis Analogue Audio */
+			clk1_out_pw4 {
+				nvidia,pins = "clk1_out_pw4";
+				nvidia,function = "extperiph1";
+				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+				nvidia,tristate = <TEGRA_PIN_DISABLE>;
+				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+			};
+			dap3_fs_pp0 {
+				nvidia,pins =	"dap3_fs_pp0",
+						"dap3_sclk_pp3",
+						"dap3_din_pp1",
+						"dap3_dout_pp2";
+				nvidia,function = "i2s2";
+				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+				nvidia,tristate = <TEGRA_PIN_DISABLE>;
+			};
+
 			/* Apalis BKL1_ON */
 			pv2 {
 				nvidia,pins = "pv2";
@@ -404,6 +422,16 @@
 		status = "okay";
 		clock-frequency = <100000>;
 
+		/* SGTL5000 audio codec */
+		sgtl5000: codec@0a {
+			#sound-dai-cells = <0>;
+			compatible = "fsl,sgtl5000";
+			reg = <0x0a>;
+			VDDA-supply = <&sys_3v3_reg>;
+			VDDIO-supply = <&sys_3v3_reg>;
+			clocks = <&tegra_car TEGRA30_CLK_EXTERN1>;
+		};
+
 		pmic: tps65911@2d {
 			compatible = "ti,tps65911";
 			reg = <0x2d>;
@@ -635,6 +663,13 @@
 		nvidia,sys-clock-req-active-high;
 	};
 
+	ahub@70080000 {
+		i2s@70080500 {
+			#sound-dai-cells = <0>;
+			status = "okay";
+		};
+	};
+
 	sdhci@78000600 {
 		status = "okay";
 		bus-width = <8>;
@@ -684,4 +719,34 @@
 			regulator-always-on;
 		};
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,name = "Toradex Apalis T30";
+		simple-audio-card,routing =
+			"Headphone Jack", "HP_OUT",
+			"LINE_IN", "Line In Jack",
+			"MIC_IN", "Microphone Jack";
+		simple-audio-card,widgets =
+			"Headphone", "Headphone Jack",
+			"Line In", "Line In Jack",
+			"Microphone", "Microphone Jack";
+
+		simple-audio-card,codec {
+			bitclock-master;
+			clocks = <&tegra_car TEGRA30_CLK_EXTERN1>;
+			frame-master;
+			sound-dai = <&sgtl5000>;
+		};
+
+		simple-audio-card,cpu {
+			bitclock-master;
+			clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
+				 <&tegra_car TEGRA30_CLK_PLL_A_OUT0>;
+			frame-master;
+			master-clkdir-out;
+			sound-dai = <&tegra_i2s2>;
+		};
+	};
 };
arch/arm/boot/dts/tegra30-colibri.dtsi +65 -0

87 lines not on this page · raw message

Signature · 1 line
1.9.3
#2 lore raw

Re: [PATCH v2 1/2] ARM: tegra: apalis/colibri t30: integrate audio support

Quoted 4 lines · Marcel Ziswiler

Integrate Freescale SGTL5000 analogue audio codec support.

No, definitely not; this patch has significant semantic changes since I reviewed it.

Quoted 5 lines
arch/arm/boot/dts/tegra30-apalis.dtsi +2 -0
 
 
+	sound {
+		compatible = "simple-audio-card";

...

Quoted 6 lines
arch/arm/boot/dts/tegra30-apalis.dtsi +6 -0
+		simple-audio-card,codec {
+			bitclock-master;
+			clocks = <&tegra_car TEGRA30_CLK_EXTERN1>;
+			frame-master;
+			sound-dai = <&sgtl5000>;
+		};

arch/arm/boot/dts/tegra30-apalis.dtsi line 751

Quoted 10 lines
arch/arm/boot/dts/tegra30-apalis.dtsi +10 -0
+
+		simple-audio-card,cpu {
+			bitclock-master;
+			clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
+				 <&tegra_car TEGRA30_CLK_PLL_A_OUT0>;
+			frame-master;
+			master-clkdir-out;
+			sound-dai = <&tegra_i2s2>;
+		};
+	};

I'm not sure how this can work. Certainly all 3 clocks that are required for audio are mentioned here. However, the PLL_A clock (which then trickles down to the other 2) needs to have its rate changed based on whether the sample rate is 44.1KHz- or 48KHz-based. Semantically, this can't be something that "simple-audio-card" can imply, since "simple-audio-card" is something agnostic to any HW, whereas this clocking requirement is something specific to Tegra HW.

To see the problem, try encoding some audio stream as both 44.1KHz and 48KHz, then play a few seconds of each and keep switching back and forth. You'll likely find either the playback pitch is wrong, or you get drop-outs or stuttering.

I also wonder how "simple-audio-card" can know what rate the EXTERN1 clock to the CODEC should be set to; each CODEC has a different requirement for the minimum clock input and the Fs multiple usually varies for different sample rates. See for example sound/soc/tegra/tegra_wm8903.c:tegra_wm8903_hw_params(). This could be a solved problem though: Perhaps some API has been added to CODECs to report this information (or perhaps CODEC drivers now clk_set_rate() on their input clocks themselves) since I last looked.

#3 lore raw

Re: [PATCH v2 1/2] ARM: tegra: apalis/colibri t30: integrate audio support

Quoted 2 lines · Stephen Warren

No, definitely not; this patch has significant semantic changes since I reviewed it.

OK, sorry. Admittedly this was probably a little bit too quick a shot. The solution looked so clean and on first sight worked just fine.

Quoted 7 lines

I'm not sure how this can work. Certainly all 3 clocks that are required for audio are mentioned here. However, the PLL_A clock (which then trickles down to the other 2) needs to have its rate changed based on whether the sample rate is 44.1KHz- or 48KHz-based. Semantically, this can't be something that "simple-audio-card" can imply, since "simple-audio-card" is something agnostic to any HW, whereas this clocking requirement is something specific to Tegra HW.

Yes, now as you mention it I forgot about the whole tegra_asoc_utils_set_rate() stuff!

Quoted 4 lines

To see the problem, try encoding some audio stream as both 44.1KHz and 48KHz, then play a few seconds of each and keep switching back and forth. You'll likely find either the playback pitch is wrong, or you get drop-outs or stuttering.

Yeah, right. Clocks seem to be stuck at the 44.1 kHz setting.

Quoted 8 lines

I also wonder how "simple-audio-card" can know what rate the EXTERN1 clock to the CODEC should be set to; each CODEC has a different requirement for the minimum clock input and the Fs multiple usually varies for different sample rates. See for example sound/soc/tegra/tegra_wm8903.c:tegra_wm8903_hw_params(). This could be a solved problem though: Perhaps some API has been added to CODECs to report this information (or perhaps CODEC drivers now clk_set_rate() on their input clocks themselves) since I last looked.

If there are no objections I will just revive version 1 again and send it around as a new version 3 just to prevent any further confusion.

#4 lore raw

PATCH v2 2/2 ARM: tegra: enable sgtl5000 audio

In reply to Marcel Ziswiler

The NVIDIA Tegra 3 based Apalis T30 and Colibri T30 modules contain a Freescale SGTL5000 analogue audio codec.

---
Changes in v2:
- Using simple-audio-card as suggested by Fabio.

 arch/arm/configs/tegra_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/tegra_defconfig +2 -0
index 77d6e94..568b6a9 100644
@@ -210,6 +210,8 @@ CONFIG_SND_SOC_TEGRA_WM8903=y
 CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
 CONFIG_SND_SOC_TEGRA_ALC5632=y
 CONFIG_SND_SOC_TEGRA_MAX98090=y
+CONFIG_SND_SOC_SGTL5000=y
+CONFIG_SND_SIMPLE_CARD=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y
Signature · 6 lines
1.9.3

--
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