<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 197d4096c697bcde8f9833b1d04b17eb2b232b85 Mon Sep 17 00:00:00 2001
From: Samuel Holland &lt;samuel@sholland.org&gt;
Date: Mon, 31 Oct 2022 22:59:00 -0500
Subject: [PATCH 88/90] sunxi: riscv: Copy in WIP version of devicetrees

While the bindings still are not stable, this should help things work
out of the box.

Signed-off-by: Samuel Holland &lt;samuel@sholland.org&gt;
---
 .../riscv/dts/sun20i-d1-clockworkpi-v3.14.dts | 134 +++++++-
 .../dts/sun20i-d1-common-regulators.dtsi      |  13 +
 arch/riscv/dts/sun20i-d1-devterm-v3.14.dts    |  16 +
 .../dts/sun20i-d1-dongshan-nezha-stu.dts      |  48 ++-
 .../dts/sun20i-d1-lichee-rv-86-panel-480p.dts |  51 +++
 .../dts/sun20i-d1-lichee-rv-86-panel.dtsi     |  64 ++++
 arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts   |  98 ++++++
 arch/riscv/dts/sun20i-d1-lichee-rv.dts        |   6 +
 arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts   |  41 +++
 arch/riscv/dts/sun20i-d1-nezha.dts            | 117 ++++++-
 arch/riscv/dts/sun20i-d1.dtsi                 | 314 +++++++++++++++++-
 11 files changed, 881 insertions(+), 21 deletions(-)

--- a/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts
+++ b/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts
@@ -22,16 +22,78 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	audio_amplifier: audio-amplifier {
+		compatible = "simple-audio-amplifier";
+		enable-gpios = &lt;&amp;pio 4 1 GPIO_ACTIVE_HIGH&gt;; /* PE1/GPIO11 */
+		sound-name-prefix = "Amplifier";
+		VCC-supply = &lt;&amp;reg_vcc&gt;;
+	};
+
+	/*
+	 * FIXME: This is not really an amplifier, but the amplifier binding
+	 * has the needed properties and behavior.
+	 */
+	audio_switch: audio-switch {
+		compatible = "simple-audio-amplifier";
+		enable-gpios = &lt;&amp;pio 1 2 GPIO_ACTIVE_HIGH&gt;; /* PB2/AUD_SWITCH */
+		sound-name-prefix = "Switch";
+		VCC-supply = &lt;&amp;reg_aldo1&gt;;
+	};
+
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		power-supply = &lt;&amp;reg_vcc&gt;;
+		pwms = &lt;&amp;pwm 4 50000 0&gt;; /* PD20/GPIO9 */
+	};
+
+	bt_sco_codec: bt-sco-codec {
+		#sound-dai-cells = &lt;0&gt;;
+		compatible = "linux,bt-sco";
+	};
+
+	bt-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "Bluetooth";
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+
+		simple-audio-card,dai-link@0 {
+			format = "dsp_a";
+			frame-master = &lt;&amp;bt_sound_cpu&gt;;
+			bitclock-master = &lt;&amp;bt_sound_cpu&gt;;
+
+			bt_sound_cpu: cpu {
+				sound-dai = &lt;&amp;i2s1&gt;;
+			};
+
+			codec {
+				sound-dai = &lt;&amp;bt_sco_codec&gt;;
+			};
+		};
+	};
+
+	hdmi_connector: connector {
+		compatible = "hdmi-connector";
+		type = "d";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = &lt;&amp;hdmi_out_connector&gt;;
+			};
+		};
+	};
+
 	/*
 	 * This regulator is PWM-controlled, but the PWM controller is not
 	 * yet supported, so fix the regulator to its default voltage.
 	 */
 	reg_vdd_cpu: vdd-cpu {
-		compatible = "regulator-fixed";
+		compatible = "pwm-regulator";
+		pwms = &lt;&amp;pwm 0 50000 0&gt;;
+		pwm-supply = &lt;&amp;reg_vcc&gt;;
 		regulator-name = "vdd-cpu";
-		regulator-min-microvolt = &lt;1100000&gt;;
-		regulator-max-microvolt = &lt;1100000&gt;;
-		vin-supply = &lt;&amp;reg_vcc&gt;;
+		regulator-min-microvolt = &lt;810000&gt;;
+		regulator-max-microvolt = &lt;1160000&gt;;
 	};
 
 	wifi_pwrseq: wifi-pwrseq {
@@ -40,14 +102,51 @@
 	};
 };
 
+&amp;codec {
+	aux-devs = &lt;&amp;audio_amplifier&gt;, &lt;&amp;audio_switch&gt;;
+	hp-det-gpio = &lt;&amp;pio 1 12 GPIO_ACTIVE_HIGH&gt;; /* PB12/GPIO10 */
+	pin-switches = "Internal Speakers";
+	routing = "Internal Speakers", "Amplifier OUTL",
+		  "Internal Speakers", "Amplifier OUTR",
+		  "Amplifier INL", "Switch OUTL",
+		  "Amplifier INR", "Switch OUTR",
+		  "Headphone Jack", "Switch OUTL",
+		  "Headphone Jack", "Switch OUTR",
+		  "Switch INL", "HPOUTL",
+		  "Switch INR", "HPOUTR",
+		  "MICIN3", "Headset Microphone",
+		  "Headset Microphone", "HBIAS";
+	widgets = "Microphone", "Headset Microphone",
+		  "Headphone", "Headphone Jack",
+		  "Speaker", "Internal Speakers";
+};
+
 &amp;cpu0 {
 	cpu-supply = &lt;&amp;reg_vdd_cpu&gt;;
 };
 
