On 27.06.2023 03:24, Dmitry Baryshkov wrote: > The PMICs are not a part of the SoC, so move PMICs to separate files and > include them from the board files. > > Suggested-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > --- Please split moving and cleaning up into separate patches. Also, please consider using interrupts-extended Konrad > arch/arm/boot/dts/qcom/pm8821.dtsi | 22 +++ > arch/arm/boot/dts/qcom/pm8921.dtsi | 126 +++++++++++++++++ > .../dts/qcom/qcom-apq8064-asus-nexus7-flo.dts | 6 +- > .../boot/dts/qcom/qcom-apq8064-cm-qs600.dts | 5 +- > .../boot/dts/qcom/qcom-apq8064-ifc6410.dts | 5 +- > .../qcom-apq8064-sony-xperia-lagan-yuga.dts | 5 +- > arch/arm/boot/dts/qcom/qcom-apq8064.dtsi | 132 +----------------- > 7 files changed, 169 insertions(+), 132 deletions(-) > create mode 100644 arch/arm/boot/dts/qcom/pm8821.dtsi > create mode 100644 arch/arm/boot/dts/qcom/pm8921.dtsi > > diff --git a/arch/arm/boot/dts/qcom/pm8821.dtsi b/arch/arm/boot/dts/qcom/pm8821.dtsi > new file mode 100644 > index 000000000000..064e3ba54e18 > --- /dev/null > +++ b/arch/arm/boot/dts/qcom/pm8821.dtsi > @@ -0,0 +1,22 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +/* This PMIC is used on a secondary SSBI bus */ > +&ssbi2 { > + pm8821: pmic { > + compatible = "qcom,pm8821"; > + interrupt-controller; > + #interrupt-cells = <2>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + pm8821_mpps: mpps@50 { > + compatible = "qcom,pm8821-mpp", "qcom,ssbi-mpp"; > + reg = <0x50>; > + gpio-controller; > + #gpio-cells = <2>; > + gpio-ranges = <&pm8821_mpps 0 0 4>; > + interrupt-controller; > + #interrupt-cells = <2>; > + }; > + }; > +}; > diff --git a/arch/arm/boot/dts/qcom/pm8921.dtsi b/arch/arm/boot/dts/qcom/pm8921.dtsi > new file mode 100644 > index 000000000000..63e95b56dcf1 > --- /dev/null > +++ b/arch/arm/boot/dts/qcom/pm8921.dtsi > @@ -0,0 +1,126 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +&ssbi { > + pm8921: pmic { > + compatible = "qcom,pm8921"; > + interrupt-controller; > + #interrupt-cells = <2>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + pwrkey@1c { > + compatible = "qcom,pm8921-pwrkey"; > + reg = <0x1c>; > + interrupt-parent = <&pm8921>; > + interrupts = <50 IRQ_TYPE_EDGE_RISING>, > + <51 IRQ_TYPE_EDGE_RISING>; > + debounce = <15625>; > + pull-up; > + }; > + > + pm8921_mpps: mpps@50 { > + compatible = "qcom,pm8921-mpp", > + "qcom,ssbi-mpp"; > + reg = <0x50>; > + gpio-controller; > + #gpio-cells = <2>; > + gpio-ranges = <&pm8921_mpps 0 0 12>; > + interrupt-controller; > + #interrupt-cells = <2>; > + }; > + > + rtc@11d { > + compatible = "qcom,pm8921-rtc"; > + reg = <0x11d>; > + interrupt-parent = <&pm8921>; > + interrupts = <39 IRQ_TYPE_EDGE_RISING>; > + allow-set-time; > + }; > + > + pm8921_gpio: gpio@150 { > + compatible = "qcom,pm8921-gpio", > + "qcom,ssbi-gpio"; > + reg = <0x150>; > + gpio-controller; > + #gpio-cells = <2>; > + gpio-ranges = <&pm8921_gpio 0 0 44>; > + interrupt-controller; > + #interrupt-cells = <2>; > + }; > + > + pm8921_xoadc: xoadc@197 { > + compatible = "qcom,pm8921-adc"; > + reg = <0x197>; > + interrupts-extended = <&pm8921 78 IRQ_TYPE_EDGE_RISING>; > + #address-cells = <2>; > + #size-cells = <0>; > + #io-channel-cells = <2>; > + > + vcoin: adc-channel@0 { > + reg = <0x00 0x00>; > + }; > + > + vbat: adc-channel@1 { > + reg = <0x00 0x01>; > + }; > + > + dcin: adc-channel@2 { > + reg = <0x00 0x02>; > + }; > + > + vph_pwr: adc-channel@4 { > + reg = <0x00 0x04>; > + }; > + > + batt_therm: adc-channel@8 { > + reg = <0x00 0x08>; > + }; > + > + batt_id: adc-channel@9 { > + reg = <0x00 0x09>; > + }; > + > + usb_vbus: adc-channel@a { > + reg = <0x00 0x0a>; > + }; > + > + die_temp: adc-channel@b { > + reg = <0x00 0x0b>; > + }; > + > + ref_625mv: adc-channel@c { > + reg = <0x00 0x0c>; > + }; > + > + ref_1250mv: adc-channel@d { > + reg = <0x00 0x0d>; > + }; > + > + chg_temp: adc-channel@e { > + reg = <0x00 0x0e>; > + }; > + > + ref_muxoff: adc-channel@f { > + reg = <0x00 0x0f>; > + }; > + }; > + }; > +}; > + > +/ { > + /* > + * These channels from the ADC are simply hardware monitors. > + * That is why the ADC is referred to as "HKADC" - HouseKeeping > + * ADC. > + */ > + iio-hwmon { > + compatible = "iio-hwmon"; > + io-channels = <&pm8921_xoadc 0x00 0x01>, /* Battery */ > + <&pm8921_xoadc 0x00 0x02>, /* DC in (charger) */ > + <&pm8921_xoadc 0x00 0x04>, /* VPH the main system voltage */ > + <&pm8921_xoadc 0x00 0x0b>, /* Die temperature */ > + <&pm8921_xoadc 0x00 0x0c>, /* Reference voltage 1.25V */ > + <&pm8921_xoadc 0x00 0x0d>, /* Reference voltage 0.625V */ > + <&pm8921_xoadc 0x00 0x0e>; /* Charger temperature */ > + }; > +}; > diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dts b/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dts > index 0e80a5a8e3c6..d5dee70620c2 100644 > --- a/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dts > +++ b/arch/arm/boot/dts/qcom/qcom-apq8064-asus-nexus7-flo.dts > @@ -1,8 +1,12 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include "qcom-apq8064-v2.0.dtsi" > #include <dt-bindings/gpio/gpio.h> > #include <dt-bindings/input/input.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > + > +#include "qcom-apq8064-v2.0.dtsi" > +#include "pm8821.dtsi" > +#include "pm8921.dtsi" > + > / { > model = "Asus Nexus7(flo)"; > compatible = "asus,nexus7-flo", "qcom,apq8064"; > diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064-cm-qs600.dts b/arch/arm/boot/dts/qcom/qcom-apq8064-cm-qs600.dts > index d6ecfd8addb7..ffd654ab0b57 100644 > --- a/arch/arm/boot/dts/qcom/qcom-apq8064-cm-qs600.dts > +++ b/arch/arm/boot/dts/qcom/qcom-apq8064-cm-qs600.dts > @@ -1,8 +1,11 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include "qcom-apq8064-v2.0.dtsi" > #include <dt-bindings/gpio/gpio.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > > +#include "qcom-apq8064-v2.0.dtsi" > +#include "pm8821.dtsi" > +#include "pm8921.dtsi" > + > / { > model = "CompuLab CM-QS600"; > compatible = "qcom,apq8064-cm-qs600", "qcom,apq8064"; > diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064-ifc6410.dts b/arch/arm/boot/dts/qcom/qcom-apq8064-ifc6410.dts > index 96307550523a..12bf8ea3fb93 100644 > --- a/arch/arm/boot/dts/qcom/qcom-apq8064-ifc6410.dts > +++ b/arch/arm/boot/dts/qcom/qcom-apq8064-ifc6410.dts > @@ -1,9 +1,12 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include "qcom-apq8064-v2.0.dtsi" > #include <dt-bindings/gpio/gpio.h> > #include <dt-bindings/leds/common.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > > +#include "qcom-apq8064-v2.0.dtsi" > +#include "pm8821.dtsi" > +#include "pm8921.dtsi" > + > / { > model = "Qualcomm APQ8064/IFC6410"; > compatible = "qcom,apq8064-ifc6410", "qcom,apq8064"; > diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064-sony-xperia-lagan-yuga.dts b/arch/arm/boot/dts/qcom/qcom-apq8064-sony-xperia-lagan-yuga.dts > index 9244512b74d1..53dd9d79556f 100644 > --- a/arch/arm/boot/dts/qcom/qcom-apq8064-sony-xperia-lagan-yuga.dts > +++ b/arch/arm/boot/dts/qcom/qcom-apq8064-sony-xperia-lagan-yuga.dts > @@ -1,10 +1,13 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include "qcom-apq8064-v2.0.dtsi" > #include <dt-bindings/gpio/gpio.h> > #include <dt-bindings/input/input.h> > #include <dt-bindings/mfd/qcom-rpm.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > > +#include "qcom-apq8064-v2.0.dtsi" > +#include "pm8821.dtsi" > +#include "pm8921.dtsi" > + > / { > model = "Sony Xperia Z"; > compatible = "sony,xperia-yuga", "qcom,apq8064"; > diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi > index 4f4393e11580..2a5a3b2fb8e9 100644 > --- a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi > +++ b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi > @@ -324,23 +324,6 @@ scm { > }; > }; > > - > - /* > - * These channels from the ADC are simply hardware monitors. > - * That is why the ADC is referred to as "HKADC" - HouseKeeping > - * ADC. > - */ > - iio-hwmon { > - compatible = "iio-hwmon"; > - io-channels = <&xoadc 0x00 0x01>, /* Battery */ > - <&xoadc 0x00 0x02>, /* DC in (charger) */ > - <&xoadc 0x00 0x04>, /* VPH the main system voltage */ > - <&xoadc 0x00 0x0b>, /* Die temperature */ > - <&xoadc 0x00 0x0c>, /* Reference voltage 1.25V */ > - <&xoadc 0x00 0x0d>, /* Reference voltage 0.625V */ > - <&xoadc 0x00 0x0e>; /* Charger temperature */ > - }; > - > soc: soc { > #address-cells = <1>; > #size-cells = <1>; > @@ -683,132 +666,25 @@ rng@1a500000 { > clock-names = "core"; > }; > > - ssbi@c00000 { > + ssbi2: ssbi@c00000 { > compatible = "qcom,ssbi"; > reg = <0x00c00000 0x1000>; > qcom,controller-type = "pmic-arbiter"; > > - pm8821: pmic { > - compatible = "qcom,pm8821"; > + pmic { > interrupt-parent = <&tlmm_pinmux>; > interrupts = <76 IRQ_TYPE_LEVEL_LOW>; > - #interrupt-cells = <2>; > - interrupt-controller; > - #address-cells = <1>; > - #size-cells = <0>; > - > - pm8821_mpps: mpps@50 { > - compatible = "qcom,pm8821-mpp", "qcom,ssbi-mpp"; > - reg = <0x50>; > - interrupt-controller; > - #interrupt-cells = <2>; > - gpio-controller; > - #gpio-cells = <2>; > - gpio-ranges = <&pm8821_mpps 0 0 4>; > - }; > }; > }; > > - ssbi@500000 { > + ssbi: ssbi@500000 { > compatible = "qcom,ssbi"; > reg = <0x00500000 0x1000>; > qcom,controller-type = "pmic-arbiter"; > > - pmicintc: pmic { > - compatible = "qcom,pm8921"; > + pmic { > interrupt-parent = <&tlmm_pinmux>; > interrupts = <74 8>; > - #interrupt-cells = <2>; > - interrupt-controller; > - #address-cells = <1>; > - #size-cells = <0>; > - > - pm8921_gpio: gpio@150 { > - > - compatible = "qcom,pm8921-gpio", > - "qcom,ssbi-gpio"; > - reg = <0x150>; > - interrupt-controller; > - #interrupt-cells = <2>; > - gpio-controller; > - gpio-ranges = <&pm8921_gpio 0 0 44>; > - #gpio-cells = <2>; > - > - }; > - > - pm8921_mpps: mpps@50 { > - compatible = "qcom,pm8921-mpp", > - "qcom,ssbi-mpp"; > - reg = <0x50>; > - gpio-controller; > - #gpio-cells = <2>; > - gpio-ranges = <&pm8921_mpps 0 0 12>; > - interrupt-controller; > - #interrupt-cells = <2>; > - }; > - > - rtc@11d { > - compatible = "qcom,pm8921-rtc"; > - interrupt-parent = <&pmicintc>; > - interrupts = <39 1>; > - reg = <0x11d>; > - allow-set-time; > - }; > - > - pwrkey@1c { > - compatible = "qcom,pm8921-pwrkey"; > - reg = <0x1c>; > - interrupt-parent = <&pmicintc>; > - interrupts = <50 1>, <51 1>; > - debounce = <15625>; > - pull-up; > - }; > - > - xoadc: xoadc@197 { > - compatible = "qcom,pm8921-adc"; > - reg = <0x197>; > - interrupts-extended = <&pmicintc 78 IRQ_TYPE_EDGE_RISING>; > - #address-cells = <2>; > - #size-cells = <0>; > - #io-channel-cells = <2>; > - > - vcoin: adc-channel@0 { > - reg = <0x00 0x00>; > - }; > - vbat: adc-channel@1 { > - reg = <0x00 0x01>; > - }; > - dcin: adc-channel@2 { > - reg = <0x00 0x02>; > - }; > - vph_pwr: adc-channel@4 { > - reg = <0x00 0x04>; > - }; > - batt_therm: adc-channel@8 { > - reg = <0x00 0x08>; > - }; > - batt_id: adc-channel@9 { > - reg = <0x00 0x09>; > - }; > - usb_vbus: adc-channel@a { > - reg = <0x00 0x0a>; > - }; > - die_temp: adc-channel@b { > - reg = <0x00 0x0b>; > - }; > - ref_625mv: adc-channel@c { > - reg = <0x00 0x0c>; > - }; > - ref_1250mv: adc-channel@d { > - reg = <0x00 0x0d>; > - }; > - chg_temp: adc-channel@e { > - reg = <0x00 0x0e>; > - }; > - ref_muxoff: adc-channel@f { > - reg = <0x00 0x0f>; > - }; > - }; > }; > }; >