Skip to contentSkip to conversation

ARM: sunxi: Add SPDIF playback support

PATCH Superseded codekipper at gmail.com 2 participants 10 messages Mar 21, 2016

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ARM: sunxi: Add SPDIF playback support

From: Marcus Cooper <[email protected]>

Hi All,

now that the sun4i-spdif driver has made it into linux-next then this patch series completes what is needed to have SPDIF working on both A10 and A20 devices.

Enjoy,
CK

---
Changes since v1:
- Added defines to the dma properties and changed reg length to cover the entire spdif memory area.

Andrea Venturi (1):
clk: sunxi: mod1 clock should modify it's parent

Marcus Cooper (4):
ARM: dts :sunxi: Add SPDIF pins to A10 and A20
ARM: dts: sunxi: Add the SPDIF to the A10 and A20
ARM: dts: sun4i: Add SPDIF to the Mele A1000
ARM: dts: sun7i: Add SPDIF to Itead Ibox

 arch/arm/boot/dts/sun4i-a10-a1000.dts      | 23 +++++++++++++++
 arch/arm/boot/dts/sun4i-a10.dtsi           | 45 ++++++++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 24 ++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi           | 45 ++++++++++++++++++++++++++++++
 drivers/clk/sunxi/clk-a10-mod1.c           |  2 +-
 5 files changed, 138 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/5 clk: sunxi: mod1 clock should modify it's parent

From: Andrea Venturi <[email protected]>

add CLK_SET_RATE_PARENT to modify the rate on clk upstream

---
 drivers/clk/sunxi/clk-a10-mod1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi/clk-a10-mod1.c +1 -1
index e9d870d..e2819fa 100644
@@ -62,7 +62,7 @@ static void __init sun4i_mod1_clk_setup(struct device_node *node)
 	clk = clk_register_composite(NULL, clk_name, parents, i,
 				     &mux->hw, &clk_mux_ops,
 				     NULL, NULL,
-				     &gate->hw, &clk_gate_ops, 0);
+				     &gate->hw, &clk_gate_ops, CLK_SET_RATE_PARENT);
 	if (IS_ERR(clk))
 		goto err_free_gate;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/5 clk: sunxi: mod1 clock should modify it's parent

Quoted 5 lines · codekipper at gmail.com

From: Andrea Venturi <[email protected]>

add CLK_SET_RATE_PARENT to modify the rate on clk upstream

Applied, thanks

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160321/2ef8404e/attachment.sig>
#3 lore raw

PATCH v2 2/5 ARM: dts :sunxi: Add SPDIF pins to A10 and A20

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF pins to the A10 and A20 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 21 +++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi | 21 +++++++++++++++++++++
 2 files changed, 42 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +21 -0