+&amp;de {
+	status = "okay";
+};
+
 &amp;ehci1 {
 	status = "okay";
 };
 
+&amp;hdmi {
+	status = "okay";
+};
+
+&amp;hdmi_out {
+	hdmi_out_connector: endpoint {
+		remote-endpoint = &lt;&amp;hdmi_connector_in&gt;;
+	};
+};
+
+&amp;hdmi_phy {
+	status = "okay";
+};
+
 &amp;i2c0 {
 	pinctrl-0 = &lt;&amp;i2c0_pb10_pins&gt;;
 	pinctrl-names = "default";
@@ -169,6 +268,12 @@
 	};
 };
 
+&amp;i2s1 {
+	pinctrl-0 = &lt;&amp;i2s1_clk_pins&gt;, &lt;&amp;i2s1_din_pin&gt;, &lt;&amp;i2s1_dout_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;mmc0 {
 	broken-cd;
 	bus-width = &lt;4&gt;;
@@ -205,6 +310,27 @@
 
 &amp;pio {
 	vcc-pg-supply = &lt;&amp;reg_ldoa&gt;;
+
+	i2s1_clk_pins: i2s1-clk-pins {
+		pins = "PG12", "PG13";
+		function = "i2s1";
+	};
+
+	i2s1_din_pin: i2s1-din-pin {
+		pins = "PG14";
+		function = "i2s1_din";
+	};
+
+	i2s1_dout_pin: i2s1-dout-pin {
+		pins = "PG15";
+		function = "i2s1_dout";
+	};
+};
+
+&amp;pwm {
+	pinctrl-0 = &lt;&amp;pwm0_pd16_pin&gt;, &lt;&amp;pwm4_pd20_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
 };
 
 &amp;uart0 {
--- a/arch/riscv/dts/sun20i-d1-common-regulators.dtsi
+++ b/arch/riscv/dts/sun20i-d1-common-regulators.dtsi
@@ -18,6 +18,15 @@
 	};
 };
 
+&amp;codec {
+	avcc-supply = &lt;&amp;reg_aldo&gt;;
+	hpvcc-supply = &lt;&amp;reg_hpldo&gt;;
+};
+
+&amp;hdmi {
+	hvcc-supply = &lt;&amp;reg_ldoa&gt;;
+};
+
 &amp;lradc {
 	vref-supply = &lt;&amp;reg_aldo&gt;;
 };
@@ -49,3 +58,7 @@
 	regulator-max-microvolt = &lt;1800000&gt;;
 	ldo-in-supply = &lt;&amp;reg_vcc_3v3&gt;;
 };
+
+&amp;ths {
+	vref-supply = &lt;&amp;reg_aldo&gt;;
+};
--- a/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts
+++ b/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts
@@ -35,3 +35,19 @@
 		};
 	};
 };
+
+&amp;dsi {
+	pinctrl-0 = &lt;&amp;dsi_4lane_pins&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+
+	panel@0 {
+		compatible = "clockwork,cwd686";
+		reg = &lt;0&gt;;
+		backlight = &lt;&amp;backlight&gt;;
+		reset-gpios = &lt;&amp;pio 3 19 GPIO_ACTIVE_LOW&gt;; /* PD19/GPIO8 */
+		rotation = &lt;90&gt;;
+		iovcc-supply = &lt;&amp;reg_dcdc3&gt;;
+		vci-supply = &lt;&amp;reg_aldo2&gt;;
+	};
+};
--- a/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts
+++ b/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts
@@ -23,6 +23,17 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	hdmi_connector: connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = &lt;&amp;hdmi_out_connector&gt;;
+			};
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -43,16 +54,13 @@
 		vin-supply = &lt;&amp;reg_vcc&gt;;
 	};
 
-	/*
-	 * This regulator is PWM-controlled, but the PWM controller is not
-	 * yet supported, so fix the regulator to its default voltage.
-	 */
 	reg_vdd_cpu: vdd-cpu {
-		compatible = "regulator-fixed";
+		compatible = "pwm-regulator";
+		pwms = &lt;&amp;pwm 0 50000 0&gt;;
+		pwm-supply = &lt;&amp;reg_vcc&gt;;
 		regulator-name = "vdd-cpu";
-		regulator-min-microvolt = &lt;1100000&gt;;
-		regulator-max-microvolt = &lt;1100000&gt;;
-		vin-supply = &lt;&amp;reg_vcc&gt;;
+		regulator-min-microvolt = &lt;810000&gt;;
+		regulator-max-microvolt = &lt;1160000&gt;;
 	};
 };
 
@@ -60,6 +68,10 @@
 	cpu-supply = &lt;&amp;reg_vdd_cpu&gt;;
 };
 
+&amp;de {
+	status = "okay";
+};
+
 &amp;ehci0 {
 	status = "okay";
 };
@@ -73,6 +85,20 @@
 	status = "okay";
 };
 
