mbox series

[00/15] ARM: dts: qcom: cleanup PMIC usage

Message ID 20230627012422.206077-1-dmitry.baryshkov@linaro.org
Headers show
Series ARM: dts: qcom: cleanup PMIC usage | expand

Message

Dmitry Baryshkov June 27, 2023, 1:24 a.m. UTC
While reviewing APQ8064 CPUFreq patchset, Konrad pointed out that PMICs
are not a part of SoC and as such do not belong to the per-SoC files.

Cleanup the way 32-bit Qualcomm platforms treat PMICs:

- Move SSBI PMICs to separate files (as a bonus merging two different
  instances of PM8921, benefitting both platforms).

- Include such PMIC files only from the board files, keeping SoC file
  generic.

- Move RPM regulator definitions to board files too. They do not belong
  to the SoC dtsi files for the same reason.

- Move PMIC-specific GPIOs and supply properties to individual board
  files.

Dmitry Baryshkov (15):
  ARM: dts: qcom: apq8064: correct XOADC register address
  ARM: dts: qcom: msm8960: introduce label for PMIC keypad
  ARM: dts: qcom: msm8660-surf: use keypad label directly
  ARM: dts: qcom: apq8064-nexus7: move sdcc1 node to proper place
  ARM: dts: qcom: mdm9615-wp8548-mangoh-green: group include clauses
  ARM: dts: qcom: strip prefix from PMIC files
  ARM: dts: qcom: apq8064: split PMICs to separate dtsi files
  ARM: dts: qcom: mdm9615: split PMIC to separate dtsi files
  ARM: dts: qcom: msm8660: split PMIC to separate dtsi files
  ARM: dts: qcom: msm8960: split PMIC to separate dtsi files
  ARM: dts: qcom: msm8974: move vreg-boost GPIO to board files
  ARM: dts: qcom: apq8064: move RPM regulators to board files
  ARM: dts: qcom: mdm9615: move RPM regulators to board files
  ARM: dts: qcom: msm8660: move RPM regulators to board files
  ARM: dts: qcom: msm8960: drop useless rpm regulators node

 arch/arm/boot/dts/qcom/pm8018.dtsi            |  57 +++++
 arch/arm/boot/dts/qcom/pm8058.dtsi            | 162 +++++++++++++
 .../qcom/{qcom-pm8226.dtsi => pm8226.dtsi}    |   0
 arch/arm/boot/dts/qcom/pm8821.dtsi            |  22 ++
 .../qcom/{qcom-pm8841.dtsi => pm8841.dtsi}    |   0
 arch/arm/boot/dts/qcom/pm8921.dtsi            | 137 +++++++++++
 .../qcom/{qcom-pm8941.dtsi => pm8941.dtsi}    |   0
 .../qcom/{qcom-pma8084.dtsi => pma8084.dtsi}  |   0
 .../dts/qcom/{qcom-pmx55.dtsi => pmx55.dtsi}  |   0
 .../dts/qcom/{qcom-pmx65.dtsi => pmx65.dtsi}  |   0
 .../dts/qcom/qcom-apq8026-asus-sparrow.dts    |   2 +-
 .../dts/qcom/qcom-apq8026-huawei-sturgeon.dts |   2 +-
 .../boot/dts/qcom/qcom-apq8026-lg-lenok.dts   |   2 +-
 .../qcom-apq8026-samsung-matisse-wifi.dts     |   2 +-
 .../dts/qcom/qcom-apq8060-dragonboard.dts     | 146 +++++++-----
 .../dts/qcom/qcom-apq8064-asus-nexus7-flo.dts |  69 +++---
 .../boot/dts/qcom/qcom-apq8064-cm-qs600.dts   |  31 +--
 .../boot/dts/qcom/qcom-apq8064-ifc6410.dts    |  38 ++--
 .../qcom-apq8064-sony-xperia-lagan-yuga.dts   | 110 +++++----
 arch/arm/boot/dts/qcom/qcom-apq8064.dtsi      | 195 +---------------
 .../dts/qcom/qcom-apq8074-dragonboard.dts     |   4 +-
 .../boot/dts/qcom/qcom-apq8084-ifc6540.dts    |   2 +-
 arch/arm/boot/dts/qcom/qcom-apq8084-mtp.dts   |   2 +-
 .../qcom/qcom-mdm9615-wp8548-mangoh-green.dts |   4 +-
 .../boot/dts/qcom/qcom-mdm9615-wp8548.dtsi    | 139 +++++++++++-
 arch/arm/boot/dts/qcom/qcom-mdm9615.dtsi      | 180 +--------------
 arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts  |  59 +++--
 arch/arm/boot/dts/qcom/qcom-msm8660.dtsi      | 214 +-----------------
 arch/arm/boot/dts/qcom/qcom-msm8960-cdp.dts   |  21 +-
 .../qcom/qcom-msm8960-samsung-expressatt.dts  |   3 +-
 arch/arm/boot/dts/qcom/qcom-msm8960.dtsi      |  42 +---
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    |   8 +-
 .../qcom/qcom-msm8974-sony-xperia-rhine.dtsi  |   8 +-
 arch/arm/boot/dts/qcom/qcom-msm8974.dtsi      |   1 -
 .../qcom/qcom-msm8974pro-fairphone-fp2.dts    |   8 +-
 .../qcom/qcom-msm8974pro-oneplus-bacon.dts    |   8 +-
 .../dts/qcom/qcom-msm8974pro-samsung-klte.dts |   2 +-
 ...-msm8974pro-sony-xperia-shinano-castor.dts |   8 +-
 arch/arm/boot/dts/qcom/qcom-sdx55-mtp.dts     |   2 +-
 arch/arm/boot/dts/qcom/qcom-sdx55-t55.dts     |   2 +-
 .../dts/qcom/qcom-sdx55-telit-fn980-tlb.dts   |   2 +-
 arch/arm/boot/dts/qcom/qcom-sdx65-mtp.dts     |   2 +-
 42 files changed, 851 insertions(+), 845 deletions(-)
 create mode 100644 arch/arm/boot/dts/qcom/pm8018.dtsi
 create mode 100644 arch/arm/boot/dts/qcom/pm8058.dtsi
 rename arch/arm/boot/dts/qcom/{qcom-pm8226.dtsi => pm8226.dtsi} (100%)
 create mode 100644 arch/arm/boot/dts/qcom/pm8821.dtsi
 rename arch/arm/boot/dts/qcom/{qcom-pm8841.dtsi => pm8841.dtsi} (100%)
 create mode 100644 arch/arm/boot/dts/qcom/pm8921.dtsi
 rename arch/arm/boot/dts/qcom/{qcom-pm8941.dtsi => pm8941.dtsi} (100%)
 rename arch/arm/boot/dts/qcom/{qcom-pma8084.dtsi => pma8084.dtsi} (100%)
 rename arch/arm/boot/dts/qcom/{qcom-pmx55.dtsi => pmx55.dtsi} (100%)
 rename arch/arm/boot/dts/qcom/{qcom-pmx65.dtsi => pmx65.dtsi} (100%)

