Skip to contentSkip to conversation

arm64: dts: qcom: qcm6490-idp: enable PMIC Volume and Power buttons

PATCH Superseded Hui Liu 2 participants 2 messages Mar 1, 2024

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Hui Liu

author
#0 lore raw

PATCH v3 1/1 arm64: dts: qcom: qcm6490-idp: enable PMIC Volume and Power buttons

The Volume Down & Power buttons are controlled by the PMIC via the PON hardware, and the Volume Up is connected to a PMIC gpio.

Enable the necessary hardware and setup the GPIO state for the Volume Up gpio key.

---
Changes in v3:
- Update the commit more concise and explicit.
- remove "power-source" property and update the numeric value to defined name for "qcom,drive-strength".
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Update the commit description.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/qcom/qcm6490-idp.dts +43 -0
index acf145d1d97c..cf8f6d48bfc2 100644
@@ -9,7 +9,9 @@
 #define PM7250B_SID 8
 #define PM7250B_SID1 9
 
+#include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include "sc7280.dtsi"
 #include "pm7250b.dtsi"
@@ -39,6 +41,24 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+		label = "gpio-keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&key_vol_up_default>;
+
+		key-volume-up {
+			label = "volume_up";
+			gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
+			linux,input-type = <1>;
+			linux,code = <KEY_VOLUMEUP>;
+			wakeup-source;
+			debounce-interval = <15>;
+			linux,can-disable;
+		};
+	};
+
 	reserved-memory {
 		xbl_mem: xbl@80700000 {
 			reg = <0x0 0x80700000 0x0 0x100000>;
@@ -421,6 +441,16 @@ vreg_bob_3p296: bob {
 	};
 };
 
+&pm7325_gpios {
+	key_vol_up_default: key-vol-up-state {
+		pins = "gpio6";
+		function = "normal";
+		input-enable;
+		bias-pull-up;
+		qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
+	};
+};
+
 &pm8350c_pwm {
 	status = "okay";
 
@@ -448,6 +478,19 @@ led@3 {
 	};
 };
 
+&pmk8350_pon {
+	status = "okay";
+};
+
+&pon_pwrkey {
+	status = "okay";
+};
+
+&pon_resin {
+	linux,code = <KEY_VOLUMEDOWN>;
+	status = "okay";
+};
+
 &qupv3_id_0 {
 	status = "okay";
 };

---
base-commit: 23e11d0318521e8693459b0e4d23aec614b3b68b
change-id: 20240206-gpio-keys-138bbd850298

Best regards,

Signature · 1 line
Hui Liu <[email protected]>
#1 lore raw
Quoted 38 lines · On 1.03.2024 08:16, Hui Liu via B4 Relay wrote:

From: Hui Liu <[email protected]>

The Volume Down & Power buttons are controlled by the PMIC via the PON hardware, and the Volume Up is connected to a PMIC gpio.

Enable the necessary hardware and setup the GPIO state for the Volume Up gpio key.

---
Changes in v3:
- Update the commit more concise and explicit.
- remove "power-source" property and update the numeric value to defined name for "qcom,drive-strength".
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Update the commit description.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 arch/arm64/boot/dts/qcom/qcm6490-idp.dts | 43 ++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/qcom/qcm6490-idp.dts +2 -0
index acf145d1d97c..cf8f6d48bfc2 100644
@@ -9,7 +9,9 @@
 #define PM7250B_SID 8
 #define PM7250B_SID1 9
 
+#include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include "sc7280.dtsi"
 #include "pm7250b.dtsi"

arch/arm64/boot/dts/qcom/qcm6490-idp.dts chosen { · line 49

Quoted 9 lines
arch/arm64/boot/dts/qcom/qcm6490-idp.dts +6 -0
@@ -39,6 +41,24 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+		label = "gpio-keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&key_vol_up_default>;

These are backwards

arch/arm64/boot/dts/qcom/qcm6490-idp.dts chosen { · line 52

Quoted 3 lines
arch/arm64/boot/dts/qcom/qcm6490-idp.dts +3 -0
+
+		key-volume-up {
+			label = "volume_up";

"Volume Up"?

arch/arm64/boot/dts/qcom/qcm6490-idp.dts chosen { · line 54

Quoted 2 lines
arch/arm64/boot/dts/qcom/qcm6490-idp.dts +2 -0
+			gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
+			linux,input-type = <1>;

Documentation/devicetree/bindings/input/gpio-keys.yaml:
linux,input-type:
default: 1 # EV_KEY

Konrad