+&amp;hdmi {
+	status = "okay";
+};
+
+&amp;hdmi_out {
+	hdmi_out_connector: endpoint {
+		remote-endpoint = &lt;&amp;hdmi_connector_in&gt;;
+	};
+};
+
+&amp;hdmi_phy {
+	status = "okay";
+};
+
 &amp;mdio {
 	ext_rgmii_phy: ethernet-phy@1 {
 		compatible = "ethernet-phy-ieee802.3-c22";
@@ -95,6 +121,12 @@
 	status = "okay";
 };
 
+&amp;pwm {
+	pinctrl-0 = &lt;&amp;pwm0_pd16_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;uart0 {
 	pinctrl-0 = &lt;&amp;uart0_pb8_pins&gt;;
 	pinctrl-names = "default";
--- a/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts
+++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts
@@ -7,6 +7,40 @@
 	model = "Sipeed Lichee RV 86 Panel (480p)";
 	compatible = "sipeed,lichee-rv-86-panel-480p", "sipeed,lichee-rv",
 		     "allwinner,sun20i-d1";
+
+	backlight: backlight {
+		compatible = "pwm-backlight";
+		power-supply = &lt;&amp;reg_vcc&gt;;
+		pwms = &lt;&amp;pwm 7 50000 0&gt;;
+	};
+
+	spi {
+		compatible = "spi-gpio";
+		cs-gpios = &lt;&amp;pio 4 14 GPIO_ACTIVE_LOW&gt;; /* PE14 */
+		mosi-gpios = &lt;&amp;pio 4 12 GPIO_ACTIVE_HIGH&gt;; /* PE12 */
+		sck-gpios = &lt;&amp;pio 4 15 GPIO_ACTIVE_HIGH&gt;; /* PE15 */
+		num-chipselects = &lt;1&gt;;
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+
+		panel@0 {
+			compatible = "sitronix,st7701s";
+			reg = &lt;0&gt;;
+			backlight = &lt;&amp;backlight&gt;;
+			reset-gpios = &lt;&amp;pio 6 13 GPIO_ACTIVE_LOW&gt;; /* PG13 */
+			spi-3wire;
+
+			port {
+				panel_in_tcon_lcd0: endpoint {
+					remote-endpoint = &lt;&amp;tcon_lcd0_out_panel&gt;;
+				};
+			};
+		};
+	};
+};
+
+&amp;de {
+	status = "okay";
 };
 
 &amp;i2c2 {
@@ -27,3 +61,20 @@
 		wakeup-source;
 	};
 };
+
+&amp;pwm {
+	pinctrl-0 = &lt;&amp;pwm7_pd22_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&amp;tcon_lcd0 {
+	pinctrl-0 = &lt;&amp;lcd_rgb666_pins&gt;;
+	pinctrl-names = "default";
+};
+
+&amp;tcon_lcd0_out {
+	tcon_lcd0_out_panel: endpoint {
+		remote-endpoint = &lt;&amp;panel_in_tcon_lcd0&gt;;
+	};
+};
--- a/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi
+++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi
@@ -9,6 +9,39 @@
 		ethernet1 = &amp;xr829;
 	};
 
+	audio_amplifier: audio-amplifier {
+		compatible = "simple-audio-amplifier";
+		enable-gpios = &lt;&amp;pio 1 10 GPIO_ACTIVE_HIGH&gt;; /* PB10 */
+		sound-name-prefix = "Amplifier";
+	};
+
+	dmic_codec: dmic-codec {
+		compatible = "dmic-codec";
+		num-channels = &lt;2&gt;;
+		#sound-dai-cells = &lt;0&gt;;
+	};
+
+	dmic-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "DMIC";
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+
+		simple-audio-card,dai-link@0 {
+			format = "pdm";
+			frame-master = &lt;&amp;link0_cpu&gt;;
+			bitclock-master = &lt;&amp;link0_cpu&gt;;
+
+			link0_cpu: cpu {
+				sound-dai = &lt;&amp;dmic&gt;;
+			};
+
+			link0_codec: codec {
+				sound-dai = &lt;&amp;dmic_codec&gt;;
+			};
+		};
+	};
+
 	/* PC1 is repurposed as BT_WAKE_AP */
 	/delete-node/ leds;
 
@@ -24,6 +57,27 @@
 	};
 };
 
+&amp;codec {
+	aux-devs = &lt;&amp;audio_amplifier&gt;;
+	routing = "Internal Speaker", "Amplifier OUTL",
+		  "Internal Speaker", "Amplifier OUTR",
+		  "Amplifier INL", "HPOUTL",
+		  "Amplifier INR", "HPOUTR",
+		  "LINEINL", "HPOUTL",
+		  "LINEINR", "HPOUTR",
+		  "MICIN3", "Internal Microphone",
+		  "Internal Microphone", "HBIAS";
+	widgets = "Microphone", "Internal Microphone",
+		  "Speaker", "Internal Speaker";
+	status = "okay";
+};
+
+&amp;dmic {
+	pinctrl-0 = &lt;&amp;dmic_pb11_d0_pin&gt;, &lt;&amp;dmic_pe17_clk_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;ehci1 {
 	status = "okay";
 };
@@ -69,6 +123,16 @@
 		pins = "PG11";
 		function = "clk";
 	};
+
+	dmic_pb11_d0_pin: dmic-pb11-d0-pin {
+		pins = "PB11";
+		function = "dmic";
+	};
+
+	dmic_pe17_clk_pin: dmic-pe17-clk-pin {
+		pins = "PE17";
+		function = "dmic";
+	};
 };
 
 &amp;uart1 {
--- a/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts
+++ b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts
@@ -15,16 +15,102 @@
 		ethernet1 = &amp;rtl8723ds;
 	};
 