Comments

Konrad Dybcio June 27, 2023, 11:03 a.m. UTC | #1
On 27.06.2023 03:24, Dmitry Baryshkov wrote:
> The XOADC is present at the address 0x197 rather than just 197. It
> doesn't change a lot (since the driver hardcodes all register
> addresses), but the DT should present correct address anyway.
> 
> Fixes: c4b70883ee33 ("ARM: dts: add XOADC and IIO HWMON to APQ8064")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm/boot/dts/qcom/qcom-apq8064.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi
> index d2289205ff81..4f4393e11580 100644
> --- a/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi
> +++ b/arch/arm/boot/dts/qcom/qcom-apq8064.dtsi
> @@ -766,7 +766,7 @@ pwrkey@1c {
>  
>  				xoadc: xoadc@197 {
>  					compatible = "qcom,pm8921-adc";
> -					reg = <197>;
> +					reg = <0x197>;
>  					interrupts-extended = <&pmicintc 78 IRQ_TYPE_EDGE_RISING>;
>  					#address-cells = <2>;
>  					#size-cells = <0>;
Konrad Dybcio June 27, 2023, 11:05 a.m. UTC | #2
On 27.06.2023 03:24, Dmitry Baryshkov wrote:
> Directly use pm8058_keypad to declare keypad properties instead of
> referencing pm8058 top-level node.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
was this board some sort of a laptop?

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts | 50 ++++++++++----------
>  1 file changed, 24 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts b/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> index be18f1be29a1..86fbb6dfdc2a 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> @@ -34,32 +34,30 @@ &gsbi12_serial {
>  	status = "okay";
>  };
>  
> -&pm8058 {
> -	keypad@148 {
> -		linux,keymap = <
> -			MATRIX_KEY(0, 0, KEY_FN_F1)
> -			MATRIX_KEY(0, 1, KEY_UP)
> -			MATRIX_KEY(0, 2, KEY_LEFT)
> -			MATRIX_KEY(0, 3, KEY_VOLUMEUP)
> -			MATRIX_KEY(1, 0, KEY_FN_F2)
> -			MATRIX_KEY(1, 1, KEY_RIGHT)
> -			MATRIX_KEY(1, 2, KEY_DOWN)
> -			MATRIX_KEY(1, 3, KEY_VOLUMEDOWN)
> -			MATRIX_KEY(2, 3, KEY_ENTER)
> -			MATRIX_KEY(4, 0, KEY_CAMERA_FOCUS)
> -			MATRIX_KEY(4, 1, KEY_UP)
> -			MATRIX_KEY(4, 2, KEY_LEFT)
> -			MATRIX_KEY(4, 3, KEY_HOME)
> -			MATRIX_KEY(4, 4, KEY_FN_F3)
> -			MATRIX_KEY(5, 0, KEY_CAMERA)
> -			MATRIX_KEY(5, 1, KEY_RIGHT)
> -			MATRIX_KEY(5, 2, KEY_DOWN)
> -			MATRIX_KEY(5, 3, KEY_BACK)
> -			MATRIX_KEY(5, 4, KEY_MENU)
> -			>;
> -		keypad,num-rows = <6>;
> -		keypad,num-columns = <5>;
> -	};
> +&pm8058_keypad {
> +	linux,keymap = <
> +		MATRIX_KEY(0, 0, KEY_FN_F1)
> +		MATRIX_KEY(0, 1, KEY_UP)
> +		MATRIX_KEY(0, 2, KEY_LEFT)
> +		MATRIX_KEY(0, 3, KEY_VOLUMEUP)
> +		MATRIX_KEY(1, 0, KEY_FN_F2)
> +		MATRIX_KEY(1, 1, KEY_RIGHT)
> +		MATRIX_KEY(1, 2, KEY_DOWN)
> +		MATRIX_KEY(1, 3, KEY_VOLUMEDOWN)
> +		MATRIX_KEY(2, 3, KEY_ENTER)
> +		MATRIX_KEY(4, 0, KEY_CAMERA_FOCUS)
> +		MATRIX_KEY(4, 1, KEY_UP)
> +		MATRIX_KEY(4, 2, KEY_LEFT)
> +		MATRIX_KEY(4, 3, KEY_HOME)
> +		MATRIX_KEY(4, 4, KEY_FN_F3)
> +		MATRIX_KEY(5, 0, KEY_CAMERA)
> +		MATRIX_KEY(5, 1, KEY_RIGHT)
> +		MATRIX_KEY(5, 2, KEY_DOWN)
> +		MATRIX_KEY(5, 3, KEY_BACK)
> +		MATRIX_KEY(5, 4, KEY_MENU)
> +		>;
> +	keypad,num-rows = <6>;
> +	keypad,num-columns = <5>;
>  };
>  
>  /* eMMC */
Konrad Dybcio June 27, 2023, 11:06 a.m. UTC | #3
On 27.06.2023 03:24, Dmitry Baryshkov wrote:
> Group file inclusion to follow contemporary practice.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts b/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts
> index b269fdca1460..e3b4b93c3d38 100644
> --- a/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-mdm9615-wp8548-mangoh-green.dts
> @@ -6,11 +6,11 @@
>   * Author : Neil Armstrong <narmstrong@baylibre.com>
>   */
>  
> +#include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> +#include <dt-bindings/interrupt-controller/irq.h>
>  
>  #include "qcom-mdm9615-wp8548.dtsi"
> -#include <dt-bindings/interrupt-controller/irq.h>
> -#include <dt-bindings/gpio/gpio.h>
>  
>  / {
>  	model = "MangOH Green with WP8548 Module";
Konrad Dybcio June 27, 2023, 11:12 a.m. UTC | #4
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@linaro.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
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>;
> -					};
> -				};
>  			};
>  		};
>
Konrad Dybcio June 27, 2023, 11:21 a.m. UTC | #5
On 27.06.2023 03:24, Dmitry Baryshkov wrote:
> The set of regulators available over the RPM requests is not a property
> of the SoC. Move them to board files.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  .../dts/qcom/qcom-apq8060-dragonboard.dts     | 141 ++++++++++++------
>  arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts  |  10 ++
>  arch/arm/boot/dts/qcom/qcom-msm8660.dtsi      |  66 --------
>  3 files changed, 102 insertions(+), 115 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts
> index 20de516a8deb..8a511f69d800 100644
> --- a/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-apq8060-dragonboard.dts
> @@ -449,6 +449,8 @@ &rpm {
>  	 * that means
>  	 */
>  	regulators-0 {
> +		compatible = "qcom,rpm-pm8901-regulators";
> +
>  		vdd_l0-supply = <&pm8901_s4>;
>  		vdd_l1-supply = <&vph>;
>  		vdd_l2-supply = <&vph>;
> @@ -466,57 +468,63 @@ regulators-0 {
>  		lvs3_in-supply = <&pm8058_s2>;
>  		mvs_in-supply = <&pm8058_s3>;
>  
> -		l0 {
> +		pm8901_l0: l0 {
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
> -		l1 {
> +
> +		pm8901_l1: l1 {
>  			regulator-min-microvolt = <3300000>;
>  			regulator-max-microvolt = <3300000>;
>  			bias-pull-down;
>  		};
> -		l2 {
> +
> +		pm8901_l2: l2 {
>  			/* TMA340 requires strictly 3.3V */
>  			regulator-min-microvolt = <3300000>;
>  			regulator-max-microvolt = <3300000>;
>  			bias-pull-down;
>  		};
> -		l3 {
> +
> +		pm8901_l3: l3 {
>  			regulator-min-microvolt = <3300000>;
>  			regulator-max-microvolt = <3300000>;
>  			bias-pull-down;
>  		};
> -		l4 {
> +
> +		pm8901_l4: l4 {
>  			regulator-min-microvolt = <2600000>;
>  			regulator-max-microvolt = <2600000>;
>  			bias-pull-down;
>  		};
> -		l5 {
> +
> +		pm8901_l5: l5 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  			bias-pull-down;
>  		};
> -		l6 {
> +
> +		pm8901_l6: l6 {
>  			regulator-min-microvolt = <2200000>;
>  			regulator-max-microvolt = <2200000>;
>  			bias-pull-down;
>  		};
>  
>  		/* s0 and s1 are SAW regulators controlled over SPM */
> -		s2 {
> +		pm8901_s2: s2 {
>  			regulator-min-microvolt = <1300000>;
>  			regulator-max-microvolt = <1300000>;
>  			qcom,switch-mode-frequency = <1600000>;
>  			bias-pull-down;
>  		};
> -		s3 {
> +		pm8901_s3: s3 {
>  			regulator-min-microvolt = <1100000>;
>  			regulator-max-microvolt = <1100000>;
>  			qcom,switch-mode-frequency = <1600000>;
>  			bias-pull-down;
>  		};
> -		s4 {
> +		pm8901_s4: s4 {
>  			regulator-min-microvolt = <1225000>;
>  			regulator-max-microvolt = <1225000>;
>  			qcom,switch-mode-frequency = <1600000>;
> @@ -524,17 +532,22 @@ s4 {
>  		};
>  
>  		/* LVS0 thru 3 and mvs are just switches */
> -		lvs0 {
> +		pm8901_lvs0: lvs0 {
>  			regulator-always-on;
>  		};
> -		lvs1 { };
> -		lvs2 { };
> -		lvs3 { };
> -		mvs { };
>  
> +		pm8901_lvs1: lvs1 { };
> +
> +		pm8901_lvs2: lvs2 { };
> +
> +		pm8901_lvs3: lvs3 { };
> +
> +		pm8901_mvs: mvs { };
>  	};
>  
>  	regulators-1 {
> +		compatible = "qcom,rpm-pm8058-regulators";
> +
>  		vdd_l0_l1_lvs-supply = <&pm8058_s3>;
>  		vdd_l2_l11_l12-supply = <&vph>;
>  		vdd_l3_l4_l5-supply = <&vph>;
> @@ -556,144 +569,169 @@ regulators-1 {
>  		vdd_s4-supply = <&vph>;
>  		vdd_ncp-supply = <&vph>;
>  
> -		l0 {
> +		pm8058_l0: l0 {
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
> -		l1 {
> +
> +		pm8058_l1: l1 {
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
> -		l2 {
> +
> +		pm8058_l2: l2 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <2600000>;
>  			bias-pull-down;
>  		};
> -		l3 {
> +
> +		pm8058_l3: l3 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			bias-pull-down;
>  		};
> -		l4 {
> +
> +		pm8058_l4: l4 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  			bias-pull-down;
>  		};
> -		l5 {
> +
> +		pm8058_l5: l5 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  			bias-pull-down;
>  		};
> -		l6 {
> +
> +		pm8058_l6: l6 {
>  			regulator-min-microvolt = <3000000>;
>  			regulator-max-microvolt = <3600000>;
>  			bias-pull-down;
>  		};
> -		l7 {
> +
> +		pm8058_l7: l7 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			bias-pull-down;
>  		};
> -		l8 {
> +
> +		pm8058_l8: l8 {
>  			regulator-min-microvolt = <2900000>;
>  			regulator-max-microvolt = <3050000>;
>  			bias-pull-down;
>  		};
> -		l9 {
> +
> +		pm8058_l9: l9 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			bias-pull-down;
>  		};
> -		l10 {
> +
> +		pm8058_l10: l10 {
>  			regulator-min-microvolt = <2600000>;
>  			regulator-max-microvolt = <2600000>;
>  			bias-pull-down;
>  		};
> -		l11 {
> +
> +		pm8058_l11: l11 {
>  			regulator-min-microvolt = <1500000>;
>  			regulator-max-microvolt = <1500000>;
>  			bias-pull-down;
>  		};
> -		l12 {
> +
> +		pm8058_l12: l12 {
>  			regulator-min-microvolt = <2900000>;
>  			regulator-max-microvolt = <2900000>;
>  			bias-pull-down;
>  		};
> -		l13 {
> +
> +		pm8058_l13: l13 {
>  			regulator-min-microvolt = <2050000>;
>  			regulator-max-microvolt = <2050000>;
>  			bias-pull-down;
>  		};
> -		l14 {
> +
> +		pm8058_l14: l14 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  		};
> -		l15 {
> +
> +		pm8058_l15: l15 {
>  			regulator-min-microvolt = <2850000>;
>  			regulator-max-microvolt = <2850000>;
>  			bias-pull-down;
>  		};
> -		l16 {
> +
> +		pm8058_l16: l16 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			bias-pull-down;
>  			regulator-always-on;
>  		};
> -		l17 {
> +
> +		pm8058_l17: l17 {
>  			// 1.5V according to schematic
>  			regulator-min-microvolt = <2600000>;
>  			regulator-max-microvolt = <2600000>;
>  			bias-pull-down;
>  		};
> -		l18 {
> +
> +		pm8058_l18: l18 {
>  			regulator-min-microvolt = <2200000>;
>  			regulator-max-microvolt = <2200000>;
>  			bias-pull-down;
>  		};
> -		l19 {
> +
> +		pm8058_l19: l19 {
>  			regulator-min-microvolt = <2500000>;
>  			regulator-max-microvolt = <2500000>;
>  			bias-pull-down;
>  		};
> -		l20 {
> +
> +		pm8058_l20: l20 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			bias-pull-down;
>  		};
> -		l21 {
> +
> +		pm8058_l21: l21 {
>  			// 1.1 V according to schematic
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  			regulator-always-on;
>  		};
> -		l22 {
> +
> +		pm8058_l22: l22 {
>  			// 1.2 V according to schematic
>  			regulator-min-microvolt = <1150000>;
>  			regulator-max-microvolt = <1150000>;
>  			bias-pull-down;
>  		};
> -		l23 {
> +
> +		pm8058_l23: l23 {
>  			// Unused
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
> -		l24 {
> +
> +		pm8058_l24: l24 {
>  			// Unused
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
> -		l25 {
> +
> +		pm8058_l25: l25 {
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1200000>;
>  			bias-pull-down;
>  		};
>  
> -		s0 {
> +		pm8058_s0: s0 {
>  			// regulator-min-microvolt = <500000>;
>  			// regulator-max-microvolt = <1325000>;
>  			regulator-min-microvolt = <1100000>;
> @@ -701,7 +739,8 @@ s0 {
>  			qcom,switch-mode-frequency = <1600000>;
>  			bias-pull-down;
>  		};
> -		s1 {
> +
> +		pm8058_s1: s1 {
>  			// regulator-min-microvolt = <500000>;
>  			// regulator-max-microvolt = <1250000>;
>  			regulator-min-microvolt = <1100000>;
> @@ -709,21 +748,24 @@ s1 {
>  			qcom,switch-mode-frequency = <1600000>;
>  			bias-pull-down;
>  		};
> -		s2 {
> +
> +		pm8058_s2: s2 {
>  			// 1.3 V according to schematic
>  			regulator-min-microvolt = <1200000>;
>  			regulator-max-microvolt = <1400000>;
>  			qcom,switch-mode-frequency = <1600000>;
>  			bias-pull-down;
>  		};
> -		s3 {
> +
> +		pm8058_s3: s3 {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			qcom,switch-mode-frequency = <1600000>;
>  			regulator-always-on;
>  			bias-pull-down;
>  		};
> -		s4 {
> +
> +		pm8058_s4: s4 {
>  			regulator-min-microvolt = <2200000>;
>  			regulator-max-microvolt = <2200000>;
>  			qcom,switch-mode-frequency = <1600000>;
> @@ -732,14 +774,15 @@ s4 {
>  		};
>  
>  		/* LVS0 and LVS1 are just switches */
> -		lvs0 {
> +		pm8058_lvs0: lvs0 {
>  			bias-pull-down;
>  		};
> -		lvs1 {
> +
> +		pm8058_lvs1: lvs1 {
>  			bias-pull-down;
>  		};
>  
> -		ncp {
> +		pm8058_ncp: ncp {
>  			regulator-min-microvolt = <1800000>;
>  			regulator-max-microvolt = <1800000>;
>  			qcom,switch-mode-frequency = <1600000>;
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts b/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> index 04dca0c93971..43e646ded7bd 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8660-surf.dts
> @@ -61,6 +61,16 @@ MATRIX_KEY(5, 4, KEY_MENU)
>  	keypad,num-columns = <5>;
>  };
>  
> +&rpm {
> +	regulators-0 {
> +		compatible = "qcom,rpm-pm8901-regulators";
> +	};
> +
> +	regulators-1 {
> +		compatible = "qcom,rpm-pm8058-regulators";
> +	};
> +};
> +
>  /* eMMC */
>  &sdcc1 {
>  	vmmc-supply = <&vsdcc_fixed>;
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi
> index b8094b7c09fc..c2cb3abd5177 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8660.dtsi
> @@ -352,72 +352,6 @@ rpmcc: clock-controller {
>  				clocks = <&pxo_board>;
>  				clock-names = "pxo";
>  			};
> -
> -			regulators-0 {
> -				compatible = "qcom,rpm-pm8901-regulators";
> -
> -				pm8901_l0: l0 {};
> -				pm8901_l1: l1 {};
> -				pm8901_l2: l2 {};
> -				pm8901_l3: l3 {};
> -				pm8901_l4: l4 {};
> -				pm8901_l5: l5 {};
> -				pm8901_l6: l6 {};
> -
> -				/* S0 and S1 Handled as SAW regulators by SPM */
> -				pm8901_s2: s2 {};
> -				pm8901_s3: s3 {};
> -				pm8901_s4: s4 {};
> -
> -				pm8901_lvs0: lvs0 {};
> -				pm8901_lvs1: lvs1 {};
> -				pm8901_lvs2: lvs2 {};
> -				pm8901_lvs3: lvs3 {};
> -
> -				pm8901_mvs: mvs {};
> -			};
> -
> -			regulators-1 {
> -				compatible = "qcom,rpm-pm8058-regulators";
> -
> -				pm8058_l0: l0 {};
> -				pm8058_l1: l1 {};
> -				pm8058_l2: l2 {};
> -				pm8058_l3: l3 {};
> -				pm8058_l4: l4 {};
> -				pm8058_l5: l5 {};
> -				pm8058_l6: l6 {};
> -				pm8058_l7: l7 {};
> -				pm8058_l8: l8 {};
> -				pm8058_l9: l9 {};
> -				pm8058_l10: l10 {};
> -				pm8058_l11: l11 {};
> -				pm8058_l12: l12 {};
> -				pm8058_l13: l13 {};
> -				pm8058_l14: l14 {};
> -				pm8058_l15: l15 {};
> -				pm8058_l16: l16 {};
> -				pm8058_l17: l17 {};
> -				pm8058_l18: l18 {};
> -				pm8058_l19: l19 {};
> -				pm8058_l20: l20 {};
> -				pm8058_l21: l21 {};
> -				pm8058_l22: l22 {};
> -				pm8058_l23: l23 {};
> -				pm8058_l24: l24 {};
> -				pm8058_l25: l25 {};
> -
> -				pm8058_s0: s0 {};
> -				pm8058_s1: s1 {};
> -				pm8058_s2: s2 {};
> -				pm8058_s3: s3 {};
> -				pm8058_s4: s4 {};
> -
> -				pm8058_lvs0: lvs0 {};
> -				pm8058_lvs1: lvs1 {};
> -
> -				pm8058_ncp: ncp {};
> -			};
>  		};
>  
>  		amba {