Skip to contentSkip to conversation

ARM: dts: qcom: klte: Add support for hw keys, flash and usb

PATCH Superseded Iskren Chernev 2 participants 10 messages Apr 10, 2020 – Apr 11, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: dts: qcom: klte: Add support for hw keys, flash and usb

Enable support for gpio-keys (volume up/down + home), internal flash storage (sdhci), and usb (for usb-ethernet) for the Samsung Galaxy S5, codename klte.

Daniele Debernardi (6):
ARM: dts: qcom: msm8974: Add pma8084 regulator node
ARM: dts: qcom: msm8974-klte: Add regulator nodes
ARM: dts: qcom: msm8974-klte: Add gpio-keys nodes
ARM: dts: qcom: msm8974-klte: Add sdhci1 node
ARM: dts: qcom: msm8974-klte: Remove inherited vreg_boost node
ARM: dts: qcom: msm8974-klte: Add USB node

 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 286 +++++++++++++++++-
 arch/arm/boot/dts/qcom-msm8974.dtsi           |  53 ++++
 2 files changed, 337 insertions(+), 2 deletions(-)

base-commit: 873e37a44b1ee8ad4628ca257dc51c0c7c654326 --
2.26.0

#1 lore raw

PATCH 1/6 ARM: dts: qcom: msm8974: Add pma8084 regulator node

From: Daniele Debernardi <[email protected]>

The pma8084 regulator node is added with status disabled. It is used in the Samsung Galaxy S5 (klte) for various things including gpio keys, sdhci, usb, dsi

---
 arch/arm/boot/dts/qcom-msm8974.dtsi | 53 +++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +53 -0
index 2ea2308d91b3..fdb93138be25 100644
@@ -1600,6 +1600,59 @@ pm8941-regulators {
 					pm8941_lvs2: lvs2 {};
 					pm8941_lvs3: lvs3 {};
 				};
+
+				pma8084-regulators {
+					compatible = "qcom,rpm-pma8084-regulators";
+					status = "disabled";
+
+					pma8084_s1: s1 {};
+					pma8084_s2: s2 {};
+					pma8084_s3: s3 {};
+					pma8084_s4: s4 {};
+					pma8084_s5: s5 {};
+					pma8084_s6: s6 {};
+					pma8084_s7: s7 {};
+					pma8084_s8: s8 {};
+					pma8084_s9: s9 {};
+					pma8084_s10: s10 {};
+					pma8084_s11: s11 {};
+					pma8084_s12: s12 {};
+
+					pma8084_l1: l1 {};
+					pma8084_l2: l2 {};
+					pma8084_l3: l3 {};
+					pma8084_l4: l4 {};
+					pma8084_l5: l5 {};
+					pma8084_l6: l6 {};
+					pma8084_l7: l7 {};
+					pma8084_l8: l8 {};
+					pma8084_l9: l9 {};
+					pma8084_l10: l10 {};
+					pma8084_l11: l11 {};
+					pma8084_l12: l12 {};
+					pma8084_l13: l13 {};
+					pma8084_l14: l14 {};
+					pma8084_l15: l15 {};
+					pma8084_l16: l16 {};
+					pma8084_l17: l17 {};
+					pma8084_l18: l18 {};
+					pma8084_l19: l19 {};
+					pma8084_l20: l20 {};
+					pma8084_l21: l21 {};
+					pma8084_l22: l22 {};
+					pma8084_l23: l23 {};
+					pma8084_l24: l24 {};
+					pma8084_l25: l25 {};
+					pma8084_l26: l26 {};
+					pma8084_l27: l27 {};
+
+					pma8084_lvs1: lvs1 {};
+					pma8084_lvs2: lvs2 {};
+					pma8084_lvs3: lvs3 {};
+					pma8084_lvs4: lvs4 {};
+
+					pma8084_5vs1: 5vs1 {};
+				};
 			};
 		};
 	};
Signature · 1 line
2.26.0
#2 lore raw

Re: [PATCH 1/6] ARM: dts: qcom: msm8974: Add pma8084 regulator node

Quoted 6 lines · Iskren Chernev

From: Daniele Debernardi <[email protected]>

The pma8084 regulator node is added with status disabled. It is used in the Samsung Galaxy S5 (klte) for various things including gpio keys, sdhci, usb, dsi

On the newer platforms we learned that the PMIC configuration wasn't strictly tied to the platform.

I think we should migrate the older platforms as well (and your series is an argument for doing this), so in line with that I think it would be better if you moved this chunk to the klte dts (and squash it with the second patch).

Regards,
Bjorn

Quoted 72 lines
---
 arch/arm/boot/dts/qcom-msm8974.dtsi | 53 +++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