+	dmic_codec: dmic-codec {
+		compatible = "dmic-codec";
+		num-channels = &lt;2&gt;;
+		#sound-dai-cells = &lt;0&gt;;
+	};
+
+	dmic-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,name = "DMIC";
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+
+		simple-audio-card,dai-link@0 {
+			format = "pdm";
+			frame-master = &lt;&amp;link0_cpu&gt;;
+			bitclock-master = &lt;&amp;link0_cpu&gt;;
+
+			link0_cpu: cpu {
+				sound-dai = &lt;&amp;dmic&gt;;
+			};
+
+			link0_codec: codec {
+				sound-dai = &lt;&amp;dmic_codec&gt;;
+			};
+		};
+	};
+
+	hdmi_connector: connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = &lt;&amp;hdmi_out_connector&gt;;
+			};
+		};
+	};
+
 	wifi_pwrseq: wifi-pwrseq {
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = &lt;&amp;pio 6 12 GPIO_ACTIVE_LOW&gt;; /* PG12 */
 	};
 };
 
+&amp;codec {
+	routing = "Internal Speaker", "HPOUTL",
+		  "Internal Speaker", "HPOUTR",
+		  "LINEINL", "HPOUTL",
+		  "LINEINR", "HPOUTR",
+		  "MICIN3", "Internal Microphone",
+		  "Internal Microphone", "HBIAS";
+	widgets = "Microphone", "Internal Microphone",
+		  "Speaker", "Internal Speaker";
+	status = "okay";
+};
+
+&amp;de {
+	status = "okay";
+};
+
+&amp;dmic {
+	pinctrl-0 = &lt;&amp;dmic_pb11_d0_pin&gt;, &lt;&amp;dmic_pe17_clk_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;ehci1 {
 	status = "okay";
 };
 
+&amp;hdmi {
+	status = "okay";
+};
+
+&amp;hdmi_out {
+	hdmi_out_connector: endpoint {
+		remote-endpoint = &lt;&amp;hdmi_connector_in&gt;;
+	};
+};
+
+&amp;hdmi_phy {
+	status = "okay";
+};
+
+&amp;ledc {
+	pinctrl-0 = &lt;&amp;ledc_pc0_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+
+	multi-led@0 {
+		reg = &lt;0x0&gt;;
+		color = &lt;LED_COLOR_ID_RGB&gt;;
+		function = LED_FUNCTION_STATUS;
+	};
+};
+
 &amp;lradc {
 	status = "okay";
 
@@ -55,6 +141,18 @@
 	status = "okay";
 };
 
+&amp;pio {
+	dmic_pb11_d0_pin: dmic-pb11-d0-pin {
+		pins = "PB11";
+		function = "dmic";
+	};
+
+	dmic_pe17_clk_pin: dmic-pe17-clk-pin {
+		pins = "PE17";
+		function = "dmic";
+	};
+};
+
 &amp;uart1 {
 	uart-has-rtscts;
 	pinctrl-0 = &lt;&amp;uart1_pg6_pins&gt;, &lt;&amp;uart1_pg8_rts_cts_pins&gt;;
--- a/arch/riscv/dts/sun20i-d1-lichee-rv.dts
+++ b/arch/riscv/dts/sun20i-d1-lichee-rv.dts
@@ -65,6 +65,12 @@
 	status = "okay";
 };
 
+&amp;spi0 {
+	pinctrl-0 = &lt;&amp;spi0_pins&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;uart0 {
 	pinctrl-0 = &lt;&amp;uart0_pb8_pins&gt;;
 	pinctrl-names = "default";
--- a/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts
+++ b/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts
@@ -4,6 +4,7 @@
 /dts-v1/;
 
 #include &lt;dt-bindings/gpio/gpio.h&gt;
+#include &lt;dt-bindings/leds/common.h&gt;
 
 #include "sun20i-d1.dtsi"
 #include "sun20i-d1-common-regulators.dtsi"
@@ -22,6 +23,28 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	hdmi_connector: connector {
+		compatible = "hdmi-connector";
+		type = "c";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = &lt;&amp;hdmi_out_connector&gt;;
+			};
+		};
+	};
+
+	leds {
+		compatible = "pwm-leds";
+
+		led {
+			color = &lt;LED_COLOR_ID_BLUE&gt;;
+			function = LED_FUNCTION_STATUS;
+			max-brightness = &lt;255&gt;;
+			pwms = &lt;&amp;pwm 2 50000 0&gt;;
+		};
+	};
+
 	reg_avdd2v8: avdd2v8 {
 		compatible = "regulator-fixed";
 		regulator-name = "avdd2v8";
@@ -56,10 +79,28 @@
 	cpu-supply = &lt;&amp;reg_vdd_cpu&gt;;
 };
 
+&amp;de {
+	status = "okay";
+};
+
 &amp;ehci1 {
 	status = "okay";
 };
 
+&amp;hdmi {
+	status = "okay";
+};
+
+&amp;hdmi_out {
+	hdmi_out_connector: endpoint {
+		remote-endpoint = &lt;&amp;hdmi_connector_in&gt;;
+	};
+};
+
+&amp;hdmi_phy {
+	status = "okay";
+};
+
 &amp;mmc0 {
 	bus-width = &lt;4&gt;;
 	cd-gpios = &lt;&amp;pio 5 6 GPIO_ACTIVE_HIGH&gt;; /* PF6 */
--- a/arch/riscv/dts/sun20i-d1-nezha.dts
+++ b/arch/riscv/dts/sun20i-d1-nezha.dts
@@ -5,6 +5,7 @@
 
 #include &lt;dt-bindings/gpio/gpio.h&gt;
 #include &lt;dt-bindings/input/input.h&gt;
+#include &lt;dt-bindings/leds/common.h&gt;
 
 #include "sun20i-d1.dtsi"
 #include "sun20i-d1-common-regulators.dtsi"
@@ -18,12 +19,24 @@
 		ethernet1 = &amp;xr829;
 		mmc0 = &amp;mmc0;
 		serial0 = &amp;uart0;
+		spi0 = &amp;spi0;
 	};
 
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	hdmi_connector: connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_connector_in: endpoint {
+				remote-endpoint = &lt;&amp;hdmi_out_connector&gt;;
+			};
+		};
+	};
+
 	reg_usbvbus: usbvbus {
 		compatible = "regulator-fixed";
 		regulator-name = "usbvbus";
@@ -34,16 +47,13 @@
 		vin-supply = &lt;&amp;reg_vcc&gt;;
 	};
 
