Thermal monitor on PM660
Subsystems (6)
cover Thermal monitor on PM660
This series adds the ADC thermal monitor on PM660. It also fixes the scaling between voltage and temperature for the HC variant.
Richard Acayan (3):
dt-bindings: mfd: qcom,spmi-pmic: Allow PMIC4 thermal monitor on pm660
thermal: qcom-spmi-adc-tm5: Correct the voltage-code scaling for HC
arm64: dts: qcom: pm660: add thermal monitor
.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 + arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-)
Signature · 1 line
2.53.0
PATCH 1/3 dt-bindings: mfd: qcom,spmi-pmic: Allow PMIC4 thermal monitor on pm660
While newer PMICs are compatible with PMIC5 drivers, the PM8998 and PM660 are both PMIC4. The PM8998 is allowed to use the PMIC4 thermal monitor. Allow it for PM660 as well.
--- Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml +1 -0
@@ -221,6 +221,7 @@ allOf: compatible: contains: enum: + - qcom,pm660 - qcom,pm8998 then: patternProperties:
Signature · 1 line
2.53.0
Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Allow PMIC4 thermal monitor on pm660
Quoted 6 lines · Richard Acayan
While newer PMICs are compatible with PMIC5 drivers, the PM8998 and PM660 are both PMIC4. The PM8998 is allowed to use the PMIC4 thermal monitor. Allow it for PM660 as well.
Signed-off-by Richard Acayan <[email protected]>---
Konrad
Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Allow PMIC4 thermal monitor on pm660
In reply to Richard AcayanQuoted 8 lines · Richard Acayan
While newer PMICs are compatible with PMIC5 drivers, the PM8998 and PM660 are both PMIC4. The PM8998 is allowed to use the PMIC4 thermal monitor. Allow it for PM660 as well.
Signed-off-by Richard Acayan <[email protected]>--- Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 + 1 file changed, 1 insertion(+)
Best regards,
Krzysztof
PATCH 2/3 thermal: qcom-spmi-adc-tm5: Correct the voltage-code scaling for HC
In reply to Richard AcayanWhen support was added for the HC variant, the full_scale_code_volt value was copied from the tm5 variant. From the downstream kernel, the scaling value is 0x70e4 on PMI632 (tm5 variant), but it is 0x4000 on PM660 and PM8998 (HC variant). Correct the ADC code to voltage scaling factor for the HC variant.
--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/qcom/qcom-spmi-adc-tm5.c +1 -1
@@ -909,7 +909,7 @@ static const struct adc_tm5_data adc_tm5_data_pmic = { };static const struct adc_tm5_data adc_tm_hc_data_pmic = { - .full_scale_code_volt =0x70e4 , + .full_scale_code_volt =0x4000 , .decimation = (unsigned int []) {256 ,512 ,1024 }, .hw_settle = (unsigned int []) {0 ,100 ,200 ,300 ,400 ,500 ,600 ,700 ,1000 ,2000 ,4000 ,6000 ,8000 ,10000 },
Signature · 1 line
2.53.0
Re: [PATCH 2/3] thermal: qcom-spmi-adc-tm5: Correct the voltage-code scaling for HC
Quoted 9 lines · Richard Acayan
When support was added for the HC variant, the
full_scale_code_voltvalue was copied from the tm5 variant. From the downstream kernel, the scaling value is0x70e4on PMI632 (tm5 variant), but it is0x4000on PM660 and PM8998 (HC variant). Correct the ADC code to voltage scaling factor for the HC variant.Fixes f6c83676c6097 ("thermal/drivers/qcom/spmi-adc-tm5: Add support for HC variant")Signed-off-by Richard Acayan <[email protected]>---
nice catch!
Konrad
Re: [PATCH 2/3] thermal: qcom-spmi-adc-tm5: Correct the voltage-code scaling for HC
In reply to Richard AcayanQuoted 11 lines · Richard Acayan
When support was added for the HC variant, the
full_scale_code_voltvalue was copied from the tm5 variant. From the downstream kernel, the scaling value is0x70e4on PMI632 (tm5 variant), but it is0x4000on PM660 and PM8998 (HC variant). Correct the ADC code to voltage scaling factor for the HC variant.Fixes f6c83676c6097 ("thermal/drivers/qcom/spmi-adc-tm5: Add support for HC variant")Signed-off-by Richard Acayan <[email protected]>--- drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 1 line
Signature · 2 lines
With best wishes Dmitry
PATCH 3/3 arm64: dts: qcom: pm660: add thermal monitor
In reply to Richard AcayanThe thermal monitor is used to monitor arbitrary ADC-based thermal sensors. It is suitable for use in thermal zones. Add support for it in PM660.
--- arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/qcom/pm660.dtsi +10 -0
@@ -197,6 +197,16 @@ channel@85 { }; }; + pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + pm660_rradc: adc@4500 { compatible = "qcom,pm660-rradc"; reg = <0x4500>;
Signature · 1 line
2.53.0
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 15 lines · Richard Acayan
The thermal monitor is used to monitor arbitrary ADC-based thermal sensors. It is suitable for use in thermal zones. Add support for it in PM660.
Signed-off-by Richard Acayan <[email protected]>--- arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm64/boot/dts/qcom/pm660.dtsi +0
-0@@ -197,6 +197,16 @@ channel@85 { };
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0}; + pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";
Can we enable it by default?
Konrad
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 1 line · Konrad Dybcio
On 2/10/26 3:18 AM, Richard Acayan wrote:
(snip)
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
No, the thermal monitor fails to probe if it doesn't have any channels:
[ 17.728926] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: error -EINVAL: get dt data failed [ 17.728945] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: probe with driver qcom-spmi-adc-tm5 failed with error -22
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 14 lines · Richard Acayan
Quoted 1 line · Konrad Dybcio
On 2/10/26 3:18 AM, Richard Acayan wrote:
(snip)
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
Quoted 6 lines
No, the thermal monitor fails to probe if it doesn't have any channels:
[ 17.728926] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: error -EINVAL: get dt data failed [ 17.728945] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: probe with driver qcom-spmi-adc-tm5 failed with error -22
You can define the following ones in the common dt:
REF_GND
1.25VREFVREF_VADCVPH_PWR
VCOINDIE_TEMPANA_IN
as they're (almost or) always going to be present
Konrad
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 17 lines · Konrad Dybcio
Quoted 16 lines · Richard Acayan
Quoted 1 line · Konrad Dybcio
On 2/10/26 3:18 AM, Richard Acayan wrote:
(snip)
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
No, the thermal monitor fails to probe if it doesn't have any channels:
Quoted 8 lines
Quoted 4 lines
[ 17.728926] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: error -EINVAL: get dt data failed [ 17.728945] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: probe with driver qcom-spmi-adc-tm5 failed with error -22You can define the following ones in the common dt:
REF_GND
Is there any (likely passive, if any) cooling device that should be activated when this goes above or below a certain reading?
Quoted 5 lines
1.25VREF
VREF_VADCVPH_PWR
VCOINDIE_TEMP
Maybe this temperature can be included, but I don't see any other PMIC devicetree that has this channel ready-to-go.
Quoted 1 line
ANA_IN
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 21 lines · Richard Acayan
Quoted 20 lines · Konrad Dybcio
Quoted 19 lines · Richard Acayan
Quoted 1 line · Konrad Dybcio
On 2/10/26 3:18 AM, Richard Acayan wrote:
(snip)
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
No, the thermal monitor fails to probe if it doesn't have any channels:
[ 17.728926] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: error -EINVAL: get dt data failed [ 17.728945] qcom-spmi-adc-tm5 c440000.spmi:pmic@0:adc-tm@3400: probe with driver qcom-spmi-adc-tm5 failed with error -22
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
You can define the following ones in the common dt:
REF_GNDIs there any (likely passive, if any) cooling device that should be activated when this goes above or below a certain reading?
I don't think so
Quoted 9 lines
Quoted 6 lines
1.25VREF
VREF_VADCVPH_PWR
VCOINDIE_TEMPMaybe this temperature can be included, but I don't see any other PMIC devicetree that has this channel ready-to-go.
This channel is internally connected and handled by temp_alarm, I think describing it via the ADC just lets one peek into the raw values
Konrad
Quoted 2 lines
Quoted 2 lines
ANA_IN
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
In reply to Konrad DybcioQuoted 18 lines · Konrad Dybcio
Quoted 17 lines · Richard Acayan
The thermal monitor is used to monitor arbitrary ADC-based thermal sensors. It is suitable for use in thermal zones. Add support for it in PM660.
Signed-off-by Richard Acayan <[email protected]>--- arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm64/boot/dts/qcom/pm660.dtsi +0
-0@@ -197,6 +197,16 @@ channel@85 { }; };
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
This is for the ADC thermal monitor, and not the ADC itself. I don't see the need to allocate channels just so this can be enabled by default, since the thermal monitor's purpose is mostly to send interrupts when the ADC values go above or below a certain threshold.
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 30 lines · Richard Acayan
Quoted 18 lines · Konrad Dybcio
Quoted 17 lines · Richard Acayan
The thermal monitor is used to monitor arbitrary ADC-based thermal sensors. It is suitable for use in thermal zones. Add support for it in PM660.
Signed-off-by Richard Acayan <[email protected]>--- arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm64/boot/dts/qcom/pm660.dtsi +0
-0@@ -197,6 +197,16 @@ channel@85 { }; };Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
Quoted 4 lines
This is for the ADC thermal monitor, and not the ADC itself. I don't see the need to allocate channels just so this can be enabled by default, since the thermal monitor's purpose is mostly to send interrupts when the ADC values go above or below a certain threshold.
Sorry, this fell through the cracks
I see your argument, but at the same time, there are channels that are always present (e.g. VPH_PWR) and any way to reduce the boilerplate is welcome
Konrad
Re: [PATCH 3/3] arm64: dts: qcom: pm660: add thermal monitor
Quoted 36 lines · Konrad Dybcio
Quoted 30 lines · Richard Acayan
Quoted 18 lines · Konrad Dybcio
Quoted 17 lines · Richard Acayan
The thermal monitor is used to monitor arbitrary ADC-based thermal sensors. It is suitable for use in thermal zones. Add support for it in PM660.
Signed-off-by Richard Acayan <[email protected]>--- arch/arm64/boot/dts/qcom/pm660.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)arch/arm64/boot/dts/qcom/pm660.dtsi +0
-0@@ -197,6 +197,16 @@ channel@85 { }; };Quoted 10 lines
arch/arm64/boot/dts/qcom/pm660.dtsi channel@85 { · line 207
Quoted 8 lines
arch/arm64/boot/dts/qcom/pm660.dtsi +8
-0+ pm660_adc_tm: adc-tm@3400 { + compatible = "qcom,spmi-adc-tm-hc"; + reg = <0x3400>; + interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled";Can we enable it by default?
Quoted 4 lines
This is for the ADC thermal monitor, and not the ADC itself. I don't see the need to allocate channels just so this can be enabled by default, since the thermal monitor's purpose is mostly to send interrupts when the ADC values go above or below a certain threshold.
Quoted 5 lines
Sorry, this fell through the cracks
I see your argument, but at the same time, there are channels that are always present (e.g.
VPH_PWR) and any way to reduce the boilerplate is welcome
If you saw my first sentence in the reply, why are we talking about VPH_PWR? I don't understand if you're asking for the thermal monitor to handle a voltage sensor here.