From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Wed, 27 Nov 2024 19:06:49 +0100
Subject: rk3308: fixes for rock pi s dts

---
 arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 73 ++++++++++
 1 file changed, 73 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
@@ -48,6 +48,54 @@ blue-led {
 		};
 	};
 
+	analog_sound: analog-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,name = "analog";
+		simple-audio-card,mclk-fs = <256>;
+		simple-audio-card,codec-hp-det;
+		simple-audio-card,widgets =
+			"Headphone", "Headphones";
+
+		simple-audio-card,dai-link@1 {
+			format = "i2s";
+
+			cpu {
+				sound-dai = <&i2s_8ch_2>;
+			};
+
+			codec {
+				sound-dai = <&codec>;
+			};
+
+		};
+
+	};
+
+	pcm5102_sound: pcm5102-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,mclk-fs = <256>;
+		simple-audio-card,name = "pcm5102a";
+
+		simple-audio-card,dai-link@1 {
+			format = "i2s";
+			cpu {
+				sound-dai = <&i2s_8ch_0>;
+			};
+
+			codec {
+				sound-dai = <&pcm5102a>;
+			};
+		};
+	};
+
+	pcm5102a: pcm5102a {
+			#sound-dai-cells = <0>;
+			compatible = "ti,pcm5102a";
+			pcm510x,format = "i2s";
+	};
+
 	sdio_pwrseq: sdio-pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		pinctrl-0 = <&wifi_enable_h>;
@@ -128,6 +176,11 @@ vdd_log: regulator-vdd-log {
 	};
 };
 
+&codec {
+	status = "okay";
+	#sound-dai-cells = <0>;
+};
+
 &cpu0 {
 	cpu-supply = <&vdd_core>;
 };
@@ -242,6 +295,19 @@ &io_domains {
 	status = "okay";
 };
 
+&i2s_8ch_0 {
+	#sound-dai-cells = <0>;
+	assigned-clocks = <&cru SCLK_I2S0_8CH_RX>;
+	assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>;
+	rockchip,clk-trcm = <1>;
+	status = "okay";
+};
+
+&i2s_8ch_2 {
+	#sound-dai-cells = <0>;
+	status = "okay";
+};
+
 &pinctrl {
 	pinctrl-names = "default";
 	pinctrl-0 = <&rtc_32k>;
@@ -333,10 +399,17 @@ &sdmmc {
 	cap-mmc-highspeed;
 	cap-sd-highspeed;
 	disable-wp;
+	card-detect-delay = <200>;
 	vmmc-supply = <&vcc_io>;
 	status = "okay";
 };
 
+&tsadc {
+	rockchip,hw-tshut-mode = <0>;		/* 0:CRU */
+	rockchip,hw-tshut-polarity = <1>;	/* 1:HIGH */
+	status = "okay";
+};
+
 &u2phy {
 	status = "okay";
 
-- 
Armbian

