70c4f19
From e7a6e6b0c6506a9f070dbfb2ca948770c47a1d78 Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:30:57 -0600
70c4f19
Subject: [PATCH 1/8] arm64: dts: allwinner: pinebook: Remove unused vcc3v3
70c4f19
 regulator
70c4f19
70c4f19
This fixed regulator has no consumers, GPIOs, or other connections.
70c4f19
Remove it.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 7 -------
70c4f19
 1 file changed, 7 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index 3d894b208901..ff32ca1a495e 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -63,13 +63,6 @@ lid_switch {
70c4f19
 		};
70c4f19
 	};
70c4f19
 
70c4f19
-	reg_vcc3v3: vcc3v3 {
70c4f19
-		compatible = "regulator-fixed";
70c4f19
-		regulator-name = "vcc3v3";
70c4f19
-		regulator-min-microvolt = <3300000>;
70c4f19
-		regulator-max-microvolt = <3300000>;
70c4f19
-	};
70c4f19
-
70c4f19
 	wifi_pwrseq: wifi_pwrseq {
70c4f19
 		compatible = "mmc-pwrseq-simple";
70c4f19
 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From 5eea216437eeff908d6d2942bf893fb77ebfc111 Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:30:59 -0600
70c4f19
Subject: [PATCH 2/8] arm64: dts: allwinner: pinebook: Sort device tree nodes
70c4f19
70c4f19
The r_i2c node should come before r_rsb, and in any case should not
70c4f19
separate the axp803 node from its subnodes.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../boot/dts/allwinner/sun50i-a64-pinebook.dts   | 16 ++++++++--------
70c4f19
 1 file changed, 8 insertions(+), 8 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index ff32ca1a495e..77784f7b1da7 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -172,6 +172,14 @@ &pwm {
70c4f19
 	status = "okay";
70c4f19
 };
70c4f19
 
70c4f19
+/* The ANX6345 eDP-bridge is on r_i2c */
70c4f19
+&r_i2c {
70c4f19
+	clock-frequency = <100000>;
70c4f19
+	pinctrl-names = "default";
70c4f19
+	pinctrl-0 = <&r_i2c_pl89_pins>;
70c4f19
+	status = "okay";
70c4f19
+};
70c4f19
+
70c4f19
 &r_rsb {
70c4f19
 	status = "okay";
70c4f19
 
70c4f19
@@ -183,14 +191,6 @@ axp803: pmic@3a3 {
70c4f19
 	};
70c4f19
 };
70c4f19
 
70c4f19
-/* The ANX6345 eDP-bridge is on r_i2c */
70c4f19
-&r_i2c {
70c4f19
-	clock-frequency = <100000>;
70c4f19
-	pinctrl-names = "default";
70c4f19
-	pinctrl-0 = <&r_i2c_pl89_pins>;
70c4f19
-	status = "okay";
70c4f19
-};
70c4f19
-
70c4f19
 #include "axp803.dtsi"
70c4f19
 
70c4f19
 &ac_power_supply {
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From 4bdf53ffc64e5c6738c942dcdc422d5ca8a2070a Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:31:00 -0600
70c4f19
Subject: [PATCH 3/8] arm64: dts: allwinner: pinebook: Make simplefb more
70c4f19
 consistent
70c4f19
70c4f19
Boards generally reference the simplefb nodes from the SoC dtsi by
70c4f19
label, not by full path. simplefb_hdmi is already like this in the
70c4f19
Pinebook DTS. Update simplefb_lcd to match.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 12 ++++++------
70c4f19
 1 file changed, 6 insertions(+), 6 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index 77784f7b1da7..224bed65d008 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -41,12 +41,6 @@ backlight: backlight {
70c4f19
 
70c4f19
 	chosen {
70c4f19
 		stdout-path = "serial0:115200n8";
70c4f19
-
70c4f19
-		framebuffer-lcd {
70c4f19
-			panel-supply = <&reg_dc1sw>;
70c4f19
-			dvdd25-supply = <&reg_dldo2>;
70c4f19
-			dvdd12-supply = <&reg_fldo1>;
70c4f19
-		};
70c4f19
 	};
70c4f19
 
70c4f19
 	gpio_keys {
70c4f19
@@ -316,6 +310,12 @@ &reg_rtc_ldo {
70c4f19
 	regulator-name = "vcc-rtc";
70c4f19
 };
70c4f19
 
70c4f19
+&simplefb_lcd {
70c4f19
+	panel-supply = <&reg_dc1sw>;
70c4f19
+	dvdd25-supply = <&reg_dldo2>;
70c4f19
+	dvdd12-supply = <&reg_fldo1>;
70c4f19
+};
70c4f19
+
70c4f19
 &simplefb_hdmi {
70c4f19
 	vcc-hdmi-supply = <&reg_dldo1>;
70c4f19
 };
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From c0f416de7141bbc713f080ad123b256f6320ec92 Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:31:01 -0600
70c4f19
Subject: [PATCH 4/8] arm64: dts: allwinner: pinebook: Document MMC0 CD pin
70c4f19
 name
70c4f19
70c4f19
Normally GPIO pin references are followed by a comment giving the pin
70c4f19
name for searchability. Add the comment here where it was missing.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 2 +-
70c4f19
 1 file changed, 1 insertion(+), 1 deletion(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index 224bed65d008..a1e15777d524 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -119,7 +119,7 @@ &mmc0 {
70c4f19
 	pinctrl-names = "default";
70c4f19
 	pinctrl-0 = <&mmc0_pins>;
70c4f19
 	vmmc-supply = <&reg_dcdc1>;
70c4f19
-	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
70c4f19
+	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
70c4f19
 	disable-wp;
70c4f19
 	bus-width = <4>;
70c4f19
 	status = "okay";
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From 8818d55ec31fa6e0dc14fb7a4924b3e8d3ecef7d Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:31:02 -0600
70c4f19
Subject: [PATCH 5/8] arm64: dts: allwinner: pinebook: Add GPIO port regulators
70c4f19
70c4f19
Allwinner A64 SoC has separate supplies for PC, PD, PE, PG and PL.
70c4f19
70c4f19
VCC-PC and VCC-PG are supplied by ELDO1 at 1.8v.
70c4f19
VCC-PD is supplied by DCDC1 (VCC-IO) at 3.3v.
70c4f19
VCC-PE is supplied by ALDO1, and is unused.
70c4f19
70c4f19
VCC-PL creates a circular dependency, so it is omitted for now.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../boot/dts/allwinner/sun50i-a64-pinebook.dts  | 17 +++++++++++++++++
70c4f19
 1 file changed, 17 insertions(+)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index a1e15777d524..1ec39120323f 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -162,6 +162,13 @@ &ohci1 {
70c4f19
 	status = "okay";
70c4f19
 };
70c4f19
 
70c4f19
+&pio {
70c4f19
+	vcc-pc-supply = <&reg_eldo1>;
70c4f19
+	vcc-pd-supply = <&reg_dcdc1>;
70c4f19
+	vcc-pe-supply = <&reg_aldo1>;
70c4f19
+	vcc-pg-supply = <&reg_eldo1>;
70c4f19
+};
70c4f19
+
70c4f19
 &pwm {
70c4f19
 	status = "okay";
70c4f19
 };
70c4f19
@@ -174,6 +181,16 @@ &r_i2c {
70c4f19
 	status = "okay";
70c4f19
 };
70c4f19
 
70c4f19
+&r_pio {
70c4f19
+	/*
70c4f19
+	 * FIXME: We can't add that supply for now since it would
70c4f19
+	 * create a circular dependency between pinctrl, the regulator
70c4f19
+	 * and the RSB Bus.
70c4f19
+	 *
70c4f19
+	 * vcc-pl-supply = <&reg_aldo2>;
70c4f19
+	 */
70c4f19
+};
70c4f19
+
70c4f19
 &r_rsb {
70c4f19
 	status = "okay";
70c4f19
 
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From bd863f25d41173e140850772f9a02ffb3b3e0d6b Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:31:03 -0600
70c4f19
Subject: [PATCH 6/8] arm64: dts: allwinner: pinebook: Fix backlight regulator
70c4f19
70c4f19
The output from the backlight regulator is labeled as "VBKLT" in the
70c4f19
schematic. Using the equation and resistor values from the schematic,
70c4f19
the output is approximately 18V, not 3.3V. Since the regulator in use
70c4f19
(SS6640STR) is a boost regulator powered by PS (battery or AC input),
70c4f19
which are both >3.3V, the output could not be 3.3V anyway.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../dts/allwinner/sun50i-a64-pinebook.dts     | 20 +++++++++----------
70c4f19
 1 file changed, 10 insertions(+), 10 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index 1ec39120323f..313f4e6edc19 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -21,22 +21,13 @@ aliases {
70c4f19
 		ethernet0 = &rtl8723cs;
70c4f19
 	};
70c4f19
 
70c4f19
-	vdd_bl: regulator@0 {
70c4f19
-		compatible = "regulator-fixed";
70c4f19
-		regulator-name = "bl-3v3";
70c4f19
-		regulator-min-microvolt = <3300000>;
70c4f19
-		regulator-max-microvolt = <3300000>;
70c4f19
-		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
70c4f19
-		enable-active-high;
70c4f19
-	};
70c4f19
-
70c4f19
 	backlight: backlight {
70c4f19
 		compatible = "pwm-backlight";
70c4f19
 		pwms = <&pwm 0 50000 0>;
70c4f19
 		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
70c4f19
 		default-brightness-level = <2>;
70c4f19
 		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
70c4f19
-		power-supply = <&vdd_bl>;
70c4f19
+		power-supply = <&reg_vbklt>;
70c4f19
 	};
70c4f19
 
70c4f19
 	chosen {
70c4f19
@@ -57,6 +48,15 @@ lid_switch {
70c4f19
 		};
70c4f19
 	};
70c4f19
 
70c4f19
+	reg_vbklt: vbklt {
70c4f19
+		compatible = "regulator-fixed";
70c4f19
+		regulator-name = "vbklt";
70c4f19
+		regulator-min-microvolt = <18000000>;
70c4f19
+		regulator-max-microvolt = <18000000>;
70c4f19
+		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
70c4f19
+		enable-active-high;
70c4f19
+	};
70c4f19
+
70c4f19
 	wifi_pwrseq: wifi_pwrseq {
70c4f19
 		compatible = "mmc-pwrseq-simple";
70c4f19
 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From 425472eb612873c9c64b41df70020de58448bef3 Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:31:04 -0600
70c4f19
Subject: [PATCH 7/8] arm64: dts: allwinner: pinebook: Fix 5v0 boost regulator
70c4f19
70c4f19
Now that AXP803 GPIO support is available, we can properly model
70c4f19
the hardware. Replace the use of GPIO0-LDO with a fixed regulator
70c4f19
controlled by GPIO0. This boost regulator is used to power the
70c4f19
(internal and external) USB ports, as well as the speakers.
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../dts/allwinner/sun50i-a64-pinebook.dts     | 27 +++++++++----------
70c4f19
 1 file changed, 12 insertions(+), 15 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index 313f4e6edc19..c06c540e6c08 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -57,6 +57,15 @@ reg_vbklt: vbklt {
70c4f19
 		enable-active-high;
70c4f19
 	};
70c4f19
 
70c4f19
+	reg_vcc5v0: vcc5v0 {
70c4f19
+		compatible = "regulator-fixed";
70c4f19
+		regulator-name = "vcc5v0";
70c4f19
+		regulator-min-microvolt = <5000000>;
70c4f19
+		regulator-max-microvolt = <5000000>;
70c4f19
+		gpio = <&axp_gpio 0 GPIO_ACTIVE_HIGH>;
70c4f19
+		enable-active-high;
70c4f19
+	};
70c4f19
+
70c4f19
 	wifi_pwrseq: wifi_pwrseq {
70c4f19
 		compatible = "mmc-pwrseq-simple";
70c4f19
 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
70c4f19
@@ -64,12 +73,7 @@ wifi_pwrseq: wifi_pwrseq {
70c4f19
 
70c4f19
 	speaker_amp: audio-amplifier {
70c4f19
 		compatible = "simple-audio-amplifier";
70c4f19
-		/*
70c4f19
-		 * TODO This is actually a fixed regulator controlled by
70c4f19
-		 * the GPIO line on the PMIC. This should be corrected
70c4f19
-		 * once GPIO support is added for this PMIC.
70c4f19
-		 */
70c4f19
-		VCC-supply = <&reg_ldo_io0>;
70c4f19
+		VCC-supply = <&reg_vcc5v0>;
70c4f19
 		enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
70c4f19
 		sound-name-prefix = "Speaker Amp";
70c4f19
 	};
70c4f19
@@ -316,13 +320,6 @@ &reg_fldo2 {
70c4f19
 	regulator-name = "vdd-cpus";
70c4f19
 };
70c4f19
 
70c4f19
-&reg_ldo_io0 {
70c4f19
-	regulator-min-microvolt = <3300000>;
70c4f19
-	regulator-max-microvolt = <3300000>;
70c4f19
-	regulator-name = "vcc-usb";
70c4f19
-	status = "okay";
70c4f19
-};
70c4f19
-
70c4f19
 &reg_rtc_ldo {
70c4f19
 	regulator-name = "vcc-rtc";
70c4f19
 };
70c4f19
@@ -371,7 +368,7 @@ &usb_otg {
70c4f19
 };
70c4f19
 
70c4f19
 &usbphy {
70c4f19
-	usb0_vbus-supply = <&reg_ldo_io0>;
70c4f19
-	usb1_vbus-supply = <&reg_ldo_io0>;
70c4f19
+	usb0_vbus-supply = <&reg_vcc5v0>;
70c4f19
+	usb1_vbus-supply = <&reg_vcc5v0>;
70c4f19
 	status = "okay";
70c4f19
 };
70c4f19
-- 
70c4f19
2.24.1
70c4f19
70c4f19
From c3aea4ea2117f5dc28da3d4175fc93296653ecd5 Mon Sep 17 00:00:00 2001
70c4f19
From: Samuel Holland <samuel@sholland.org>
70c4f19
Date: Sun, 19 Jan 2020 10:30:58 -0600
70c4f19
Subject: [PATCH 8/8] arm64: dts: allwinner: pinebook: Remove unused AXP803
70c4f19
 regulators
70c4f19
70c4f19
The Pinebook does not use the CSI bus on the A64. In fact it does not
70c4f19
use GPIO port E for anything at all. Thus the following regulators are
70c4f19
not used and do not need voltages set:
70c4f19
70c4f19
 - ALDO1: Connected to VCC-PE only
70c4f19
 - DLDO3: Not connected
70c4f19
 - ELDO3: Not connected
70c4f19
70c4f19
Signed-off-by: Samuel Holland <samuel@sholland.org>
70c4f19
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
70c4f19
---
70c4f19
 .../boot/dts/allwinner/sun50i-a64-pinebook.dts   | 16 +---------------
70c4f19
 1 file changed, 1 insertion(+), 15 deletions(-)
70c4f19
70c4f19
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
index c06c540e6c08..12e513ba8f50 100644
70c4f19
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
70c4f19
@@ -217,9 +217,7 @@ &battery_power_supply {
70c4f19
 };
70c4f19
 
70c4f19
 &reg_aldo1 {
70c4f19
-	regulator-min-microvolt = <2800000>;
70c4f19
-	regulator-max-microvolt = <2800000>;
70c4f19
-	regulator-name = "vcc-csi";
70c4f19
+	regulator-name = "vcc-pe";
70c4f19
 };
70c4f19
 
70c4f19
 &reg_aldo2 {
70c4f19
@@ -282,12 +280,6 @@ &reg_dldo2 {
70c4f19
 	regulator-name = "vcc-edp";
70c4f19
 };
70c4f19
 
70c4f19
-&reg_dldo3 {
70c4f19
-	regulator-min-microvolt = <3300000>;
70c4f19
-	regulator-max-microvolt = <3300000>;
70c4f19
-	regulator-name = "avdd-csi";
70c4f19
-};
70c4f19
-
70c4f19
 &reg_dldo4 {
70c4f19
 	regulator-min-microvolt = <3300000>;
70c4f19
 	regulator-max-microvolt = <3300000>;
70c4f19
@@ -301,12 +293,6 @@ &reg_eldo1 {
70c4f19
 	regulator-name = "cpvdd";
70c4f19
 };
70c4f19
 
70c4f19
-&reg_eldo3 {
70c4f19
-	regulator-min-microvolt = <1800000>;
70c4f19
-	regulator-max-microvolt = <1800000>;
70c4f19
-	regulator-name = "vdd-1v8-csi";
70c4f19
-};
70c4f19
-
70c4f19
 &reg_fldo1 {
70c4f19
 	regulator-min-microvolt = <1200000>;
70c4f19
 	regulator-max-microvolt = <1200000>;
70c4f19
-- 
70c4f19
2.24.1
70c4f19