<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 5479c8efb6ffbbc8b7fd1068337037faf9c20a36 Mon Sep 17 00:00:00 2001
From: Samuel Holland &lt;samuel@sholland.org&gt;
Date: Thu, 11 Aug 2022 22:25:40 -0500
Subject: [PATCH 064/117] riscv: dts: allwinner: d1: Hook up PWM-controlled CPU
 voltage regulators

Signed-off-by: Samuel Holland &lt;samuel@sholland.org&gt;
---
 .../allwinner/sun20i-d1-clockworkpi-v3.14.dts | 19 +++++++++++--------
 .../sun20i-d1-dongshan-nezha-stu.dts          | 19 +++++++++++--------
 .../boot/dts/allwinner/sun20i-d1-nezha.dts    | 19 +++++++++++--------
 3 files changed, 33 insertions(+), 24 deletions(-)

--- a/arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
+++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-clockworkpi-v3.14.dts
@@ -48,16 +48,13 @@
 		};
 	};
 
-	/*
-	 * 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 {
@@ -254,6 +251,12 @@
 	};
 };
 
+&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/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts
+++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts
@@ -43,16 +43,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;;
 	};
 };
 
@@ -95,6 +92,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/boot/dts/allwinner/sun20i-d1-nezha.dts
+++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
@@ -35,16 +35,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 {
@@ -155,6 +152,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";
</pre></body></html>