-	/*
-	 * This regulator is PWM-controlled, but the PWM controller is not
-	 * yet supported, so fix the regulator to its default voltage.
-	 */
 	reg_vdd_cpu: vdd-cpu {
-		compatible = "regulator-fixed";
+		compatible = "pwm-regulator";
+		pwms = &lt;&amp;pwm 0 50000 0&gt;;
+		pwm-supply = &lt;&amp;reg_vcc&gt;;
 		regulator-name = "vdd-cpu";
-		regulator-min-microvolt = &lt;1100000&gt;;
-		regulator-max-microvolt = &lt;1100000&gt;;
-		vin-supply = &lt;&amp;reg_vcc&gt;;
+		regulator-min-microvolt = &lt;810000&gt;;
+		regulator-max-microvolt = &lt;1160000&gt;;
 	};
 
 	wifi_pwrseq: wifi-pwrseq {
@@ -52,10 +62,26 @@
 	};
 };
 
+&amp;codec {
+	routing = "Headphone Jack", "HPOUTL",
+		  "Headphone Jack", "HPOUTR",
+		  "LINEINL", "HPOUTL",
+		  "LINEINR", "HPOUTR",
+		  "MICIN3", "Headset Microphone",
+		  "Headset Microphone", "HBIAS";
+	widgets = "Microphone", "Headset Microphone",
+		  "Headphone", "Headphone Jack";
+	status = "okay";
+};
+
 &amp;cpu0 {
 	cpu-supply = &lt;&amp;reg_vdd_cpu&gt;;
 };
 
+&amp;de {
+	status = "okay";
+};
+
 &amp;ehci0 {
 	status = "okay";
 };
@@ -73,6 +99,20 @@
 	status = "okay";
 };
 
+&amp;hdmi {
+	status = "okay";
+};
+
+&amp;hdmi_out {
+	hdmi_out_connector: endpoint {
+		remote-endpoint = &lt;&amp;hdmi_connector_in&gt;;
+	};
+};
+
+&amp;hdmi_phy {
+	status = "okay";
+};
+
 &amp;i2c2 {
 	pinctrl-0 = &lt;&amp;i2c2_pb0_pins&gt;;
 	pinctrl-names = "default";
@@ -90,6 +130,18 @@
 	};
 };
 
+&amp;ledc {
+	pinctrl-0 = &lt;&amp;ledc_pc0_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+
+	multi-led@0 {
+		reg = &lt;0x0&gt;;
+		color = &lt;LED_COLOR_ID_RGB&gt;;
+		function = LED_FUNCTION_STATUS;
+	};
+};
+
 &amp;lradc {
 	status = "okay";
 
@@ -142,6 +194,55 @@
 	status = "okay";
 };
 
