Skip to contentSkip to conversation

ARM: sunxi: Add SPDIF playback support

PATCH New codekipper at gmail.com 3 participants 12 messages Mar 21, 2016 – Mar 24, 2016

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

v3 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 v2:
- Split the patches up, added and removed some newlines, removed unused spdif pins

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

Marcus Cooper (8):
ARM: dts :sunxi: Add SPDIF TX pin to the A10
ARM: dts :sun7i: Add SPDIF TX pin to the A20
ARM: dts: sun4i: Add the SPDIF clk to the A10
ARM: dts: sun7i: Add the SPDIF clk to the A20
ARM: dts: sun4i: Add the SPDIF block to the A10
ARM: dts: sun7i: Add the SPDIF block to the A20
ARM: dts: sun4i: Add SPDIF to the Mele A1000
ARM: dts: sun7i: Add SPDIF to the Itead Ibox

 arch/arm/boot/dts/sun4i-a10-a1000.dts      | 24 +++++++++++++++++++++++
 arch/arm/boot/dts/sun4i-a10.dtsi           | 31 ++++++++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-itead-ibox.dts | 24 +++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi           | 31 ++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/8 ARM: dts :sunxi: Add SPDIF TX pin to the A10

From: Marcus Cooper <[email protected]>

Add the SPDIF TX pin to the A10 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +7 -0
index 2c8f5e6..62fcef9 100644
@@ -1006,6 +1006,13 @@
 				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>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 2/8 ARM: dts :sun7i: Add SPDIF TX pin to the A20

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF TX pin to the A20 dtsi.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
index 0940a78..0c207d0 100644
@@ -1193,6 +1193,13 @@
 				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>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.4
#3 lore raw

PATCH v3 2/8 ARM: dts :sun7i: Add SPDIF TX pin to the A20

Quoted 1 line · On Tue, Mar 22, 2016 at 4:01 AM, <[email protected]> wrote:

From: Marcus Cooper <[email protected]>

nit: space should be after colon, not after dts, in subject. Same for the RX pin patch.

ChenYu

Quoted 32 lines

Add the SPDIF TX pin to the A20 dtsi.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +7 -1
index 0940a78..0c207d0 100644
@@ -1193,6 +1193,13 @@
                                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>;
+                       };
                };
 
                timer at 01c20c00 {
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. For more options, visit https://groups.google.com/d/optout.

#4 lore raw

PATCH v3 2/8 ARM: dts :sun7i: Add SPDIF TX pin to the A20

Quoted 5 lines · Chen-Yu Tsai
Quoted 1 line · On Tue, Mar 22, 2016 at 4:01 AM, <[email protected]> wrote:

From: Marcus Cooper <[email protected]>

nit: space should be after colon, not after dts, in subject. Same for the RX pin patch.

I just fixed it.

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/20160324/0daa211b/attachment-0001.sig>
#5 lore raw

PATCH v3 3/8 ARM: dts: sun4i: Add the SPDIF clk to the A10

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF clock to the A10 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +11 -0
index 62fcef9..5747522 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>;
Signature · 1 line
2.7.4
#6 lore raw

PATCH v3 4/8 ARM: dts: sun7i: Add the SPDIF clk to the A20

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF clock to the A20 dtsi.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +11 -0
index 0c207d0..108cad4 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";
Signature · 1 line
2.7.4
#7 lore raw

PATCH v3 5/8 ARM: dts: sun4i: Add the SPDIF block to the A10

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF transceiver controller block to the A10 dtsi.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +13 -0
index 5747522..7171a27 100644
@@ -1052,6 +1052,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>;
Signature · 1 line
2.7.4
#8 lore raw

PATCH v3 6/8 ARM: dts: sun7i: Add the SPDIF block to the A20

In reply to codekipper at gmail.com

From: Marcus Cooper <[email protected]>

Add the SPDIF transceiver controller block to the A20 dtsi.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +13 -0
index 108cad4..9944496 100644
@@ -1244,6 +1244,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
#9 lore raw

PATCH v3 7/8 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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun4i-a10-a1000.dts +24 -0
index 97570cb..c92a1ae 100644
@@ -87,6 +87,24 @@
 		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 +206,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
#10 lore raw

PATCH v3 8/8 ARM: dts: sun7i: Add SPDIF to the 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..9542865 100644
@@ -65,6 +65,24 @@
 			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 +149,12 @@
 	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
#11 lore raw

v3 cover ARM: sunxi: Add SPDIF playback support

In reply to codekipper at gmail.com
Quoted 7 lines · codekipper at gmail.com

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.

I applied everything. The last commit wasn't applying properly, please check when I'll push the branch that I applied it properly.

(Also, try to base your patches on top of my sunxi/for-next branch)

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/20160322/91f13040/attachment-0001.sig>