Message ID | 20231013-fp5-thermals-v1-4-f14df01922e6@fairphone.com |
---|---|
State | Accepted |
Commit | ae1122c375707a36c8fecebba745421a1e0ff93f |
Headers | show |
Series | None | expand |
On 13.10.2023 10:09, Luca Weiss wrote: > Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > and RFC_CAM_THERM thermistors connected to PM7325. > > With this PMIC the software communication to the ADC is going through > PMK7325 (= PMK8350). > > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > --- > arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 +++++++++++++++++++++ > 1 file changed, 117 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > index 2c01f799a6b2..d0b1e4e507ff 100644 > --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > @@ -9,6 +9,7 @@ > #define PM7250B_SID 8 > #define PM7250B_SID1 9 > > +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > #include <dt-bindings/leds/common.h> > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > }; > > thermal-zones { > + camera-thermal { > + polling-delay-passive = <0>; > + polling-delay = <0>; > + thermal-sensors = <&pmk8350_adc_tm 2>; > + > + trips { > + active-config0 { > + temperature = <125000>; are > + rear-cam-thermal { > + temperature = <125000>; you > + sdm-skin-thermal { > + temperature = <125000>; sure about these temps? Konrad
On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: > On 13.10.2023 10:09, Luca Weiss wrote: > > Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > > and RFC_CAM_THERM thermistors connected to PM7325. > > > > With this PMIC the software communication to the ADC is going through > > PMK7325 (= PMK8350). > > > > Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > > --- > > > > arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 > > +++++++++++++++++++++ 1 file changed, 117 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index > > 2c01f799a6b2..d0b1e4e507ff 100644 > > --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > > @@ -9,6 +9,7 @@ > > > > #define PM7250B_SID 8 > > #define PM7250B_SID1 9 > > > > +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > > > > #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > > #include <dt-bindings/leds/common.h> > > #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > > > > @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > > > > }; > > > > thermal-zones { > > > > + camera-thermal { > > + polling-delay-passive = <0>; > > + polling-delay = <0>; > > + thermal-sensors = <&pmk8350_adc_tm 2>; > > + > > + trips { > > + active-config0 { > > + temperature = <125000>; > > are > > > + rear-cam-thermal { > > > > + temperature = <125000>; > > you > > > + sdm-skin-thermal { > > > > + temperature = <125000>; > > sure > > about these temps? (email from my other address, quicker right now) Well yes and no. Yes as in those are the temps specified in downstream dtb. No as in I'm 99% sure there's user space with definitely lower threshold that actually does something in response to the temps. I didn't look too much into this but does the kernel even do something when it hits one of these trip points? I assume when there's a cooling device thing specified then it can actually tell the driver to do something, but without (and most drivers don't support this?) I'm assuming the kernel can't do much anyways? So e.g. when the temperature for the flash led is reached I'm assuming downstream (+Android) either dims the led or turns it off? But I'd have to dig quite a bit into the thermal setup there to check what it's really doing. But for now I think it's okay to put this current thermal config into dts and we'll improve it later when 1. I understand more and 2. maybe some useful drivers support the cooling bits? Regards Luca > > Konrad
On 10/14/23 19:52, Luca Weiss wrote: > On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: >> On 13.10.2023 10:09, Luca Weiss wrote: >>> Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM >>> and RFC_CAM_THERM thermistors connected to PM7325. >>> >>> With this PMIC the software communication to the ADC is going through >>> PMK7325 (= PMK8350). >>> >>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> >>> --- >>> >>> arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 >>> +++++++++++++++++++++ 1 file changed, 117 insertions(+) >>> >>> diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index >>> 2c01f799a6b2..d0b1e4e507ff 100644 >>> --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts >>> @@ -9,6 +9,7 @@ >>> >>> #define PM7250B_SID 8 >>> #define PM7250B_SID1 9 >>> >>> +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> >>> >>> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> >>> #include <dt-bindings/leds/common.h> >>> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> >>> >>> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { >>> >>> }; >>> >>> thermal-zones { >>> >>> + camera-thermal { >>> + polling-delay-passive = <0>; >>> + polling-delay = <0>; >>> + thermal-sensors = <&pmk8350_adc_tm 2>; >>> + >>> + trips { >>> + active-config0 { >>> + temperature = <125000>; >> >> are >> >>> + rear-cam-thermal { >>> >>> + temperature = <125000>; >> >> you >> >>> + sdm-skin-thermal { >>> >>> + temperature = <125000>; >> >> sure >> >> about these temps? > > (email from my other address, quicker right now) > > Well yes and no. > > Yes as in those are the temps specified in downstream dtb. > No as in I'm 99% sure there's user space with definitely lower threshold that > actually does something in response to the temps. > > I didn't look too much into this but does the kernel even do something when it > hits one of these trip points? I assume when there's a cooling device thing > specified then it can actually tell the driver to do something, but without > (and most drivers don't support this?) I'm assuming the kernel can't do much > anyways? > > So e.g. when the temperature for the flash led is reached I'm assuming > downstream (+Android) either dims the led or turns it off? But I'd have to dig > quite a bit into the thermal setup there to check what it's really doing. I think reaching "critical" shuts down the platform, unless something registering the thermal zone explicitly overrides the behavior. > > But for now I think it's okay to put this current thermal config into dts and > we'll improve it later when 1. I understand more and 2. maybe some useful > drivers support the cooling bits? Yeah it's better than nothing, but ultimately we should probably move the values that userspace daemon operates on here in the dt.. Konrad
On Wed Oct 18, 2023 at 10:28 PM CEST, Konrad Dybcio wrote: > > > On 10/14/23 19:52, Luca Weiss wrote: > > On Samstag, 14. Oktober 2023 01:13:29 CEST Konrad Dybcio wrote: > >> On 13.10.2023 10:09, Luca Weiss wrote: > >>> Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM > >>> and RFC_CAM_THERM thermistors connected to PM7325. > >>> > >>> With this PMIC the software communication to the ADC is going through > >>> PMK7325 (= PMK8350). > >>> > >>> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> > >>> --- > >>> > >>> arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 > >>> +++++++++++++++++++++ 1 file changed, 117 insertions(+) > >>> > >>> diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index > >>> 2c01f799a6b2..d0b1e4e507ff 100644 > >>> --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts > >>> @@ -9,6 +9,7 @@ > >>> > >>> #define PM7250B_SID 8 > >>> #define PM7250B_SID1 9 > >>> > >>> +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> > >>> > >>> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> > >>> #include <dt-bindings/leds/common.h> > >>> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> > >>> > >>> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { > >>> > >>> }; > >>> > >>> thermal-zones { > >>> > >>> + camera-thermal { > >>> + polling-delay-passive = <0>; > >>> + polling-delay = <0>; > >>> + thermal-sensors = <&pmk8350_adc_tm 2>; > >>> + > >>> + trips { > >>> + active-config0 { > >>> + temperature = <125000>; > >> > >> are > >> > >>> + rear-cam-thermal { > >>> > >>> + temperature = <125000>; > >> > >> you > >> > >>> + sdm-skin-thermal { > >>> > >>> + temperature = <125000>; > >> > >> sure > >> > >> about these temps? > > > > (email from my other address, quicker right now) > > > > Well yes and no. > > > > Yes as in those are the temps specified in downstream dtb. > > No as in I'm 99% sure there's user space with definitely lower threshold that > > actually does something in response to the temps. > > > > I didn't look too much into this but does the kernel even do something when it > > hits one of these trip points? I assume when there's a cooling device thing > > specified then it can actually tell the driver to do something, but without > > (and most drivers don't support this?) I'm assuming the kernel can't do much > > anyways? > > > > So e.g. when the temperature for the flash led is reached I'm assuming > > downstream (+Android) either dims the led or turns it off? But I'd have to dig > > quite a bit into the thermal setup there to check what it's really doing. > I think reaching "critical" shuts down the platform, unless something > registering the thermal zone explicitly overrides the behavior. Should probably be easy to test, especially the camera flash thermal zone heats up *very* quickly when the flash is on, so should be trivial to set the trip point down from 125degC to e.g. 45degC and see what happens. So I did this and... nothing happened. I watched /sys/class/thermal/thermal_zone34/temp climb above 45degC and nothing happened. I guess trip type being "passive" and no cooling-device makes it not do anything. ==> /sys/class/thermal/thermal_zone34/trip_point_0_hyst <== 1000 ==> /sys/class/thermal/thermal_zone34/trip_point_0_temp <== 45000 ==> /sys/class/thermal/thermal_zone34/trip_point_0_type <== passive
diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index 2c01f799a6b2..d0b1e4e507ff 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts @@ -9,6 +9,7 @@ #define PM7250B_SID 8 #define PM7250B_SID1 9 +#include <dt-bindings/iio/qcom,spmi-adc7-pm7325.h> #include <dt-bindings/iio/qcom,spmi-adc7-pmk8350.h> #include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> @@ -137,6 +138,20 @@ afvdd_2p8: regulator-afvdd-2p8 { }; thermal-zones { + camera-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 2>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + chg-skin-thermal { polling-delay-passive = <0>; polling-delay = <0>; @@ -165,6 +180,48 @@ active-config0 { }; }; + quiet-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 1>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + rear-cam-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 4>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + + sdm-skin-thermal { + polling-delay-passive = <0>; + polling-delay = <0>; + thermal-sensors = <&pmk8350_adc_tm 3>; + + trips { + active-config0 { + temperature = <125000>; + hysteresis = <1000>; + type = "passive"; + }; + }; + }; + xo-thermal { polling-delay-passive = <0>; polling-delay = <0>; @@ -538,6 +595,34 @@ xo-therm@0 { qcom,ratiometric; qcom,hw-settle-time-us = <200>; }; + + quiet-therm@1 { + reg = <1>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + cam-flash-therm@2 { + reg = <2>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + sdm-skin-therm@3 { + reg = <3>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; + + wide-rfc-therm@4 { + reg = <4>; + io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM4_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time-us = <200>; + }; }; &pmk8350_rtc { @@ -554,6 +639,38 @@ channel@44 { qcom,pre-scaling = <1 1>; label = "pmk8350_xo_therm"; }; + + channel@144 { + reg = <PM7325_ADC7_AMUX_THM1_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_quiet_therm"; + }; + + channel@145 { + reg = <PM7325_ADC7_AMUX_THM2_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_cam_flash_therm"; + }; + + channel@146 { + reg = <PM7325_ADC7_AMUX_THM3_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_sdm_skin_therm"; + }; + + channel@147 { + reg = <PM7325_ADC7_AMUX_THM4_100K_PU>; + qcom,ratiometric; + qcom,hw-settle-time = <200>; + qcom,pre-scaling = <1 1>; + label = "pm7325_wide_rfc_therm"; + }; }; &pon_pwrkey {
Configure the thermals for the QUIET_THERM, CAM_FLASH_THERM, MSM_THERM and RFC_CAM_THERM thermistors connected to PM7325. With this PMIC the software communication to the ADC is going through PMK7325 (= PMK8350). Signed-off-by: Luca Weiss <luca.weiss@fairphone.com> --- arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts | 117 +++++++++++++++++++++ 1 file changed, 117 insertions(+)