arch/arm/boot/dts/qcom-msm8974.dtsi +53 -0
index 2ea2308d91b3..fdb93138be25 100644
@@ -1600,6 +1600,59 @@ pm8941-regulators {
 					pm8941_lvs2: lvs2 {};
 					pm8941_lvs3: lvs3 {};
 				};
+
+				pma8084-regulators {
+					compatible = "qcom,rpm-pma8084-regulators";
+					status = "disabled";
+
+					pma8084_s1: s1 {};
+					pma8084_s2: s2 {};
+					pma8084_s3: s3 {};
+					pma8084_s4: s4 {};
+					pma8084_s5: s5 {};
+					pma8084_s6: s6 {};
+					pma8084_s7: s7 {};
+					pma8084_s8: s8 {};
+					pma8084_s9: s9 {};
+					pma8084_s10: s10 {};
+					pma8084_s11: s11 {};
+					pma8084_s12: s12 {};
+
+					pma8084_l1: l1 {};
+					pma8084_l2: l2 {};
+					pma8084_l3: l3 {};
+					pma8084_l4: l4 {};
+					pma8084_l5: l5 {};
+					pma8084_l6: l6 {};
+					pma8084_l7: l7 {};
+					pma8084_l8: l8 {};
+					pma8084_l9: l9 {};
+					pma8084_l10: l10 {};
+					pma8084_l11: l11 {};
+					pma8084_l12: l12 {};
+					pma8084_l13: l13 {};
+					pma8084_l14: l14 {};
+					pma8084_l15: l15 {};
+					pma8084_l16: l16 {};
+					pma8084_l17: l17 {};
+					pma8084_l18: l18 {};
+					pma8084_l19: l19 {};
+					pma8084_l20: l20 {};
+					pma8084_l21: l21 {};
+					pma8084_l22: l22 {};
+					pma8084_l23: l23 {};
+					pma8084_l24: l24 {};
+					pma8084_l25: l25 {};
+					pma8084_l26: l26 {};
+					pma8084_l27: l27 {};
+
+					pma8084_lvs1: lvs1 {};
+					pma8084_lvs2: lvs2 {};
+					pma8084_lvs3: lvs3 {};
+					pma8084_lvs4: lvs4 {};
+
+					pma8084_5vs1: 5vs1 {};
+				};
 			};
 		};
 	};
Signature · 1 line
2.26.0
#3 lore raw

PATCH 2/6 ARM: dts: qcom: msm8974-klte: Add regulator nodes

In reply to Iskren Chernev

From: Daniele Debernardi <[email protected]>

The voltages are pulled from the vendor source tree.

---
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 176 ++++++++++++++++++
 1 file changed, 176 insertions(+)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +176 -0
index eaa1001d0a46..6b184819f1ce 100644
@@ -2,6 +2,7 @@
 #include "qcom-msm8974pro.dtsi"
 #include "qcom-pm8841.dtsi"
 #include "qcom-pm8941.dtsi"
