Message ID | 20230401220810.3563708-9-dmitry.baryshkov@linaro.org (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | arm64: dts: qcom: remove duplication in PMIC declarations | expand |
On 2.04.2023 00:07, Dmitry Baryshkov wrote: > Several next patches are going to introduce flexibility into several > other PMICs in order to support variable SID and node labels. This will > result in close duplication of several similar preprocessor > constructions. Having a drop the 'a' per-PMIC defines would be error prone and can > result in hard-to-notices hard-to-notice mistakes. Thus rename PMK8350_SID to a generic > PMIC_SID. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Konrad > arch/arm64/boot/dts/qcom/pmk8350.dtsi | 20 ++++++++++--------- > .../qcom/sm6375-sony-xperia-murray-pdx225.dts | 7 ++++--- > .../boot/dts/qcom/sm7225-fairphone-fp4.dts | 6 +++--- > 3 files changed, 18 insertions(+), 15 deletions(-) > > diff --git a/arch/arm64/boot/dts/qcom/pmk8350.dtsi b/arch/arm64/boot/dts/qcom/pmk8350.dtsi > index 26e40dbfc173..02e7518ab57b 100644 > --- a/arch/arm64/boot/dts/qcom/pmk8350.dtsi > +++ b/arch/arm64/boot/dts/qcom/pmk8350.dtsi > @@ -9,14 +9,14 @@ > #include <dt-bindings/spmi/spmi.h> > > /* (Sadly) this PMIC can be configured to be at different SIDs */ > -#ifndef PMK8350_SID > - #define PMK8350_SID 0 > +#ifndef PMIC_SID > + #define PMIC_SID 0 > #endif > > &spmi_bus { > - pmk8350: pmic@PMK8350_SID { > + pmk8350: pmic@PMIC_SID { > compatible = "qcom,pmk8350", "qcom,spmi-pmic"; > - reg = <PMK8350_SID SPMI_USID>; > + reg = <PMIC_SID SPMI_USID>; > #address-cells = <1>; > #size-cells = <0>; > > @@ -27,14 +27,14 @@ pmk8350_pon: pon@1300 { > > pmk8350_pon_pwrkey: pwrkey { > compatible = "qcom,pmk8350-pwrkey"; > - interrupts = <PMK8350_SID 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; > + interrupts = <PMIC_SID 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; > linux,code = <KEY_POWER>; > status = "disabled"; > }; > > pmk8350_pon_resin: resin { > compatible = "qcom,pmk8350-resin"; > - interrupts = <PMK8350_SID 0x13 0x6 IRQ_TYPE_EDGE_BOTH>; > + interrupts = <PMIC_SID 0x13 0x6 IRQ_TYPE_EDGE_BOTH>; > status = "disabled"; > }; > }; > @@ -44,14 +44,14 @@ pmk8350_vadc: adc@3100 { > reg = <0x3100>; > #address-cells = <1>; > #size-cells = <0>; > - interrupts = <PMK8350_SID 0x31 0x0 IRQ_TYPE_EDGE_RISING>; > + interrupts = <PMIC_SID 0x31 0x0 IRQ_TYPE_EDGE_RISING>; > #io-channel-cells = <1>; > }; > > pmk8350_adc_tm: adc-tm@3400 { > compatible = "qcom,adc-tm7"; > reg = <0x3400>; > - interrupts = <PMK8350_SID 0x34 0x0 IRQ_TYPE_EDGE_RISING>; > + interrupts = <PMIC_SID 0x34 0x0 IRQ_TYPE_EDGE_RISING>; > #address-cells = <1>; > #size-cells = <0>; > #thermal-sensor-cells = <1>; > @@ -62,7 +62,7 @@ pmk8350_rtc: rtc@6100 { > compatible = "qcom,pmk8350-rtc"; > reg = <0x6100>, <0x6200>; > reg-names = "rtc", "alarm"; > - interrupts = <PMK8350_SID 0x62 0x1 IRQ_TYPE_EDGE_RISING>; > + interrupts = <PMIC_SID 0x62 0x1 IRQ_TYPE_EDGE_RISING>; > status = "disabled"; > }; > > @@ -86,3 +86,5 @@ pmk8350_gpios: gpio@b000 { > }; > }; > }; > + > +#undef PMIC_SID > diff --git a/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts b/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts > index b691c3834b6b..863fc1f4b0b6 100644 > --- a/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts > +++ b/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts > @@ -5,13 +5,14 @@ > > /dts-v1/; > > -/* PMK8350 is configured to use SID6 instead of 0 */ > -#define PMK8350_SID 6 > - > #include <dt-bindings/gpio/gpio.h> > #include "sm6375.dtsi" > #include "pm6125.dtsi" > + > +/* PMK8350 is configured to use SID6 instead of 0 */ > +#define PMIC_SID 6 > #include "pmk8350.dtsi" > + > #include "pmr735a.dtsi" > > /* PM6125 PON is used and we can't have duplicate labels */ > diff --git a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts > index af6cf4fbddc7..965b37245007 100644 > --- a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts > +++ b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts > @@ -5,9 +5,6 @@ > > /dts-v1/; > > -/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */ > -#define PMK8350_SID 6 > - > #include <dt-bindings/gpio/gpio.h> > #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > #include <dt-bindings/input/input.h> > @@ -18,6 +15,9 @@ > #include "pm6150l.dtsi" > #include "pm6350.dtsi" > #include "pm7250b.dtsi" > + > +/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */ > +#define PMIC_SID 6 > #include "pmk8350.dtsi" > > / {
diff --git a/arch/arm64/boot/dts/qcom/pmk8350.dtsi b/arch/arm64/boot/dts/qcom/pmk8350.dtsi index 26e40dbfc173..02e7518ab57b 100644 --- a/arch/arm64/boot/dts/qcom/pmk8350.dtsi +++ b/arch/arm64/boot/dts/qcom/pmk8350.dtsi @@ -9,14 +9,14 @@ #include <dt-bindings/spmi/spmi.h> /* (Sadly) this PMIC can be configured to be at different SIDs */ -#ifndef PMK8350_SID - #define PMK8350_SID 0 +#ifndef PMIC_SID + #define PMIC_SID 0 #endif &spmi_bus { - pmk8350: pmic@PMK8350_SID { + pmk8350: pmic@PMIC_SID { compatible = "qcom,pmk8350", "qcom,spmi-pmic"; - reg = <PMK8350_SID SPMI_USID>; + reg = <PMIC_SID SPMI_USID>; #address-cells = <1>; #size-cells = <0>; @@ -27,14 +27,14 @@ pmk8350_pon: pon@1300 { pmk8350_pon_pwrkey: pwrkey { compatible = "qcom,pmk8350-pwrkey"; - interrupts = <PMK8350_SID 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; + interrupts = <PMIC_SID 0x13 0x7 IRQ_TYPE_EDGE_BOTH>; linux,code = <KEY_POWER>; status = "disabled"; }; pmk8350_pon_resin: resin { compatible = "qcom,pmk8350-resin"; - interrupts = <PMK8350_SID 0x13 0x6 IRQ_TYPE_EDGE_BOTH>; + interrupts = <PMIC_SID 0x13 0x6 IRQ_TYPE_EDGE_BOTH>; status = "disabled"; }; }; @@ -44,14 +44,14 @@ pmk8350_vadc: adc@3100 { reg = <0x3100>; #address-cells = <1>; #size-cells = <0>; - interrupts = <PMK8350_SID 0x31 0x0 IRQ_TYPE_EDGE_RISING>; + interrupts = <PMIC_SID 0x31 0x0 IRQ_TYPE_EDGE_RISING>; #io-channel-cells = <1>; }; pmk8350_adc_tm: adc-tm@3400 { compatible = "qcom,adc-tm7"; reg = <0x3400>; - interrupts = <PMK8350_SID 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + interrupts = <PMIC_SID 0x34 0x0 IRQ_TYPE_EDGE_RISING>; #address-cells = <1>; #size-cells = <0>; #thermal-sensor-cells = <1>; @@ -62,7 +62,7 @@ pmk8350_rtc: rtc@6100 { compatible = "qcom,pmk8350-rtc"; reg = <0x6100>, <0x6200>; reg-names = "rtc", "alarm"; - interrupts = <PMK8350_SID 0x62 0x1 IRQ_TYPE_EDGE_RISING>; + interrupts = <PMIC_SID 0x62 0x1 IRQ_TYPE_EDGE_RISING>; status = "disabled"; }; @@ -86,3 +86,5 @@ pmk8350_gpios: gpio@b000 { }; }; }; + +#undef PMIC_SID diff --git a/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts b/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts index b691c3834b6b..863fc1f4b0b6 100644 --- a/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts +++ b/arch/arm64/boot/dts/qcom/sm6375-sony-xperia-murray-pdx225.dts @@ -5,13 +5,14 @@ /dts-v1/; -/* PMK8350 is configured to use SID6 instead of 0 */ -#define PMK8350_SID 6 - #include <dt-bindings/gpio/gpio.h> #include "sm6375.dtsi" #include "pm6125.dtsi" + +/* PMK8350 is configured to use SID6 instead of 0 */ +#define PMIC_SID 6 #include "pmk8350.dtsi" + #include "pmr735a.dtsi" /* PM6125 PON is used and we can't have duplicate labels */ diff --git a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts index af6cf4fbddc7..965b37245007 100644 --- a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts +++ b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts @@ -5,9 +5,6 @@ /dts-v1/; -/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */ -#define PMK8350_SID 6 - #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> #include <dt-bindings/input/input.h> @@ -18,6 +15,9 @@ #include "pm6150l.dtsi" #include "pm6350.dtsi" #include "pm7250b.dtsi" + +/* PMK8350 (in reality a PMK8003) is configured to use SID6 instead of 0 */ +#define PMIC_SID 6 #include "pmk8350.dtsi" / {
Several next patches are going to introduce flexibility into several other PMICs in order to support variable SID and node labels. This will result in close duplication of several similar preprocessor constructions. Having a per-PMIC defines would be error prone and can result in hard-to-notices mistakes. Thus rename PMK8350_SID to a generic PMIC_SID. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- arch/arm64/boot/dts/qcom/pmk8350.dtsi | 20 ++++++++++--------- .../qcom/sm6375-sony-xperia-murray-pdx225.dts | 7 ++++--- .../boot/dts/qcom/sm7225-fairphone-fp4.dts | 6 +++--- 3 files changed, 18 insertions(+), 15 deletions(-)