Newer
Older
buildroot-MynaPlayer / board / myna-player-odyssey / rootfs_patches / linux / 0007-stm32mp157c-odyssey-Add-sound.patch
From 8d232827731c93e8a013e45185b52381e57cf2ad Mon Sep 17 00:00:00 2001
From: Jookia <contact@jookia.org>
Date: Wed, 12 Aug 2020 00:34:17 +1000
Subject: [PATCH 7/7] stm32mp157c-odyssey: Add sound

---
 arch/arm/boot/dts/stm32mp157c-odyssey.dts | 89 +++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/arch/arm/boot/dts/stm32mp157c-odyssey.dts b/arch/arm/boot/dts/stm32mp157c-odyssey.dts
index 787c001fadef..41392245b09c 100644
--- a/arch/arm/boot/dts/stm32mp157c-odyssey.dts
+++ b/arch/arm/boot/dts/stm32mp157c-odyssey.dts
@@ -26,6 +26,16 @@
 		reset-gpios = <&gpiod 9 GPIO_ACTIVE_LOW>;
 		post-power-on-delay-ms = <1>;
 	};
+
+	sound {
+		compatible = "audio-graph-card";
+		routing =
+			"Playback" , "MCLK",
+			"Capture" , "MCLK",
+			"LINPUT1" , "MICB";
+		dais = <&sai2a_port &sai2b_port>;
+		status = "okay";
+	};
 };
 
 &ethernet0 {
@@ -63,6 +73,85 @@
 	status = "okay";
 	/delete-property/dmas;
 	/delete-property/dma-names;
+
+	wm8960: wm8960@1a {
+		compatible = "wlf,wm8960";
+		reg = <0x1a>;
+		#sound-dai-cells = <0>;
+		VL-supply = <&v3v3>;
+		VD-supply = <&v1v8_audio>;
+		VA-supply = <&v1v8_audio>;
+		VAHP-supply = <&v1v8_audio>;
+		reset-gpios = <&gpiog 9 GPIO_ACTIVE_LOW>;
+		clocks = <&sai2a>;
+		clock-names = "MCLK";
+		status = "okay";
+		wlf,shared-lrclk;
+
+		wm8960_port: port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			wm8960_tx_endpoint: endpoint@0 {
+				reg = <0>;
+				remote-endpoint = <&sai2a_endpoint>;
+				frame-master;
+				bitclock-master;
+			};
+
+			wm8960_rx_endpoint: endpoint@1 {
+				reg = <1>;
+				remote-endpoint = <&sai2b_endpoint>;
+				frame-master;
+				bitclock-master;
+			};
+		};
+	};
+};
+
+&sai2 {
+	clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
+	clock-names = "pclk", "x8k", "x11k";
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&sai2a_pins_b &sai2b_pins_b>;
+	pinctrl-1 = <&sai2a_sleep_pins_b &sai2b_sleep_pins_b>;
+	status = "okay";
+
+	sai2a: audio-controller@4400b004 {
+		#clock-cells = <0>;
+		dma-names = "tx";
+		clocks = <&rcc SAI2_K>;
+		clock-names = "sai_ck";
+		status = "okay";
+
+		sai2a_port: port {
+			sai2a_endpoint: endpoint {
+				remote-endpoint = <&wm8960_tx_endpoint>;
+				format = "i2s";
+				mclk-fs = <256>;
+				dai-tdm-slot-num = <2>;
+				dai-tdm-slot-width = <0>;
+			};
+		};
+	};
+
+	sai2b: audio-controller@4400b024 {
+		dma-names = "rx";
+		st,sync = <&sai2a 2>;
+		clocks = <&rcc SAI2_K>, <&sai2a>;
+		clock-names = "sai_ck", "MCLK";
+		status = "okay";
+
+		sai2b_port: port {
+			sai2b_endpoint: endpoint {
+				remote-endpoint = <&wm8960_rx_endpoint>;
+				format = "i2s";
+				mclk-fs = <256>;
+				dai-tdm-slot-num = <2>;
+				dai-tdm-slot-width = <0>;
+			};
+		};
+	};
 };
 
 &sdmmc1 {
-- 
2.20.1