+#include "qcom-pma8084.dtsi"
 
 / {
 	model = "Samsung Galaxy S5";
@@ -14,6 +15,181 @@ aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	smd {
+		rpm {
+			rpm_requests {
+				pma8084-regulators {
+					status = "okay";
+
+					s1 {
+						regulator-min-microvolt = <675000>;
+						regulator-max-microvolt = <1050000>;
+					};
+
+					s2 {
+						regulator-min-microvolt = <500000>;
+						regulator-max-microvolt = <1050000>;
+					};
+
+					s3 {
+						regulator-min-microvolt = <1300000>;
+						regulator-max-microvolt = <1300000>;
+					};
+
+					s4 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					s5 {
+						regulator-min-microvolt = <2150000>;
+						regulator-max-microvolt = <2150000>;
+					};
+
+					s6 {
+						regulator-min-microvolt = <1050000>;
+						regulator-max-microvolt = <1050000>;
+					};
+
+					l1 {
+						regulator-min-microvolt = <1225000>;
+						regulator-max-microvolt = <1225000>;
+					};
+
+					l2 {
+						regulator-min-microvolt = <1200000>;
+						regulator-max-microvolt = <1200000>;
+					};
+
+					l3 {
+						regulator-min-microvolt = <1050000>;
+						regulator-max-microvolt = <1200000>;
+					};
+
+					l4 {
+						regulator-min-microvolt = <1200000>;
+						regulator-max-microvolt = <1225000>;
+					};
+
+					l5 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l6 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l7 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l8 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l9 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <2950000>;
+					};
+
+					l10 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <2950000>;
+					};
+
+					l11 {
+						regulator-min-microvolt = <1300000>;
+						regulator-max-microvolt = <1300000>;
+					};
+
+					l12 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l13 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <2950000>;
+					};
+
+					l14 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <1800000>;
+					};
+
+					l15 {
+						regulator-min-microvolt = <2050000>;
+						regulator-max-microvolt = <2050000>;
+					};
+
+					l16 {
+						regulator-min-microvolt = <2700000>;
+						regulator-max-microvolt = <2700000>;
+					};
+
+					l17 {
+						regulator-min-microvolt = <2850000>;
+						regulator-max-microvolt = <2850000>;
+					};
+
+					l18 {
+						regulator-min-microvolt = <2850000>;
+						regulator-max-microvolt = <2850000>;
+					};
+
+					l19 {
+						regulator-min-microvolt = <2900000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					l20 {
+						regulator-min-microvolt = <2950000>;
+						regulator-max-microvolt = <2950000>;
+					};
+
+					l21 {
+						regulator-min-microvolt = <2950000>;
+						regulator-max-microvolt = <2950000>;
+					};
+
+					l22 {
+						regulator-min-microvolt = <3000000>;
+						regulator-max-microvolt = <3300000>;
+					};
+
+					l23 {
+						regulator-min-microvolt = <3000000>;
+						regulator-max-microvolt = <3000000>;
+					};
+
+					l24 {
+						regulator-min-microvolt = <3075000>;
+						regulator-max-microvolt = <3075000>;
+					};
+
+					l25 {
+						regulator-min-microvolt = <2100000>;
+						regulator-max-microvolt = <2100000>;
+					};
+
+					l26 {
+						regulator-min-microvolt = <1800000>;
+						regulator-max-microvolt = <2050000>;
+					};
+
+					l27 {
+						regulator-min-microvolt = <1000000>;
+						regulator-max-microvolt = <1225000>;
+					};
+				};
+			};
+		};
+	};
 };
 
 &soc {
Signature · 1 line
2.26.0
#4 lore raw

PATCH 3/6 ARM: dts: qcom: msm8974-klte: Add gpio-keys nodes

In reply to Iskren Chernev

From: Daniele Debernardi <[email protected]>

This introduces the gpio-keys nodes for volume/home keys and the associated pinctrl state.

---
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +49 -0
index 6b184819f1ce..21335999a024 100644
@@ -3,6 +3,9 @@
 #include "qcom-pm8841.dtsi"
 #include "qcom-pm8941.dtsi"
 #include "qcom-pma8084.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 
 / {
 	model = "Samsung Galaxy S5";
@@ -197,4 +200,50 @@ serial@f991e000 {
 		status = "ok";
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+		input-name = "gpio-keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&gpio_keys_pin_a>;
+
+		volume-down {
+			label = "volume_down";
+			gpios = <&pma8084_gpios 2 GPIO_ACTIVE_LOW>;
+			linux,input-type = <1>;
+			linux,code = <KEY_VOLUMEDOWN>;
+			debounce-interval = <15>;
+		};
+
+		home-key {
+			label = "home_key";
+			gpios = <&pma8084_gpios 3 GPIO_ACTIVE_LOW>;
+			linux,input-type = <1>;
+			linux,code = <KEY_HOMEPAGE>;
+			wakeup-source;
+			debounce-interval = <15>;
+		};
+
+		volume-up {
+			label = "volume_up";
+			gpios = <&pma8084_gpios 5 GPIO_ACTIVE_LOW>;
+			linux,input-type = <1>;
+			linux,code = <KEY_VOLUMEUP>;
+			debounce-interval = <15>;
+		};
+	};
+};
+
+&spmi_bus {
+	pma8084@0 {
+		gpios@c000 {
+			gpio_keys_pin_a: gpio-keys-active {
+				pins = "gpio2", "gpio3", "gpio5";
+				function = "normal";
+
+				bias-pull-up;
+				power-source = <PMA8084_GPIO_S4>;
+			};
+		};
+	};
 };
Signature · 1 line
2.26.0
#5 lore raw

PATCH 4/6 ARM: dts: qcom: msm8974-klte: Add sdhci1 node

In reply to Iskren Chernev

From: Daniele Debernardi <[email protected]>

This introduces the eMMC sdhci node and its pinctrl state

---
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +32 -0
index 21335999a024..de0bf6b7e732 100644
@@ -153,6 +153,9 @@ l19 {
 					l20 {
 						regulator-min-microvolt = <2950000>;
 						regulator-max-microvolt = <2950000>;
+
+						regulator-allow-set-load;
+						regulator-system-load = <200000>;
 					};
 
 					l21 {
@@ -232,6 +235,35 @@ volume-up {
 			debounce-interval = <15>;
 		};
 	};
+
+	pinctrl@fd510000 {
+		sdhc1_pin_a: sdhc1-pin-active {
+			clk {
+				pins = "sdc1_clk";
+				drive-strength = <4>;
+				bias-disable;
+			};
+
+			cmd-data {
+				pins = "sdc1_cmd", "sdc1_data";
+				drive-strength = <4>;
+				bias-pull-up;
+			};
+		};
+	};
+
+	sdhci@f9824900 {
+		status = "ok";
+
+		vmmc-supply = <&pma8084_l20>;
+		vqmmc-supply = <&pma8084_s4>;
+
+		bus-width = <8>;
+		non-removable;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sdhc1_pin_a>;
+	};
 };
 
 &spmi_bus {
Signature · 1 line
2.26.0
#6 lore raw

PATCH 5/6 ARM: dts: qcom: msm8974-klte: Remove inherited vreg_boost node

In reply to Iskren Chernev

From: Daniele Debernardi <[email protected]>

The Samsung klte does not have a vreg_boost node. vreg_boost also depends on pm8941-gpio which are not present on the klte.

---
 arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +2 -2
index de0bf6b7e732..ad26c83fee81 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "qcom-msm8974pro.dtsi"
-#include "qcom-pm8841.dtsi"
-#include "qcom-pm8941.dtsi"
 #include "qcom-pma8084.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -196,6 +194,8 @@ l27 {
 			};
 		};
 	};