+&amp;pwm {
+	pinctrl-0 = &lt;&amp;pwm0_pd16_pin&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
+&amp;spi0 {
+	pinctrl-0 = &lt;&amp;spi0_pins&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+
+	flash@0 {
+		compatible = "spi-nand";
+		reg = &lt;0&gt;;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;1&gt;;
+
+			partition@0 {
+				label = "boot0";
+				reg = &lt;0x00000000 0x00100000&gt;;
+			};
+
+			partition@100000 {
+				label = "uboot";
+				reg = &lt;0x00100000 0x00300000&gt;;
+			};
+
+			partition@400000 {
+				label = "secure_storage";
+				reg = &lt;0x00400000 0x00100000&gt;;
+			};
+
+			partition@500000 {
+				label = "sys";
+				reg = &lt;0x00500000 0x0fb00000&gt;;
+			};
+		};
+	};
+};
+
+&amp;spi1 {
+	pinctrl-0 = &lt;&amp;spi1_pd_pins&gt;;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &amp;uart0 {
 	pinctrl-0 = &lt;&amp;uart0_pb8_pins&gt;;
 	pinctrl-names = "default";
--- a/arch/riscv/dts/sun20i-d1.dtsi
+++ b/arch/riscv/dts/sun20i-d1.dtsi
@@ -59,6 +59,35 @@
 		#clock-cells = &lt;0&gt;;
 	};
 
+	thermal-zones {
+		cpu-thermal {
+			polling-delay = &lt;0&gt;;
+			polling-delay-passive = &lt;0&gt;;
+			thermal-sensors = &lt;&amp;ths&gt;;
+
+			trips {
+				cpu_target: cpu-target {
+					hysteresis = &lt;3000&gt;;
+					temperature = &lt;85000&gt;;
+					type = "passive";
+				};
+
+				cpu-crit {
+					hysteresis = &lt;0&gt;;
+					temperature = &lt;110000&gt;;
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = &lt;&amp;cpu_target&gt;;
+					cooling-device = &lt;&amp;cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT&gt;;
+				};
+			};
+		};
+	};
+
 	soc {
 		compatible = "simple-bus";
 		ranges;
@@ -95,6 +124,14 @@
 			#interrupt-cells = &lt;3&gt;;
 
 			/omit-if-no-ref/
+			dsi_4lane_pins: dsi-4lane-pins {
+				pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5",
+				       "PD6", "PD7", "PD8", "PD9";
+				drive-strength = &lt;30&gt;;
+				function = "dsi";
+			};
+
+			/omit-if-no-ref/
 			i2c0_pb10_pins: i2c0-pb10-pins {
 				pins = "PB10", "PB11";
 				function = "i2c0";
@@ -116,6 +153,12 @@
 			};
 
 			/omit-if-no-ref/
+			ledc_pc0_pin: ledc-pc0-pin {
+				pins = "PC0";
+				function = "ledc";
+			};
+
+			/omit-if-no-ref/
 			mmc0_pins: mmc0-pins {
 				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
 				function = "mmc0";
@@ -149,6 +192,48 @@
 			};
 
 			/omit-if-no-ref/
+			pwm0_pd16_pin: pwm0-pd16-pin {
+				pins = "PD16";
+				function = "pwm0";
+			};
+
+			/omit-if-no-ref/
+			pwm2_pd18_pin: pwm2-pd18-pin {
+				pins = "PD18";
+				function = "pwm2";
+			};
+
+			/omit-if-no-ref/
+			pwm4_pd20_pin: pwm4-pd20-pin {
+				pins = "PD20";
+				function = "pwm4";
+			};
+
+			/omit-if-no-ref/
+			pwm7_pd22_pin: pwm7-pd22-pin {
+				pins = "PD22";
+				function = "pwm7";
+			};
+
+			/omit-if-no-ref/
+			spi0_pins: spi0-pins {
+				pins = "PC2", "PC3", "PC4", "PC5", "PC6", "PC7";
+				function = "spi0";
+			};
+
+			/omit-if-no-ref/
+			spi1_pb_pins: spi1-pb-pins {
+				pins = "PB0", "PB8", "PB9", "PB10", "PB11", "PB12";
+				function = "spi1";
+			};
+
+			/omit-if-no-ref/
+			spi1_pd_pins: spi1-pd-pins {
+				pins = "PD10", "PD11", "PD12", "PD13", "PD14", "PD15";
+				function = "spi1";
+			};
+
+			/omit-if-no-ref/
 			uart0_pb8_pins: uart0-pb8-pins {
 				pins = "PB8", "PB9";
 				function = "uart0";
@@ -167,6 +252,17 @@
 			};
 		};
 
+		pwm: pwm@2000c00 {
+			compatible = "allwinner,sun20i-d1-pwm";
+			reg = &lt;0x2000c00 0x400&gt;;
+			interrupts = &lt;34 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_PWM&gt;, &lt;&amp;osc24M&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_PWM&gt;;
+			status = "disabled";
+			#pwm-cells = &lt;3&gt;;
+		};
+
 		ccu: clock-controller@2001000 {
 			compatible = "allwinner,sun20i-d1-ccu";
 			reg = &lt;0x2001000 0x1000&gt;;
@@ -178,6 +274,33 @@
 			#reset-cells = &lt;1&gt;;
 		};
 
+		ledc: led-controller@2008000 {
+			compatible = "allwinner,sun20i-d1-ledc",
+				     "allwinner,sun50i-a100-ledc";
+			reg = &lt;0x2008000 0x400&gt;;
+			interrupts = &lt;36 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_LEDC&gt;, &lt;&amp;ccu CLK_LEDC&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_LEDC&gt;;
+			dmas = &lt;&amp;dma 42&gt;;
+			dma-names = "tx";
+			status = "disabled";
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;0&gt;;
+		};
+
+		ths: temperature-sensor@2009400 {
+			compatible = "allwinner,sun20i-d1-ths";
+			reg = &lt;0x2009400 0x400&gt;;
+			interrupts = &lt;74 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_THS&gt;, &lt;&amp;osc24M&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_THS&gt;;
+			nvmem-cells = &lt;&amp;ths_calib&gt;;
+			nvmem-cell-names = "calibration";
+			#thermal-sensor-cells = &lt;0&gt;;
+		};
+
 		lradc: keys@2009800 {
 			compatible = "allwinner,sun20i-d1-lradc",
 				     "allwinner,sun50i-r329-lradc";
@@ -188,11 +311,30 @@
 			status = "disabled";
 		};
 
+		iommu: iommu@2010000 {
+			compatible = "allwinner,sun20i-d1-iommu";
+			reg = &lt;0x2010000 0x10000&gt;;
+			interrupts = &lt;80 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_IOMMU&gt;;
+			#iommu-cells = &lt;1&gt;;
+		};
+
 		codec: audio-codec@2030000 {
-			compatible = "simple-mfd", "syscon";
+			compatible = "allwinner,sun20i-d1-codec", "simple-mfd", "syscon";
 			reg = &lt;0x2030000 0x1000&gt;;
+			interrupts = &lt;41 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_AUDIO&gt;,
+				 &lt;&amp;ccu CLK_AUDIO_ADC&gt;,
+				 &lt;&amp;ccu CLK_AUDIO_DAC&gt;,
+				 &lt;&amp;osc24M&gt;,
+				 &lt;&amp;rtc CLK_OSC32K&gt;;
+			clock-names = "bus", "adc", "dac", "hosc", "losc";
+			resets = &lt;&amp;ccu RST_BUS_AUDIO&gt;;
+			dmas = &lt;&amp;dma 7&gt;, &lt;&amp;dma 7&gt;;
+			dma-names = "rx", "tx";
 			#address-cells = &lt;1&gt;;
 			#size-cells = &lt;1&gt;;
+			#sound-dai-cells = &lt;0&gt;;
 
 			regulators@2030348 {
 				compatible = "allwinner,sun20i-d1-analog-ldos";
@@ -208,6 +350,21 @@
 			};
 		};
 
+		dmic: dmic@2031000 {
+			compatible = "allwinner,sun20i-d1-dmic",
+				     "allwinner,sun50i-h6-dmic";
+			reg = &lt;0x2031000 0x400&gt;;
+			interrupts = &lt;40 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_DMIC&gt;,
+				 &lt;&amp;ccu CLK_DMIC&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_DMIC&gt;;
+			dmas = &lt;&amp;dma 8&gt;;
+			dma-names = "rx";
+			status = "disabled";
+			#sound-dai-cells = &lt;0&gt;;
+		};
+
 		i2s0: i2s@2032000 {
 			compatible = "allwinner,sun20i-d1-i2s",
 				     "allwinner,sun50i-r329-i2s";
@@ -238,6 +395,7 @@
 			#sound-dai-cells = &lt;0&gt;;
 		};
 
+		// TODO: how to integrate ASRC? same or separate node?
 		i2s2: i2s@2034000 {
 			compatible = "allwinner,sun20i-d1-i2s",
 				     "allwinner,sun50i-r329-i2s";
@@ -253,6 +411,22 @@
 			#sound-dai-cells = &lt;0&gt;;
 		};
 
+		// TODO: add receive functionality
+		spdif: spdif@2036000 {
+			compatible = "allwinner,sun20i-d1-spdif";
+			reg = &lt;0x2036000 0x400&gt;;
+			interrupts = &lt;39 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_SPDIF&gt;,
+				 &lt;&amp;ccu CLK_SPDIF_RX&gt;,
+				 &lt;&amp;ccu CLK_SPDIF_TX&gt;;
+			clock-names = "apb", "rx", "tx";
+			resets = &lt;&amp;ccu RST_BUS_SPDIF&gt;;
+			dmas = &lt;&amp;dma 2&gt;, &lt;&amp;dma 2&gt;;
+			dma-names = "rx", "tx";
+			status = "disabled";
+			#sound-dai-cells = &lt;0&gt;;
+		};
+
 		timer: timer@2050000 {
 			compatible = "allwinner,sun20i-d1-timer",
 				     "allwinner,sun8i-a23-timer";
@@ -457,6 +631,18 @@
 			};
 		};
 