index 2c8f5e6..0483640 100644
@@ -1006,6 +1006,27 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
+
+			spdif_tx_pins_a: spdif at 0 {
+				allwinner,pins = "PB13";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+			};
+
+			spdif_rx_pins_a: spdif at 1 {
+				allwinner,pins = "PB12";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			spdif_mclk_pins_a: spdif at 2 {
+				allwinner,pins = "PB3";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		timer at 01c20c00 {
arch/arm/boot/dts/sun7i-a20.dtsi +21 -0
index 0940a78..7264d5e 100644
@@ -1193,6 +1193,27 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
+
+			spdif_tx_pins_a: spdif at 0 {
+				allwinner,pins = "PB13";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+			};
+
+			spdif_rx_pins_a: spdif at 1 {
+				allwinner,pins = "PB12";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			spdif_mclk_pins_a: spdif at 2 {
+				allwinner,pins = "PB3";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 2/5 ARM: dts :sunxi: Add SPDIF pins to A10 and A20

Quoted 29 lines · codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF pins to the A10 and A20 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 21 +++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi | 21 +++++++++++++++++++++
 2 files changed, 42 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +11 -0
index 2c8f5e6..0483640 100644
@@ -1006,6 +1006,27 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
+
+			spdif_tx_pins_a: spdif at 0 {
+				allwinner,pins = "PB13";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+			};
+
+			spdif_rx_pins_a: spdif at 1 {
+				allwinner,pins = "PB12";
+				allwinner,function = "spdif";

arch/arm/boot/dts/sun4i-a10.dtsi line 1029

Quoted 10 lines
arch/arm/boot/dts/sun4i-a10.dtsi +10 -0
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			spdif_mclk_pins_a: spdif at 2 {
+				allwinner,pins = "PB3";
+				allwinner,function = "spdif";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};

If you're not going to use these pins, please don't add them yet.

In order to avoid bloating the DT uselessly, we try to not add unused nodes.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160321/c80d97de/attachment.sig>
#5 lore raw

PATCH v2 3/5 ARM: dts: sunxi: Add the SPDIF to the A10 and A20

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF transceiver controller and clock to the A10 and A20 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 24 ++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi | 24 ++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +24 -0
index 0483640..be5f2b2 100644
@@ -477,6 +477,17 @@
 			clock-output-names = "ir1";
 		};
 
+		spdif_clk: clk at 01c200c0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod1-clk";
+			reg = <0x01c200c0 0x4>;
+			clocks = <&pll2 SUN4I_A10_PLL2_8X>,
+				 <&pll2 SUN4I_A10_PLL2_4X>,
+				 <&pll2 SUN4I_A10_PLL2_2X>,
+				 <&pll2 SUN4I_A10_PLL2_1X>;
+			clock-output-names = "spdif";
+		};
+
 		usb_clk: clk at 01c200cc {
 			#clock-cells = <1>;
 			#reset-cells = <1>;
@@ -1055,6 +1066,19 @@
 			status = "disabled";
 		};
 
+		spdif: spdif at 01c21000 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun4i-a10-spdif";
+			reg = <0x01c21000 0x400>;
+			interrupts = <13>;
+			clocks = <&apb0_gates 1>, <&spdif_clk>;
+			clock-names = "apb", "spdif";
+			dmas = <&dma SUN4I_DMA_NORMAL 2>,
+			       <&dma SUN4I_DMA_NORMAL 2>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
 		ir0: ir at 01c21800 {
 			compatible = "allwinner,sun4i-a10-ir";
 			clocks = <&apb0_gates 6>, <&ir0_clk>;
arch/arm/boot/dts/sun7i-a20.dtsi +24 -0
index 7264d5e..ebce332 100644
@@ -476,6 +476,17 @@
 			clock-output-names = "ir1";
 		};
 
+		spdif_clk: clk at 01c200c0 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-mod1-clk";
+			reg = <0x01c200c0 0x4>;
+			clocks = <&pll2 SUN4I_A10_PLL2_8X>,
+				 <&pll2 SUN4I_A10_PLL2_4X>,
+				 <&pll2 SUN4I_A10_PLL2_2X>,
+				 <&pll2 SUN4I_A10_PLL2_1X>;
+			clock-output-names = "spdif";
+		};
+
 		keypad_clk: clk at 01c200c4 {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
@@ -1247,6 +1258,19 @@
 			status = "disabled";
 		};
 
+		spdif: spdif at 01c21000 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun4i-a10-spdif";
+			reg = <0x01c21000 0x400>;
+			interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&apb0_gates 1>, <&spdif_clk>;
+			clock-names = "apb", "spdif";
+			dmas = <&dma SUN4I_DMA_NORMAL 2>,
+			       <&dma SUN4I_DMA_NORMAL 2>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
 		ir0: ir at 01c21800 {
 			compatible = "allwinner,sun4i-a10-ir";
 			clocks = <&apb0_gates 6>, <&ir0_clk>;
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 3/5 ARM: dts: sunxi: Add the SPDIF to the A10 and A20

Quoted 10 lines · codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF transceiver controller and clock to the A10 and A20 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 24 ++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi | 24 ++++++++++++++++++++++++

Sorry, I missed that earlier, but please make separate patches for those two DTS.

It also applies for the other patches.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160321/cbbe10ed/attachment.sig>
#7 lore raw

PATCH v2 4/5 ARM: dts: sun4i: Add SPDIF to the Mele A1000

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Enable the S/PDIF transmitter that is present on the A1000.

---
 arch/arm/boot/dts/sun4i-a10-a1000.dts | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/boot/dts/sun4i-a10-a1000.dts +23 -0
index 97570cb..aaf5605 100644
@@ -87,6 +87,23 @@
 		enable-active-high;
 		gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>;
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "On-board SPDIF";
+		simple-audio-card,cpu {
+			sound-dai = <&spdif>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&spdif_out>;
+		};
+	};
+
+	spdif_out: spdif-out {
+		#sound-dai-cells = <0>;
+		compatible = "linux,spdif-dit";
+	};
 };
 
 &ahci {
@@ -188,6 +205,12 @@
 	status = "okay";
 };
 
+&spdif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spdif_tx_pins_a>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
Signature · 1 line
2.7.4
#8 lore raw

PATCH v2 4/5 ARM: dts: sun4i: Add SPDIF to the Mele A1000

Quoted 14 lines · codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Enable the S/PDIF transmitter that is present on the A1000.

---
 arch/arm/boot/dts/sun4i-a10-a1000.dts | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/boot/dts/sun4i-a10-a1000.dts +0 -0
index 97570cb..aaf5605 100644

arch/arm/boot/dts/sun4i-a10-a1000.dts line 93

Quoted 7 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +4 -0
@@ -87,6 +87,23 @@
 		enable-active-high;
 		gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>;
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "On-board SPDIF";

Please add a newline here.

Quoted 32 lines
arch/arm/boot/dts/sun4i-a10-a1000.dts +19 -0
+		simple-audio-card,cpu {
+			sound-dai = <&spdif>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&spdif_out>;
+		};
+	};
+
+	spdif_out: spdif-out {
+		#sound-dai-cells = <0>;
+		compatible = "linux,spdif-dit";
+	};
 };
 
 &ahci {
@@ -188,6 +205,12 @@
 	status = "okay";
 };
 
+&spdif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spdif_tx_pins_a>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
Signature · 1 line
2.7.4

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160321/b3e213c5/attachment.sig>
#9 lore raw

PATCH v2 5/5 ARM: dts: sun7i: Add SPDIF to Itead Ibox

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Enable the S/PDIF transmitter that is present on the Itead Ibox.

---
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun7i-a20-itead-ibox.dts +24 -0
index a512581..df76b74 100644
@@ -65,6 +65,23 @@
 			default-state = "on";
 		};
 	};
+
+	sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "On-board SPDIF";
+		simple-audio-card,cpu {
+			sound-dai = <&spdif>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&spdif_out>;
+		};
+	};
+
+	spdif_out: spdif-out {
+		#sound-dai-cells = <0>;
+		compatible = "linux,spdif-dit";
+	};
 };
 
 &ahci {
@@ -131,6 +148,13 @@
 	status = "okay";
 };
 
+
+&spdif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spdif_tx_pins_a>;
+	status = "okay";
+};
+
 &usbphy {
 	pinctrl-names = "default";
 	pinctrl-0 = <&usb0_id_detect_pin>;
Signature · 1 line
2.7.4