+
+	/delete-node/ vreg-boost;
 };
 
 &soc {
Signature · 1 line
2.26.0
#7 lore raw

Re: [PATCH 5/6] ARM: dts: qcom: msm8974-klte: Remove inherited vreg_boost node

Quoted 5 lines · Iskren Chernev

From: Daniele Debernardi <[email protected]>

The Samsung klte does not have a vreg_boost node. vreg_boost also depends on pm8941-gpio which are not present on the klte.

May I ask what PMICs this device actually has, if it doesn't have a PM8941 GPIO?

Regards,
Bjorn

Quoted 30 lines
---
 arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +2 -2
index de0bf6b7e732..ad26c83fee81 100644
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "qcom-msm8974pro.dtsi"
-#include "qcom-pm8841.dtsi"
-#include "qcom-pm8941.dtsi"
 #include "qcom-pma8084.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -196,6 +194,8 @@ l27 {
 			};
 		};
 	};
+
+	/delete-node/ vreg-boost;
 };
 
 &soc {
Signature · 1 line
2.26.0
#8 lore raw

Re: [PATCH 5/6] ARM: dts: qcom: msm8974-klte: Remove inherited vreg_boost node

Quoted 2 lines · Bjorn Andersson

May I ask what PMICs this device actually has, if it doesn't have a PM8941 GPIO?

In terms of power, the device has PMA8084, MAX77826 (pure PMIC for touchpad, camera, other peripherals), MAX77804k (MFD with fuel gauge, charger, a few regulators + other). I'm sending a MAX77826 patch shortly :)

In terms of GPIO controllers, PMA8084 has some pins, and the SoC itself (qcom,msm8974-pinctrl) has gpio pins.

According to ./drivers/platform/msm/qpnp-revid.c from downstream, these devices are covered by similar drivers: "PM8941", "PM8841", "PM8019", "PM8226", "PM8110", "PMA8084", "PMI8962", "PMD9635", and my KLTE prints the PMA8084, after querying the hardware.

I still don't have the full picture yet, but I'm pretty confident there is no PM8941/PM8841 on the klte.

Regards,
Iskren

#9 lore raw

PATCH 6/6 ARM: dts: qcom: msm8974-klte: Add USB node

In reply to Iskren Chernev

From: Daniele Debernardi <[email protected]>

This introduces the usb node which can be used e.g. for USB_ETH

---
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +25 -0
index ad26c83fee81..691a3cf2dd96 100644
@@ -264,6 +264,31 @@ sdhci@f9824900 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&sdhc1_pin_a>;
 	};
+
+	usb@f9a55000 {
+		status = "ok";
+
+		phys = <&usb_hs1_phy>;
+		phy-select = <&tcsr 0xb000 0>;
+		/*extcon = <&smbb>, <&usb_id>;*/
+		/*vbus-supply = <&chg_otg>;*/
+
+		hnp-disable;
+		srp-disable;
+		adp-disable;
+
+		ulpi {
+			phy@a {
+				status = "ok";
+
+				v1p8-supply = <&pma8084_l6>;
+				v3p3-supply = <&pma8084_l24>;
+
+				/*extcon = <&smbb>;*/
+				qcom,init-seq = /bits/ 8 <0x1 0x64>;
+			};
+		};
+	};
 };
 
 &spmi_bus {
Signature · 1 line
2.26.0