diff mbox series

[v2,16/22] arm64: dts: qcom: pm8350c: allow overriding SID and label

Message ID 20230401220810.3563708-17-dmitry.baryshkov@linaro.org
State New
Headers show
Series arm64: dts: qcom: remove duplication in PMIC declarations | expand

Commit Message

Dmitry Baryshkov April 1, 2023, 10:08 p.m. UTC
The platform can use several instances of PM8350C PMIC. Allow overriding
the SID and node labels inside pm8350c.dtsi.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/pm8350c.dtsi b/arch/arm64/boot/dts/qcom/pm8350c.dtsi
index ee25c07ce31d..ddfc8fd6bb3e 100644
--- a/arch/arm64/boot/dts/qcom/pm8350c.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8350c.dtsi
@@ -6,12 +6,23 @@ 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/spmi/spmi.h>
 
+/* (Sadly) this PMIC can be configured to be at different SIDs */
+#ifndef PMIC_SID
+	#define PMIC_SID 2
+#endif
+
+#ifndef PMIC_LABEL
+	#define PMIC_LABEL pm8350c
+#endif
+
+#include "pmic-dyn-header.dtsi"
+
 / {
 	thermal-zones {
 		pm8350c-thermal {
 			polling-delay-passive = <100>;
 			polling-delay = <0>;
-			thermal-sensors = <&pm8350c_temp_alarm>;
+			thermal-sensors = <&LABEL(temp_alarm)>;
 
 			trips {
 				trip0 {
@@ -31,33 +42,35 @@  pm8350c-crit {
 };
 
 &spmi_bus {
-	pm8350c: pmic@2 {
+	pmic@PMIC_SID {
 		compatible = "qcom,pm8350c", "qcom,spmi-pmic";
-		reg = <0x2 SPMI_USID>;
+		reg = <PMIC_SID SPMI_USID>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		pm8350c_temp_alarm: temp-alarm@a00 {
+		LABEL(temp_alarm): temp-alarm@a00 {
 			compatible = "qcom,spmi-temp-alarm";
 			reg = <0xa00>;
 			interrupts = <0x2 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
 			#thermal-sensor-cells = <0>;
 		};
 
-		pm8350c_gpios: gpio@8800 {
+		LABEL(gpios): gpio@8800 {
 			compatible = "qcom,pm8350c-gpio", "qcom,spmi-gpio";
 			reg = <0x8800>;
 			gpio-controller;
-			gpio-ranges = <&pm8350c_gpios 0 0 9>;
+			gpio-ranges = <&LABEL(gpios) 0 0 9>;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
 
-		pm8350c_pwm: pwm {
+		LABEL(pwm): pwm {
 			compatible = "qcom,pm8350c-pwm";
 			#pwm-cells = <2>;
 			status = "disabled";
 		};
 	};
 };
+
+#include "pmic-dyn-footer.dtsi"