[PATCH v2 20/22] arm64: dts: qcom: pm8150: convert to use dynamic SID/LABEL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SA8450p-based platforms have 4 instances of pm8150. Convert pm8150.dtsi
to use pmic-dyn-header.dtsi in order to support dynamic and label
assignment.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
---
 arch/arm64/boot/dts/qcom/pm8150.dtsi          | 53 ++++++++++++-------
 arch/arm64/boot/dts/qcom/pmic-dyn-footer.dtsi |  1 +
 2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/pm8150.dtsi b/arch/arm64/boot/dts/qcom/pm8150.dtsi
index db90c55fa2cf..77bb325e425b 100644
--- a/arch/arm64/boot/dts/qcom/pm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8150.dtsi
@@ -9,13 +9,28 @@
 #include <dt-bindings/spmi/spmi.h>
 #include <dt-bindings/iio/qcom,spmi-vadc.h>
 
+/* (Sadly) this PMIC can be configured to be at different SIDs */
+#ifndef PMIC_SID
+	#define PMIC_SID 0
+#endif
+
+#ifndef PMIC_SID1
+	#define PMIC_SID1 1
+#endif
+
+#ifndef PMIC_LABEL
+	#define PMIC_LABEL pm8150
+#endif
+
+#include "pmic-dyn-header.dtsi"
+
 / {
 	thermal-zones {
-		pm8150-thermal {
+		NODE(thermal) {
 			polling-delay-passive = <100>;
 			polling-delay = <0>;
 
-			thermal-sensors = <&pm8150_temp>;
+			thermal-sensors = <&LABEL(temp)>;
 
 			trips {
 				trip0 {
@@ -41,9 +56,9 @@ trip2 {
 };
 
 &spmi_bus {
-	pm8150_0: pmic@0 {
+	pmic@0 {
 		compatible = "qcom,pm8150", "qcom,spmi-pmic";
-		reg = <0x0 SPMI_USID>;
+		reg = <PMIC_SID SPMI_USID>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 
@@ -55,7 +70,7 @@ pon: pon@800 {
 
 			pon_pwrkey: pwrkey {
 				compatible = "qcom,pm8941-pwrkey";
-				interrupts = <0x0 0x8 0x0 IRQ_TYPE_EDGE_BOTH>;
+				interrupts = <PMIC_SID 0x8 0x0 IRQ_TYPE_EDGE_BOTH>;
 				debounce = <15625>;
 				bias-pull-up;
 				linux,code = <KEY_POWER>;
@@ -65,7 +80,7 @@ pon_pwrkey: pwrkey {
 
 			pon_resin: resin {
 				compatible = "qcom,pm8941-resin";
-				interrupts = <0x0 0x8 0x1 IRQ_TYPE_EDGE_BOTH>;
+				interrupts = <PMIC_SID 0x8 0x1 IRQ_TYPE_EDGE_BOTH>;
 				debounce = <15625>;
 				bias-pull-up;
 
@@ -73,22 +88,22 @@ pon_resin: resin {
 			};
 		};
 
-		pm8150_temp: temp-alarm@2400 {
+		LABEL(temp): temp-alarm@2400 {
 			compatible = "qcom,spmi-temp-alarm";
 			reg = <0x2400>;
-			interrupts = <0x0 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
-			io-channels = <&pm8150_adc ADC5_DIE_TEMP>;
+			interrupts = <PMIC_SID 0x24 0x0 IRQ_TYPE_EDGE_BOTH>;
+			io-channels = <&LABEL(adc) ADC5_DIE_TEMP>;
 			io-channel-names = "thermal";
 			#thermal-sensor-cells = <0>;
 		};
 
-		pm8150_adc: adc@3100 {
+		LABEL(adc): adc@3100 {
 			compatible = "qcom,spmi-adc5";
 			reg = <0x3100>;
 			#address-cells = <1>;
 			#size-cells = <0>;
 			#io-channel-cells = <1>;
-			interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
+			interrupts = <PMIC_SID 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
 
 			ref-gnd@0 {
 				reg = <ADC5_REF_GND>;
@@ -109,10 +124,10 @@ die-temp@6 {
 			};
 		};
 
-		pm8150_adc_tm: adc-tm@3500 {
+		LABEL(adc_tm): adc-tm@3500 {
 			compatible = "qcom,spmi-adc-tm5";
 			reg = <0x3500>;
-			interrupts = <0x0 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
+			interrupts = <PMIC_SID 0x35 0x0 IRQ_TYPE_EDGE_RISING>;
 			#thermal-sensor-cells = <1>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -123,24 +138,26 @@ rtc@6000 {
 			compatible = "qcom,pm8941-rtc";
 			reg = <0x6000>, <0x6100>;
 			reg-names = "rtc", "alarm";
-			interrupts = <0x0 0x61 0x1 IRQ_TYPE_NONE>;
+			interrupts = <PMIC_SID 0x61 0x1 IRQ_TYPE_NONE>;
 		};
 
-		pm8150_gpios: gpio@c000 {
+		LABEL(gpios): gpio@c000 {
 			compatible = "qcom,pm8150-gpio", "qcom,spmi-gpio";
 			reg = <0xc000>;
 			gpio-controller;
-			gpio-ranges = <&pm8150_gpios 0 0 10>;
+			gpio-ranges = <&LABEL(gpios) 0 0 10>;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
 	};
 
-	pmic@1 {
+	pmic@PMIC_SID1 {
 		compatible = "qcom,pm8150", "qcom,spmi-pmic";
-		reg = <0x1 SPMI_USID>;
+		reg = <PMIC_SID1 SPMI_USID>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 	};
 };
+
+#include "pmic-dyn-footer.dtsi"
diff --git a/arch/arm64/boot/dts/qcom/pmic-dyn-footer.dtsi b/arch/arm64/boot/dts/qcom/pmic-dyn-footer.dtsi
index 29b10e7fb8c3..83a2bada48ff 100644
--- a/arch/arm64/boot/dts/qcom/pmic-dyn-footer.dtsi
+++ b/arch/arm64/boot/dts/qcom/pmic-dyn-footer.dtsi
@@ -12,5 +12,6 @@
 #undef NODE
 
 #undef PMIC_SID
+#undef PMIC_SID1
 #undef PMIC_LABEL
 #undef PMIC_NODE
-- 
2.30.2




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux