mbox series

[00/11] Updates to sc8280xp-pmic

Message ID 20221027063006.9056-1-manivannan.sadhasivam@linaro.org
Headers show
Series Updates to sc8280xp-pmic | expand

Message

Manivannan Sadhasivam Oct. 27, 2022, 6:29 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

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.

Thanks,
Mani

Manivannan Sadhasivam (11):
  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

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

Comments

Krzysztof Kozlowski Oct. 27, 2022, 1:47 p.m. UTC | #1
On 27/10/2022 02:29, Manivannan Sadhasivam wrote:
> Add support for temperature alarm feature in the PM8280_{1/2} PMICs.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 1:50 p.m. UTC | #2
On 27/10/2022 02:29, 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
> inheried from PM8350 PMIC.

inherited

> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---

With above:
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 1:50 p.m. UTC | #3
On 27/10/2022 02:29, Manivannan Sadhasivam wrote:
> The RESIN input can be used to reset the PMK8280 PMIC. Enabling the
> RESIN block allows the PMK8280 to detect reset input via RESIN_N pin.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 1:54 p.m. UTC | #4
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Add support for ADC7 block available in PMK8280 for reading the
> temperature via the AMUX pins.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> index 4a3464f5e6e9..32086d5edd0d 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-pmics.dtsi
> @@ -75,6 +75,17 @@ pmk8280_pon_resin: resin {
>  				status = "disabled";
>  			};
>  		};
> +
> +		pmk8280_vadc: adc@3100 {
> +			compatible = "qcom,spmi-adc7";
> +			reg = <0x3100>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +			interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
> +			interrupt-names = "eoc-int-en-set";

Schema does not accept this. Be sure `make dtbs_check` passes.

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:01 p.m. UTC | #5
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Thermal Monitoring block ADC5 (TM5) in PMK8280 can be used to monitor the
> temperature from slave PMICs like PM8280.
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:01 p.m. UTC | #6
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Enable resetting the PMK8280 through RESIN block in SC8280XP X13s.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 4 ++++
>  1 file changed, 4 insertions(+)
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:03 p.m. UTC | #7
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Add VADC channels for measuring the on-chip die temperature and external
> crystal osciallator temperature of PMK8280.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 18 ++++++++++++++++++
>  1 file changed, 18 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 6aa8cf6d9776..9ac5d5c22832 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -7,6 +7,7 @@
>  /dts-v1/;
>  
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
>  
>  #include "sc8280xp.dtsi"
> @@ -173,6 +174,23 @@ &pmk8280_pon_resin {
>  	status = "okay";
>  };
>  
> +&pmk8280_vadc {
> +	status = "okay";
> +
> +	pmk8280-die-temp@3 {

die-temp@

> +		reg = <PMK8350_ADC7_DIE_TEMP>;
> +		label = "pmk8280_die_temp";
> +		qcom,pre-scaling = <1 1>;
> +	};
> +
> +	pmk8280-xo-therm@44 {

xo-therm@



Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:04 p.m. UTC | #8
On 27/10/2022 10:03, Krzysztof Kozlowski wrote:
> On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
>> Add VADC channels for measuring the on-chip die temperature and external
>> crystal osciallator temperature of PMK8280.
>>
>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>> ---
>>  .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 18 ++++++++++++++++++
>>  1 file changed, 18 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 6aa8cf6d9776..9ac5d5c22832 100644
>> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
>> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
>> @@ -7,6 +7,7 @@
>>  /dts-v1/;
>>  
>>  #include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
>>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
>>  
>>  #include "sc8280xp.dtsi"
>> @@ -173,6 +174,23 @@ &pmk8280_pon_resin {
>>  	status = "okay";
>>  };
>>  
>> +&pmk8280_vadc {
>> +	status = "okay";
>> +
>> +	pmk8280-die-temp@3 {
> 
> die-temp@

Hm, wait, unless this is the die temperature of pmk8280? But then how
about pmic-die-temp?


Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:09 p.m. UTC | #9
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Add VADC channels of PM8280_{1/2} PMICs for measuring the on-chip die
> temperature and external thermistors connected to the AMUX pins.
> 
> The measurements are collected by the primary PMIC PMK8280 from the
> slave PMICs PM8280_{1/2} and exposed them over the PMK8280's VADC

secondary PMICs

Drop "them"


> channels.
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 61 +++++++++++++++++++
>  1 file changed, 61 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 9ac5d5c22832..d300d217fdc6 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -7,6 +7,7 @@
>  /dts-v1/;
>  
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
>  #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
>  
> @@ -189,6 +190,66 @@ pmk8280-xo-therm@44 {
>  		qcom,ratiometric;
>  		qcom,hw-settle-time = <200>;
>  	};
> +
> +	pm8280-1-die-temp@103 {

pmic-die-temp? What pm8280 stands here?


> +		reg = <PM8350_ADC7_DIE_TEMP(1)>;
> +		label = "pm8280_1_die_temp";
> +		qcom,pre-scaling = <1 1>;
> +	};
> +
> +	sys-therm1@144 {

I would say sys-therm@... why do we need the "1" suffix in node name?

> +		reg = <PM8350_ADC7_AMUX_THM1_100K_PU(1)>;
> +		qcom,ratiometric;
> +		qcom,hw-settle-time = <200>;
> +	};

Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2022, 2:11 p.m. UTC | #10
On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> Add ADC_TM5 channels of PM8280_{1/2} for monitoring the temperatures from
> external thermistors connected to AMUX pins. The temperture measurements

temperature

> are collected from the PMK8280's VADC channels that expose the
> mesasurements from slave PMICs PM8280_{1/2}.

measurements
slave->secondary

Other comments about node names stay as well, but it depends on the
previous discussion.

> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 68 +++++++++++++++++++
>  1 file changed, 68 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 babf594384f2..fe6b75551ab9 100644
> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> @@ -259,6 +259,74 @@ pmr735a-die-temp@403 {
>  	};
>  };
>  
Best regards,
Krzysztof
Manivannan Sadhasivam Oct. 29, 2022, 4:45 a.m. UTC | #11
On Thu, Oct 27, 2022 at 10:04:24AM -0400, Krzysztof Kozlowski wrote:
> On 27/10/2022 10:03, Krzysztof Kozlowski wrote:
> > On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> >> Add VADC channels for measuring the on-chip die temperature and external
> >> crystal osciallator temperature of PMK8280.
> >>
> >> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> >> ---
> >>  .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 18 ++++++++++++++++++
> >>  1 file changed, 18 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 6aa8cf6d9776..9ac5d5c22832 100644
> >> --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> >> +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> >> @@ -7,6 +7,7 @@
> >>  /dts-v1/;
> >>  
> >>  #include <dt-bindings/gpio/gpio.h>
> >> +#include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
> >>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> >>  
> >>  #include "sc8280xp.dtsi"
> >> @@ -173,6 +174,23 @@ &pmk8280_pon_resin {
> >>  	status = "okay";
> >>  };
> >>  
> >> +&pmk8280_vadc {
> >> +	status = "okay";
> >> +
> >> +	pmk8280-die-temp@3 {
> > 
> > die-temp@
> 
> Hm, wait, unless this is the die temperature of pmk8280? But then how
> about pmic-die-temp?

Yes, this is the die temperature of PMK8280, so "pmic-die-temp" makes sense.

Thanks,
Mani

> 
> 
> Best regards,
> Krzysztof
>
Manivannan Sadhasivam Oct. 29, 2022, 4:48 a.m. UTC | #12
On Thu, Oct 27, 2022 at 10:09:21AM -0400, Krzysztof Kozlowski wrote:
> On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> > Add VADC channels of PM8280_{1/2} PMICs for measuring the on-chip die
> > temperature and external thermistors connected to the AMUX pins.
> > 
> > The measurements are collected by the primary PMIC PMK8280 from the
> > slave PMICs PM8280_{1/2} and exposed them over the PMK8280's VADC
> 
> secondary PMICs
> 
> Drop "them"
> 
> 
> > channels.
> > 
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> >  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 61 +++++++++++++++++++
> >  1 file changed, 61 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 9ac5d5c22832..d300d217fdc6 100644
> > --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > @@ -7,6 +7,7 @@
> >  /dts-v1/;
> >  
> >  #include <dt-bindings/gpio/gpio.h>
> > +#include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
> >  #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
> >  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> >  
> > @@ -189,6 +190,66 @@ pmk8280-xo-therm@44 {
> >  		qcom,ratiometric;
> >  		qcom,hw-settle-time = <200>;
> >  	};
> > +
> > +	pm8280-1-die-temp@103 {
> 
> pmic-die-temp? What pm8280 stands here?
> 

As agreed, will use "pmic-die-temp"

> 
> > +		reg = <PM8350_ADC7_DIE_TEMP(1)>;
> > +		label = "pm8280_1_die_temp";
> > +		qcom,pre-scaling = <1 1>;
> > +	};
> > +
> > +	sys-therm1@144 {
> 
> I would say sys-therm@... why do we need the "1" suffix in node name?
> 

Suffix represents the index of the thermistor as per the schematics but I guess
it can be dropped.

Thanks,
Mani

> > +		reg = <PM8350_ADC7_AMUX_THM1_100K_PU(1)>;
> > +		qcom,ratiometric;
> > +		qcom,hw-settle-time = <200>;
> > +	};
> 
> Best regards,
> Krzysztof
>
Manivannan Sadhasivam Oct. 30, 2022, 7:16 a.m. UTC | #13
On Sat, Oct 29, 2022 at 10:18:37AM +0530, Manivannan Sadhasivam wrote:
> On Thu, Oct 27, 2022 at 10:09:21AM -0400, Krzysztof Kozlowski wrote:
> > On 27/10/2022 02:30, Manivannan Sadhasivam wrote:
> > > Add VADC channels of PM8280_{1/2} PMICs for measuring the on-chip die
> > > temperature and external thermistors connected to the AMUX pins.
> > > 
> > > The measurements are collected by the primary PMIC PMK8280 from the
> > > slave PMICs PM8280_{1/2} and exposed them over the PMK8280's VADC
> > 
> > secondary PMICs
> > 
> > Drop "them"
> > 
> > 
> > > channels.
> > > 
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > ---
> > >  .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts    | 61 +++++++++++++++++++
> > >  1 file changed, 61 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 9ac5d5c22832..d300d217fdc6 100644
> > > --- a/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > > +++ b/arch/arm64/boot/dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts
> > > @@ -7,6 +7,7 @@
> > >  /dts-v1/;
> > >  
> > >  #include <dt-bindings/gpio/gpio.h>
> > > +#include <dt-bindings/iio/qcom,spmi-adc7-pm8350.h>
> > >  #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h>
> > >  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> > >  
> > > @@ -189,6 +190,66 @@ pmk8280-xo-therm@44 {
> > >  		qcom,ratiometric;
> > >  		qcom,hw-settle-time = <200>;
> > >  	};
> > > +
> > > +	pm8280-1-die-temp@103 {
> > 
> > pmic-die-temp? What pm8280 stands here?
> > 
> 
> As agreed, will use "pmic-die-temp"
> 
> > 
> > > +		reg = <PM8350_ADC7_DIE_TEMP(1)>;
> > > +		label = "pm8280_1_die_temp";
> > > +		qcom,pre-scaling = <1 1>;
> > > +	};
> > > +
> > > +	sys-therm1@144 {
> > 
> > I would say sys-therm@... why do we need the "1" suffix in node name?
> > 
> 
> Suffix represents the index of the thermistor as per the schematics but I guess
> it can be dropped.
> 

I was wrong. Suffix is necessary since IIO core registers the channel based on
the node name, so it has to be unique.

Thanks,
Mani

> Thanks,
> Mani
> 
> > > +		reg = <PM8350_ADC7_AMUX_THM1_100K_PU(1)>;
> > > +		qcom,ratiometric;
> > > +		qcom,hw-settle-time = <200>;
> > > +	};
> > 
> > Best regards,
> > Krzysztof
> > 
> 
> -- 
> மணிவண்ணன் சதாசிவம்
Krzysztof Kozlowski Nov. 2, 2022, 4:21 p.m. UTC | #14
On 30/10/2022 03:16, Manivannan Sadhasivam wrote:

>>>
>>>> +		reg = <PM8350_ADC7_DIE_TEMP(1)>;
>>>> +		label = "pm8280_1_die_temp";
>>>> +		qcom,pre-scaling = <1 1>;
>>>> +	};
>>>> +
>>>> +	sys-therm1@144 {
>>>
>>> I would say sys-therm@... why do we need the "1" suffix in node name?
>>>
>>
>> Suffix represents the index of the thermistor as per the schematics but I guess
>> it can be dropped.
>>
> 
> I was wrong. Suffix is necessary since IIO core registers the channel based on
> the node name, so it has to be unique.
> 

Makes sense then.

Best regards,
Krzysztof