mbox series

[v2,00/12] sc8280xp-pmic updates and X13s thermal zone support

Message ID 20221029051449.30678-1-manivannan.sadhasivam@linaro.org
Headers show
Series sc8280xp-pmic updates and X13s thermal zone support | expand

Message

Manivannan Sadhasivam Oct. 29, 2022, 5:14 a.m. UTC
Hello,

This series adds below updates to sc8280xp-pmics:

PM8280_{1/2}:
- Temp alarm
- Thermal zones
- VADC channels
- ADC_TM5 channels

PMK8280:
- ADC7 block
- VADC channels
- TM5 block

PMR735A:
- VADC channels

Also adds the thermal zone support to Lenovo X13s based on the thermistor
SYS_THERM6 that provides the laptop skin temperature.

The sc8280xp-pmics is based on the new PMIC7 architecture. In this, all the
ADC/TM5 measurements are collected by the primary PMIC PMK8280 from other
slave PMICs PM8280_{1/2}, PMR735A using the Programmable Boot Sequence (PBS)
and exposed them over the individual channels.

PMK8280 uses the Slave ID (SID) for identifying each slave PMICs in a system.
This ID is not static for each PMIC but rather set for each platform by the
hardware designers. So this series allows the configurable SID by modifying the
binding to accept SID values instead of hardcoding them.

This series is tested on Lenovo X13s laptop by monitoring the temperature of
the 8 on-board thermistors through IIO interface. The thermal zone support is
validated by adding loads to the CPUs and making sure the skin temperature stays
below the threshold provided in DT.

Thanks,
Mani

Changes in v2:

* Fixed issues reported by Krzysztof and "make dtbs_check"
* Collected reviews from Krzysztof
* Added the Lenovo X13s thermal zone patch

Manivannan Sadhasivam (12):
  dt-bindings: iio: qcom: adc7-pm8350: Allow specifying SID for channels
  arm64: dts: qcom: sc8280xp-pmics: Add temp alarm for PM8280_{1/2}
    PMICs
  arm64: dts: qcom: sc8280xp-pmics: Add thermal zones for PM8280_{1/2}
    PMICs
  arm64: dts: qcom: sc8280xp-pmics: Add support for PMK8280 RESIN input
  arm64: dts: qcom: sc8280xp-pmics: Add PMK8280 ADC7 block
  arm64: dts: qcom: sc8280xp-pmics: Add support for TM5 block in PMK8280
  arm64: dts: qcom: sc8280xp-x13s: Enable PMK8280 RESIN input
  arm64: dts: qcom: sc8280xp-x13s: Add PMK8280 VADC channels
  arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} VADC channels
  arm64: dts: qcom: sc8280xp-x13s: Add PMR735A VADC channel
  arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} ADC_TM5 channels
  arm64: dts: qcom: sc8280xp-x13s: Add thermal zone support

 .../bindings/thermal/qcom-spmi-adc-tm5.yaml   |   6 +-
 .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 204 ++++++++++++++++++
 arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi  |  83 +++++++
 .../dt-bindings/iio/qcom,spmi-adc7-pm8350.h   |  90 ++++----
 4 files changed, 333 insertions(+), 50 deletions(-)

Comments

Konrad Dybcio Oct. 29, 2022, 2:13 p.m. UTC | #1
On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
> Add thermal zones for the PM8280_{1/2} PMICs by using the temperature
> alarm blocks as the thermal sensors. Temperature trip points are
> inherited from PM8350 PMIC.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>

