From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: The-going <48602507+The-going@users.noreply.github.com>
Date: Tue, 25 Jan 2022 21:18:21 +0300
Subject: arm:dts: sun8i-r40 bananapi-m2-ultra add codec analog

---
 arch/arm/boot/dts/allwinner/sun8i-r40-bananapi-m2-ultra.dts | 10 ++++++
 arch/arm/boot/dts/allwinner/sun8i-r40.dtsi                  | 18 ++++++++++
 2 files changed, 28 insertions(+)

diff --git a/arch/arm/boot/dts/allwinner/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/allwinner/sun8i-r40-bananapi-m2-ultra.dts
index 111111111111..222222222222 100644
--- a/arch/arm/boot/dts/allwinner/sun8i-r40-bananapi-m2-ultra.dts
+++ b/arch/arm/boot/dts/allwinner/sun8i-r40-bananapi-m2-ultra.dts
@@ -118,6 +118,16 @@ &cpu0 {
 	cpu-supply = <&reg_dcdc2>;
 };
 
+&codec {
+	allwinner,audio-routing =
+		"Headphone", "HP",
+		"Headphone", "HPCOM",
+		"MIC1", "Mic",
+		"Mic", "MBIAS";
+	allwinner,codec-analog-controls = <&codec_analog>;
+	status = "okay";
+};
+
 &de {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi b/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
index 111111111111..222222222222 100644
--- a/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/allwinner/sun8i-r40.dtsi
@@ -839,6 +839,24 @@ i2s2: i2s@1c22800 {
 			dma-names = "rx", "tx";
 		};
 
+		codec: codec@1c22c00 {
+			#sound-dai-cells = <1>;
+			compatible = "allwinner,sun8i-h3-codec";
+			reg = <0x01c22c00 0x300>;
+			interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_CODEC>;
+			clock-names = "apb", "codec";
+			resets = <&ccu RST_BUS_CODEC>;
+			dmas = <&dma 19>, <&dma 19>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
+		codec_analog: codec-analog@1c22f00 {
+			compatible = "allwinner,sun8i-a23-codec-analog";
+			reg = <0x01c22f00 0x4>;
+		};
+
 		ths: thermal-sensor@1c24c00 {
 			compatible = "allwinner,sun8i-r40-ths";
 			reg = <0x01c24c00 0x100>;
-- 
Armbian