+		crypto: crypto@3040000 {
+			compatible = "allwinner,sun20i-d1-crypto";
+			reg = &lt;0x3040000 0x800&gt;;
+			interrupts = &lt;68 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_CE&gt;,
+				 &lt;&amp;ccu CLK_CE&gt;,
+				 &lt;&amp;ccu CLK_MBUS_CE&gt;,
+				 &lt;&amp;rtc CLK_IOSC&gt;;
+			clock-names = "bus", "mod", "ram", "trng";
+			resets = &lt;&amp;ccu RST_BUS_CE&gt;;
+		};
+
 		mbus: dram-controller@3102000 {
 			compatible = "allwinner,sun20i-d1-mbus";
 			reg = &lt;0x3102000 0x1000&gt;,
@@ -525,6 +711,39 @@
 			#size-cells = &lt;0&gt;;
 		};
 
+		spi0: spi@4025000 {
+			compatible = "allwinner,sun20i-d1-spi",
+				     "allwinner,sun50i-r329-spi";
+			reg = &lt;0x4025000 0x1000&gt;;
+			interrupts = &lt;31 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_SPI0&gt;, &lt;&amp;ccu CLK_SPI0&gt;;
+			clock-names = "ahb", "mod";
+			resets = &lt;&amp;ccu RST_BUS_SPI0&gt;;
+			dmas = &lt;&amp;dma 22&gt;, &lt;&amp;dma 22&gt;;
+			dma-names = "rx", "tx";
+			num-cs = &lt;1&gt;;
+			status = "disabled";
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;0&gt;;
+		};
+
+		spi1: spi@4026000 {
+			compatible = "allwinner,sun20i-d1-spi-dbi",
+				     "allwinner,sun50i-r329-spi-dbi",
+				     "allwinner,sun50i-r329-spi";
+			reg = &lt;0x4026000 0x1000&gt;;
+			interrupts = &lt;32 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_SPI1&gt;, &lt;&amp;ccu CLK_SPI1&gt;;
+			clock-names = "ahb", "mod";
+			resets = &lt;&amp;ccu RST_BUS_SPI1&gt;;
+			dmas = &lt;&amp;dma 23&gt;, &lt;&amp;dma 23&gt;;
+			dma-names = "rx", "tx";
+			num-cs = &lt;1&gt;;
+			status = "disabled";
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;0&gt;;
+		};
+
 		usb_otg: usb@4100000 {
 			compatible = "allwinner,sun20i-d1-musb",
 				     "allwinner,sun8i-a33-musb";
@@ -653,6 +872,7 @@
 				 &lt;&amp;display_clocks CLK_MIXER0&gt;;
 			clock-names = "bus", "mod";
 			resets = &lt;&amp;display_clocks RST_MIXER0&gt;;
+			iommus = &lt;&amp;iommu 2&gt;;
 
 			ports {
 				#address-cells = &lt;1&gt;;
@@ -675,6 +895,7 @@
 				 &lt;&amp;display_clocks CLK_MIXER1&gt;;
 			clock-names = "bus", "mod";
 			resets = &lt;&amp;display_clocks RST_MIXER1&gt;;
+			iommus = &lt;&amp;iommu 2&gt;;
 
 			ports {
 				#address-cells = &lt;1&gt;;
@@ -690,6 +911,40 @@
 			};
 		};
 
+		dsi: dsi@5450000 {
+			compatible = "allwinner,sun20i-d1-mipi-dsi",
+				     "allwinner,sun50i-a100-mipi-dsi";
+			reg = &lt;0x5450000 0x1000&gt;;
+			interrupts = &lt;108 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_MIPI_DSI&gt;,
+				 &lt;&amp;tcon_top CLK_TCON_TOP_DSI&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_MIPI_DSI&gt;;
+			phys = &lt;&amp;dphy&gt;;
+			phy-names = "dphy";
+			status = "disabled";
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;0&gt;;
+
+			port {
+				dsi_in_tcon_lcd0: endpoint {
+					remote-endpoint = &lt;&amp;tcon_lcd0_out_dsi&gt;;
+				};
+			};
+		};
+
+		dphy: phy@5451000 {
+			compatible = "allwinner,sun20i-d1-mipi-dphy",
+				     "allwinner,sun50i-a100-mipi-dphy";
+			reg = &lt;0x5451000 0x1000&gt;;
+			interrupts = &lt;108 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_MIPI_DSI&gt;,
+				 &lt;&amp;ccu CLK_MIPI_DSI&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_MIPI_DSI&gt;;
+			#phy-cells = &lt;0&gt;;
+		};
+
 		tcon_top: tcon-top@5460000 {
 			compatible = "allwinner,sun20i-d1-tcon-top";
 			reg = &lt;0x5460000 0x1000&gt;;
@@ -770,6 +1025,10 @@
 
 				tcon_top_hdmi_out: port@5 {
 					reg = &lt;5&gt;;
+
+					tcon_top_hdmi_out_hdmi: endpoint {
+						remote-endpoint = &lt;&amp;hdmi_in_tcon_top&gt;;
+					};
 				};
 			};
 		};
@@ -785,6 +1044,8 @@
 			resets = &lt;&amp;ccu RST_BUS_TCON_LCD0&gt;,
 				 &lt;&amp;ccu RST_BUS_LVDS0&gt;;
 			reset-names = "lcd", "lvds";
+			phys = &lt;&amp;dphy&gt;;
+			phy-names = "lvds0";
 			#clock-cells = &lt;0&gt;;
 
 			ports {
@@ -809,6 +1070,13 @@
 
 				tcon_lcd0_out: port@1 {
 					reg = &lt;1&gt;;
+					#address-cells = &lt;1&gt;;
+					#size-cells = &lt;0&gt;;
+
+					tcon_lcd0_out_dsi: endpoint@1 {
+						reg = &lt;1&gt;;
+						remote-endpoint = &lt;&amp;dsi_in_tcon_lcd0&gt;;
+					};
 				};
 			};
 		};
@@ -853,6 +1121,50 @@
 			};
 		};
 
+		hdmi: hdmi@5500000 {
+			compatible = "allwinner,sun20i-d1-dw-hdmi";
+			reg = &lt;0x5500000 0x10000&gt;;
+			reg-io-width = &lt;1&gt;;
+			interrupts = &lt;109 IRQ_TYPE_LEVEL_HIGH&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_HDMI&gt;,
+				 &lt;&amp;ccu CLK_HDMI_24M&gt;,
+				 &lt;&amp;ccu CLK_HDMI_CEC&gt;;
+			clock-names = "iahb", "isfr", "cec";
+			resets = &lt;&amp;ccu RST_BUS_HDMI_SUB&gt;;
+			reset-names = "ctrl";
+			phys = &lt;&amp;hdmi_phy&gt;;
+			phy-names = "phy";
+			status = "disabled";
+
+			ports {
+				#address-cells = &lt;1&gt;;
+				#size-cells = &lt;0&gt;;
+
+				port@0 {
+					reg = &lt;0&gt;;
+
+					hdmi_in_tcon_top: endpoint {
+						remote-endpoint = &lt;&amp;tcon_top_hdmi_out_hdmi&gt;;
+					};
+				};
+
+				hdmi_out: port@1 {
+					reg = &lt;1&gt;;
+				};
+			};
+		};
+
+		hdmi_phy: phy@5510000 {
+			compatible = "allwinner,sun20i-d1-hdmi-phy";
+			reg = &lt;0x5510000 0x10000&gt;;
+			clocks = &lt;&amp;ccu CLK_BUS_HDMI&gt;, &lt;&amp;ccu CLK_HDMI_24M&gt;;
+			clock-names = "bus", "mod";
+			resets = &lt;&amp;ccu RST_BUS_HDMI_MAIN&gt;;
+			reset-names = "phy";
+			status = "disabled";
+			#phy-cells = &lt;0&gt;;
+		};
+
 		riscv_wdt: watchdog@6011000 {
 			compatible = "allwinner,sun20i-d1-wdt";
 			reg = &lt;0x6011000 0x20&gt;;
</pre></body></html>