devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: linux-arm-msm@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>,
	devicetree@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org
Subject: [PATCH 4/6] arm64: dts: qcom: pm8350: include SID into labels
Date: Wed, 29 Mar 2023 03:08:31 +0300	[thread overview]
Message-ID: <20230329000833.2507594-5-dmitry.baryshkov@linaro.org> (raw)
In-Reply-To: <20230329000833.2507594-1-dmitry.baryshkov@linaro.org>

The platform can use several instances of PM8350 PMIC. Include SID into
all the labels to simplify such platforms configuration.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 arch/arm64/boot/dts/qcom/pm8350.dtsi          | 31 +++++++++++++------
 .../dts/qcom/sm8350-sony-xperia-sagami.dtsi   |  4 +--
 .../dts/qcom/sm8450-sony-xperia-nagara.dtsi   |  4 +--
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/pm8350.dtsi b/arch/arm64/boot/dts/qcom/pm8350.dtsi
index 2dfeb99300d7..f1ef242760f2 100644
--- a/arch/arm64/boot/dts/qcom/pm8350.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8350.dtsi
@@ -6,21 +6,30 @@
 #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 PM8350_SID
+	#define PM8350_SID 1
+#endif
+
+#define __LABEL(pmic, sid, name) pmic ## _ ## sid ## _ ## name
+#define _LABEL(pmic, sid, name) __LABEL(pmic, sid, name)
+#define LABEL(name) _LABEL(pm8350, PM8350_SID, name)
+
 / {
 	thermal-zones {
-		pm8350_thermal: pm8350c-thermal {
+		LABEL(thermal): pm8350c-thermal {
 			polling-delay-passive = <100>;
 			polling-delay = <0>;
-			thermal-sensors = <&pm8350_temp_alarm>;
+			thermal-sensors = <&LABEL(temp_alarm)>;
 
 			trips {
-				pm8350_trip0: trip0 {
+				LABEL(trip0): trip0 {
 					temperature = <95000>;
 					hysteresis = <0>;
 					type = "passive";
 				};
 
-				pm8350_crit: pm8350c-crit {
+				LABEL(crit): pm8350c-crit {
 					temperature = <115000>;
 					hysteresis = <0>;
 					type = "critical";
@@ -33,25 +42,29 @@ pm8350_crit: pm8350c-crit {
 &spmi_bus {
 	pm8350: pmic@1 {
 		compatible = "qcom,pm8350", "qcom,spmi-pmic";
-		reg = <0x1 SPMI_USID>;
+		reg = <PM8350_SID SPMI_USID>;
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		pm8350_temp_alarm: temp-alarm@a00 {
+		LABEL(temp_alarm): temp-alarm@a00 {
 			compatible = "qcom,spmi-temp-alarm";
 			reg = <0xa00>;
-			interrupts = <0x1 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
+			interrupts = <PM8350_SID 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
 			#thermal-sensor-cells = <0>;
 		};
 
-		pm8350_gpios: gpio@8800 {
+		LABEL(gpios): gpio@8800 {
 			compatible = "qcom,pm8350-gpio", "qcom,spmi-gpio";
 			reg = <0x8800>;
 			gpio-controller;
-			gpio-ranges = <&pm8350_gpios 0 0 10>;
+			gpio-ranges = <&LABEL(gpios) 0 0 10>;
 			#gpio-cells = <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
 	};
 };
+
+#undef LABEL
+#undef _LABEL
+#undef __LABEL
diff --git a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
index e28f49e31b9f..5c09b1d8881b 100644
--- a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
@@ -72,7 +72,7 @@ key-camera-snapshot {
 
 		key-google-assist {
 			label = "Google Assistant Key";
-			gpios = <&pm8350_gpios 9 GPIO_ACTIVE_LOW>;
+			gpios = <&pm8350_1_gpios 9 GPIO_ACTIVE_LOW>;
 			linux,code = <KEY_LEFTMETA>;
 			debounce-interval = <15>;
 			linux,can-disable;
@@ -564,7 +564,7 @@ &mpss {
 	firmware-name = "qcom/sm8350/Sony/sagami/modem.mbn";
 };
 
-&pm8350_gpios {
+&pm8350_1_gpios {
 	gpio-line-names = "ASSIGN1_THERM", /* GPIO_1 */
 			  "LCD_ID",
 			  "SDR_MMW_THERM",
diff --git a/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi b/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
index 99e9b776b93d..d90e3fedb742 100644
--- a/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
@@ -56,7 +56,7 @@ key-camera-snapshot {
 		key-volume-down {
 			label = "Volume Down";
 			linux,code = <KEY_VOLUMEDOWN>;
-			gpios = <&pm8350_gpios 6 GPIO_ACTIVE_LOW>;
+			gpios = <&pm8350_1_gpios 6 GPIO_ACTIVE_LOW>;
 			debounce-interval = <15>;
 			linux,can-disable;
 			wakeup-source;
@@ -622,7 +622,7 @@ &pcie0_phy {
 	status = "okay";
 };
 
-&pm8350_gpios {
+&pm8350_1_gpios {
 	gpio-line-names = "ASSIGN1_THERM", /* GPIO_1 */
 			  "LCD_ID",
 			  "SDR_MMW_THERM",
-- 
2.30.2


  parent reply	other threads:[~2023-03-29  0:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  0:08 [PATCH 0/6] arm64: dts: qcom: sc8280xp: remove duplication in PMIC declarations Dmitry Baryshkov
2023-03-29  0:08 ` [PATCH 1/6] dt-bindings: iio: qcom,spmi-adc7-pmk8350.h: include sid into defines Dmitry Baryshkov
2023-03-29  0:21   ` Konrad Dybcio
2023-03-30  7:49   ` Krzysztof Kozlowski
2023-04-01 14:48   ` Jonathan Cameron
2023-04-01 14:59     ` Dmitry Baryshkov
2023-03-29  0:08 ` [PATCH 2/6] arm64: dts: qcom: pmk8350: rename pon label Dmitry Baryshkov
2023-03-29  0:22   ` Konrad Dybcio
2023-03-29  0:08 ` [PATCH 3/6] arm64: dts: qcom: use main pmk8350.dtsi for sc8280xp platform Dmitry Baryshkov
2023-03-29  0:27   ` Konrad Dybcio
2023-03-29  0:29     ` Konrad Dybcio
2023-03-29  0:35       ` Konrad Dybcio
2023-03-29 11:54         ` Dmitry Baryshkov
2023-03-29  0:08 ` Dmitry Baryshkov [this message]
2023-03-29  0:33   ` [PATCH 4/6] arm64: dts: qcom: pm8350: include SID into labels Konrad Dybcio
2023-03-29 10:51     ` Dmitry Baryshkov
2023-03-29  0:08 ` [PATCH 5/6] arm64: dts: qcom: sc8280xp*: use pm8350.dtsi Dmitry Baryshkov
2023-03-29  0:08 ` [PATCH 6/6] arm64: dts: qcom: sc8280xp*: use pm8350c.dtsi and pmr735a.dtsi Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230329000833.2507594-5-dmitry.baryshkov@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=johan+linaro@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).