Skip to contentSkip to conversation

ARM: dts: sun8i-h3: orange-pi-2: Enable audio codec

PATCH New codekipper at gmail.com 2 participants 2 messages Feb 20, 2017

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

PATCH 1/1 ARM: dts: sun8i-h3: orange-pi-2: Enable audio codec

From: Marcus Cooper <[email protected]>

The Orange Pi 2 routes the LINEOUT pins through a SGM8900 PA which needs to be enabled. The onboard microphone is routed to MIC1, with MBIAS providing power.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-2.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-2.dts +15 -0
index 047e9e1c6093..b0d2b99990cc 100644
@@ -105,6 +105,16 @@
 	};
 };
 
+&codec {
+	pinctrl-0 = <&codec_pa_pin>;
+	allwinner,pa-gpios = <&pio 0 16 GPIO_ACTIVE_HIGH>; /* PA16 */
+	allwinner,audio-routing =
+		"Speaker", "LINEOUT",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
+
 &ehci1 {
 	status = "okay";
 };
@@ -144,6 +154,11 @@
 };
 
 &pio {
+	codec_pa_pin: codec_pa_pin at 0 {
+		pins = "PA16";
+		function = "gpio_out";
+	};
+
 	leds_opc: led_pins at 0 {
 		pins = "PA15";
 		function = "gpio_out";
Signature · 1 line
2.11.1
#1 lore raw

PATCH 1/1 ARM: dts: sun8i-h3: orange-pi-2: Enable audio codec

Quoted 33 lines · codekipper at gmail.com

From: Marcus Cooper <[email protected]>

The Orange Pi 2 routes the LINEOUT pins through a SGM8900 PA which needs to be enabled. The onboard microphone is routed to MIC1, with MBIAS providing power.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-2.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-2.dts +10 -0
index 047e9e1c6093..b0d2b99990cc 100644
@@ -105,6 +105,16 @@
 	};
 };
 
+&codec {
+	pinctrl-0 = <&codec_pa_pin>;
+	allwinner,pa-gpios = <&pio 0 16 GPIO_ACTIVE_HIGH>; /* PA16 */
+	allwinner,audio-routing =
+		"Speaker", "LINEOUT",
+		"MIC1", "Mic",
+		"Mic",  "MBIAS";
+	status = "okay";
+};
+
 &ehci1 {
 	status = "okay";
 };

arch/arm/boot/dts/sun8i-h3-orangepi-2.dts line 161

Quoted 8 lines
arch/arm/boot/dts/sun8i-h3-orangepi-2.dts +5 -0
@@ -144,6 +154,11 @@
 };
 
 &pio {
+	codec_pa_pin: codec_pa_pin at 0 {
+		pins = "PA16";
+		function = "gpio_out";
+	};
+

There should not be underscores in node names. See e.g.:
https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1122967.html
https://www.mail-archive.com/linux-kernel%40vger.kernel.org/msg1145633.html
https://www.mail-archive.com/netdev%40vger.kernel.org/msg90319.html

Pinmux nodes for GPIO usage are considered unnecessary or even harmful these days, so you should just drop the node in this case (as well as the reference to it). As a bonus, you avoid a duplicate definition.

Signature · 1 line
Rask Ingemann Lambertsen