Konrad
>  arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi | 44 ++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> index 5de47b1434a4..397ff4995003 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> @@ -7,6 +7,50 @@
>  #include <dt-bindings/interrupt-controller/irq.h>
>  #include <dt-bindings/spmi/spmi.h>
>  
> +/ {
> +	thermal-zones {
> +		pm8280_1_thermal: pm8280-1-thermal {
> +			polling-delay-passive = <100>;
> +			polling-delay = <0>;
> +			thermal-sensors = <&pm8280_1_temp_alarm>;
> +
> +			trips {
> +				trip0 {
> +					temperature = <95000>;
> +					hysteresis = <0>;
> +					type = "passive";
> +				};
> +
> +				trip1 {
> +					temperature = <115000>;
> +					hysteresis = <0>;
> +					type = "critical";
> +				};
> +			};
> +		};
> +
> +		pm8280_2_thermal: pm8280-2-thermal {
> +			polling-delay-passive = <100>;
> +			polling-delay = <0>;
> +			thermal-sensors = <&pm8280_2_temp_alarm>;
> +
> +			trips {
> +				trip0 {
> +					temperature = <95000>;
> +					hysteresis = <0>;
> +					type = "passive";
> +				};
> +
> +				trip1 {
> +					temperature = <115000>;
> +					hysteresis = <0>;
> +					type = "critical";
> +				};
> +			};
> +		};
> +	};
> +};
> +
>  &spmi_bus {
>  	pmk8280: pmic@0 {
>  		compatible = "qcom,pmk8350", "qcom,spmi-pmic";
Konrad Dybcio Oct. 29, 2022, 2:16 p.m. UTC | #2
On 29.10.2022 07:14, Manivannan Sadhasivam wrote:
> Enable resetting the PMK8280 through RESIN block in SC8280XP X13s.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>

Konrad
>  arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> index b2b744bb8a53..6aa8cf6d9776 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -169,6 +169,10 @@ &pmk8280_pon_pwrkey {
>  	status = "okay";
>  };
>  
> +&pmk8280_pon_resin {
> +	status = "okay";
> +};
> +
>  &qup0 {
>  	status = "okay";
>  };
Steev Klimaszewski Oct. 29, 2022, 7:26 p.m. UTC | #3
On Sat, Oct 29, 2022 at 12:15 AM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> Hello,
>
> This series adds below updates to sc8280xp-pmics:
>
> PM8280_{1/2}:
> - Temp alarm
> - Thermal zones
> - VADC channels
> - ADC_TM5 channels
>
> PMK8280:
> - ADC7 block
> - VADC channels
> - TM5 block
>
> PMR735A:
> - VADC channels
>
> Also adds the thermal zone support to Lenovo X13s based on the thermistor
> SYS_THERM6 that provides the laptop skin temperature.
>
> The sc8280xp-pmics is based on the new PMIC7 architecture. In this, all the
> ADC/TM5 measurements are collected by the primary PMIC PMK8280 from other
> slave PMICs PM8280_{1/2}, PMR735A using the Programmable Boot Sequence (PBS)
> and exposed them over the individual channels.
>
> PMK8280 uses the Slave ID (SID) for identifying each slave PMICs in a system.
> This ID is not static for each PMIC but rather set for each platform by the
> hardware designers. So this series allows the configurable SID by modifying the
> binding to accept SID values instead of hardcoding them.
>
> This series is tested on Lenovo X13s laptop by monitoring the temperature of
> the 8 on-board thermistors through IIO interface. The thermal zone support is
> validated by adding loads to the CPUs and making sure the skin temperature stays
> below the threshold provided in DT.
>
> Thanks,
> Mani
>
> Changes in v2:
>
> * Fixed issues reported by Krzysztof and "make dtbs_check"
> * Collected reviews from Krzysztof
> * Added the Lenovo X13s thermal zone patch
>
> Manivannan Sadhasivam (12):
>   dt-bindings: iio: qcom: adc7-pm8350: Allow specifying SID for channels
>   arm64: dts: qcom: sc8280xp-pmics: Add temp alarm for PM8280_{1/2}
>     PMICs
>   arm64: dts: qcom: sc8280xp-pmics: Add thermal zones for PM8280_{1/2}
>     PMICs
>   arm64: dts: qcom: sc8280xp-pmics: Add support for PMK8280 RESIN input
>   arm64: dts: qcom: sc8280xp-pmics: Add PMK8280 ADC7 block
>   arm64: dts: qcom: sc8280xp-pmics: Add support for TM5 block in PMK8280
>   arm64: dts: qcom: sc8280xp-x13s: Enable PMK8280 RESIN input
>   arm64: dts: qcom: sc8280xp-x13s: Add PMK8280 VADC channels
>   arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} VADC channels
>   arm64: dts: qcom: sc8280xp-x13s: Add PMR735A VADC channel
>   arm64: dts: qcom: sc8280xp-x13s: Add PM8280_{1/2} ADC_TM5 channels
>   arm64: dts: qcom: sc8280xp-x13s: Add thermal zone support
>
>  .../bindings/thermal/qcom-spmi-adc-tm5.yaml   |   6 +-
>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 204 ++++++++++++++++++
>  arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi  |  83 +++++++
>  .../dt-bindings/iio/qcom,spmi-adc7-pm8350.h   |  90 ++++----
>  4 files changed, 333 insertions(+), 50 deletions(-)
>
> --
> 2.25.1
>
Tested-by: Steev Klimaszewski <steev@kali.org>
Dmitry Baryshkov Oct. 29, 2022, 10:07 p.m. UTC | #4
On 29/10/2022 08:14, Manivannan Sadhasivam wrote:
> As per the new ADC7 architecture used by the Qualcomm PMICs, each PMIC
> has the static Slave ID (SID) assigned by default. The primary PMIC
> PMK8350 is responsible for collecting the temperature/voltage data from
> the slave PMICs and exposing them via it's registers.
> 
> For getting the measurements from the slave PMICs, PMK8350 uses the
> channel ID encoded with the SID of the relevant PMIC. So far, the
> dt-binding for the slave PMIC PM8350 assumed that there will be only
> one PM8350 in a system. So it harcoded SID 1 with channel IDs.
> 
> But this got changed in platforms such as Lenovo X13s where there are a
> couple of PM8350 PMICs available. So to address multiple PM8350s, change
> the binding to accept the SID specified by the user and use it for
> encoding the channel ID.
> 
> It should be noted that, even though the SID is static it is not
> globally unique. Only the primary PMIC has the unique SID id 0.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>   .../bindings/thermal/qcom-spmi-adc-tm5.yaml   |  6 +-
>   .../dt-bindings/iio/qcom,spmi-adc7-pm8350.h   | 90 +++++++++----------
>   2 files changed, 46 insertions(+), 50 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Rob Herring Oct. 31, 2022, 9:33 p.m. UTC | #5
On Sat, 29 Oct 2022 10:44:38 +0530, Manivannan Sadhasivam wrote:
> As per the new ADC7 architecture used by the Qualcomm PMICs, each PMIC
> has the static Slave ID (SID) assigned by default. The primary PMIC
> PMK8350 is responsible for collecting the temperature/voltage data from
> the slave PMICs and exposing them via it's registers.
> 
> For getting the measurements from the slave PMICs, PMK8350 uses the
> channel ID encoded with the SID of the relevant PMIC. So far, the
> dt-binding for the slave PMIC PM8350 assumed that there will be only
> one PM8350 in a system. So it harcoded SID 1 with channel IDs.
> 
> But this got changed in platforms such as Lenovo X13s where there are a
> couple of PM8350 PMICs available. So to address multiple PM8350s, change
> the binding to accept the SID specified by the user and use it for
> encoding the channel ID.
> 
> It should be noted that, even though the SID is static it is not
> globally unique. Only the primary PMIC has the unique SID id 0.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../bindings/thermal/qcom-spmi-adc-tm5.yaml   |  6 +-
>  .../dt-bindings/iio/qcom,spmi-adc7-pm8350.h   | 90 +++++++++----------
>  2 files changed, 46 insertions(+), 50 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>