diff mbox series

[v2,1/4] arm64: dts: mediatek: cherry: Add platform thermal configuration

Message ID 20230424112523.1436926-2-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series MT8195 Acer Tomato - devicetrees Part 3 | expand

Commit Message

AngeloGioacchino Del Regno April 24, 2023, 11:25 a.m. UTC
This platform has three auxiliary NTC thermistors, connected to the
SoC's ADC pins. Enable the auxadc in order to be able to read the
ADC values, add a generic-adc-thermal LUT for each and finally assign
them to the SoC's thermal zones.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
---
 .../boot/dts/mediatek/mt8195-cherry.dtsi      | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)

Comments

Alexandre Mergnat April 25, 2023, 11:46 a.m. UTC | #1
On 24/04/2023 13:25, AngeloGioacchino Del Regno wrote:
> This platform has three auxiliary NTC thermistors, connected to the
> SoC's ADC pins. Enable the auxadc in order to be able to read the
> ADC values, add a generic-adc-thermal LUT for each and finally assign
> them to the SoC's thermal zones.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>   .../boot/dts/mediatek/mt8195-cherry.dtsi      | 105 ++++++++++++++++++
>   1 file changed, 105 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index 8ac80a136c37..4229f4f7dc2f 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
>   		regulator-boot-on;
>   	};
>   
> +	/* Murata NCP03WF104F05RL */
> +	tboard_thermistor1: thermal-sensor-t1 {
> +		compatible = "generic-adc-thermal";
> +		#thermal-sensor-cells = <0>;
> +		io-channels = <&auxadc 0>;
> +		io-channel-names = "sensor-channel";
> +		temperature-lookup-table = <	(-10000) 1553
> +						(-5000) 1485
> +						0 1406
> +						5000 1317
> +						10000 1219
> +						15000 1115
> +						20000 1007
> +						25000 900
> +						30000 796
> +						35000 697
> +						40000 605
> +						45000 523
> +						50000 449
> +						55000 384
> +						60000 327
> +						65000 279
> +						70000 237
> +						75000 202
> +						80000 172
> +						85000 147
> +						90000 125
> +						95000 107
> +						100000 92
> +						105000 79
> +						110000 68
> +						115000 59
> +						120000 51
> +						125000 44>;
> +	};
> +
> +	tboard_thermistor2: thermal-sensor-t2 {
> +		compatible = "generic-adc-thermal";
> +		#thermal-sensor-cells = <0>;
> +		io-channels = <&auxadc 1>;
> +		io-channel-names = "sensor-channel";
> +		temperature-lookup-table = <	(-10000) 1553
> +						(-5000) 1485
> +						0 1406
> +						5000 1317
> +						10000 1219
> +						15000 1115
> +						20000 1007
> +						25000 900
> +						30000 796
> +						35000 697
> +						40000 605
> +						45000 523
> +						50000 449
> +						55000 384
> +						60000 327
> +						65000 279
> +						70000 237
> +						75000 202
> +						80000 172
> +						85000 147
> +						90000 125
> +						95000 107
> +						100000 92
> +						105000 79
> +						110000 68
> +						115000 59
> +						120000 51
> +						125000 44>;
> +	};
> +
>   	usb_vbus: regulator-5v0-usb-vbus {
>   		compatible = "regulator-fixed";
>   		regulator-name = "usb-vbus";
> @@ -260,6 +331,10 @@ &gpu {
>   	mali-supply = <&mt6315_7_vbuck1>;
>   };
>   
> +&auxadc {

Can you put it in alphabetical order please. ?

> +	status = "okay";
> +};
> +
>   &i2c0 {
>   	status = "okay";
>   
> @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
>   	};
>   };
>   
> +&thermal_zones {
> +	soc-area-thermal {
> +		polling-delay = <1000>;
> +		polling-delay-passive = <250>;
> +		thermal-sensors = <&tboard_thermistor1>;
> +
> +		trips {
> +			trip-crit {
> +				temperature = <84000>;
> +				hysteresis = <1000>;
> +				type = "critical";
> +			};
> +		};
> +	};
> +
> +	pmic-area-thermal {
> +		polling-delay = <1000>;
> +		polling-delay-passive = <0>;
> +		thermal-sensors = <&tboard_thermistor2>;
> +
> +		trips {
> +			trip-crit {
> +				temperature = <84000>;
> +				hysteresis = <1000>;
> +				type = "critical";
> +			};
> +		};
> +	};
> +};
> +
>   &u3phy0 {
>   	status = "okay";
>   };

After that:
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>

Regards,
Alexandre
Chen-Yu Tsai Oct. 12, 2023, 9:33 p.m. UTC | #2
Hi Angelo

On Tue, Apr 25, 2023 at 01:46:42PM +0200, Alexandre Mergnat wrote:
> On 24/04/2023 13:25, AngeloGioacchino Del Regno wrote:
> > This platform has three auxiliary NTC thermistors, connected to the
> > SoC's ADC pins. Enable the auxadc in order to be able to read the
> > ADC values, add a generic-adc-thermal LUT for each and finally assign
> > them to the SoC's thermal zones.
> > 
> > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> > Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
> > ---
> >   .../boot/dts/mediatek/mt8195-cherry.dtsi      | 105 ++++++++++++++++++
> >   1 file changed, 105 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > index 8ac80a136c37..4229f4f7dc2f 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> > @@ -114,6 +114,77 @@ ppvar_sys: regulator-ppvar-sys {
> >   		regulator-boot-on;
> >   	};
> > +	/* Murata NCP03WF104F05RL */
> > +	tboard_thermistor1: thermal-sensor-t1 {
> > +		compatible = "generic-adc-thermal";
> > +		#thermal-sensor-cells = <0>;
> > +		io-channels = <&auxadc 0>;
> > +		io-channel-names = "sensor-channel";
> > +		temperature-lookup-table = <	(-10000) 1553
> > +						(-5000) 1485
> > +						0 1406
> > +						5000 1317
> > +						10000 1219
> > +						15000 1115
> > +						20000 1007
> > +						25000 900
> > +						30000 796
> > +						35000 697
> > +						40000 605
> > +						45000 523
> > +						50000 449
> > +						55000 384
> > +						60000 327
> > +						65000 279
> > +						70000 237
> > +						75000 202
> > +						80000 172
> > +						85000 147
> > +						90000 125
> > +						95000 107
> > +						100000 92
> > +						105000 79
> > +						110000 68
> > +						115000 59
> > +						120000 51
> > +						125000 44>;
> > +	};
> > +
> > +	tboard_thermistor2: thermal-sensor-t2 {
> > +		compatible = "generic-adc-thermal";
> > +		#thermal-sensor-cells = <0>;
> > +		io-channels = <&auxadc 1>;
> > +		io-channel-names = "sensor-channel";
> > +		temperature-lookup-table = <	(-10000) 1553
> > +						(-5000) 1485
> > +						0 1406
> > +						5000 1317
> > +						10000 1219
> > +						15000 1115
> > +						20000 1007
> > +						25000 900
> > +						30000 796
> > +						35000 697
> > +						40000 605
> > +						45000 523
> > +						50000 449
> > +						55000 384
> > +						60000 327
> > +						65000 279
> > +						70000 237
> > +						75000 202
> > +						80000 172
> > +						85000 147
> > +						90000 125
> > +						95000 107
> > +						100000 92
> > +						105000 79
> > +						110000 68
> > +						115000 59
> > +						120000 51
> > +						125000 44>;
> > +	};
> > +
> >   	usb_vbus: regulator-5v0-usb-vbus {
> >   		compatible = "regulator-fixed";
> >   		regulator-name = "usb-vbus";
> > @@ -260,6 +331,10 @@ &gpu {
> >   	mali-supply = <&mt6315_7_vbuck1>;
> >   };
> > +&auxadc {
> 
> Can you put it in alphabetical order please. ?

I believe this patch needs to be respun?

> > +	status = "okay";
> > +};
> > +
> >   &i2c0 {
> >   	status = "okay";
> > @@ -1098,6 +1173,36 @@ mt6315_7_vbuck1: vbuck1 {
> >   	};
> >   };
> > +&thermal_zones {
> > +	soc-area-thermal {
> > +		polling-delay = <1000>;
> > +		polling-delay-passive = <250>;
> > +		thermal-sensors = <&tboard_thermistor1>;
> > +
> > +		trips {
> > +			trip-crit {
> > +				temperature = <84000>;
> > +				hysteresis = <1000>;
> > +				type = "critical";
> > +			};
> > +		};
> > +	};
> > +
> > +	pmic-area-thermal {
> > +		polling-delay = <1000>;
> > +		polling-delay-passive = <0>;
> > +		thermal-sensors = <&tboard_thermistor2>;
> > +
> > +		trips {
> > +			trip-crit {
> > +				temperature = <84000>;
> > +				hysteresis = <1000>;
> > +				type = "critical";
> > +			};
> > +		};
> > +	};
> > +};
> > +
> >   &u3phy0 {
> >   	status = "okay";
> >   };
> 
> After that:
> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> 
> Regards,
> Alexandre
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 8ac80a136c37..4229f4f7dc2f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -114,6 +114,77 @@  ppvar_sys: regulator-ppvar-sys {
 		regulator-boot-on;
 	};
 
+	/* Murata NCP03WF104F05RL */
+	tboard_thermistor1: thermal-sensor-t1 {
+		compatible = "generic-adc-thermal";
+		#thermal-sensor-cells = <0>;
+		io-channels = <&auxadc 0>;
+		io-channel-names = "sensor-channel";
+		temperature-lookup-table = <	(-10000) 1553
+						(-5000) 1485
+						0 1406
+						5000 1317
+						10000 1219
+						15000 1115
+						20000 1007
+						25000 900
+						30000 796
+						35000 697
+						40000 605
+						45000 523
+						50000 449
+						55000 384
+						60000 327
+						65000 279
+						70000 237
+						75000 202
+						80000 172
+						85000 147
+						90000 125
+						95000 107
+						100000 92
+						105000 79
+						110000 68
+						115000 59
+						120000 51
+						125000 44>;
+	};
+
+	tboard_thermistor2: thermal-sensor-t2 {
+		compatible = "generic-adc-thermal";
+		#thermal-sensor-cells = <0>;
+		io-channels = <&auxadc 1>;
+		io-channel-names = "sensor-channel";
+		temperature-lookup-table = <	(-10000) 1553
+						(-5000) 1485
+						0 1406
+						5000 1317
+						10000 1219
+						15000 1115
+						20000 1007
+						25000 900
+						30000 796
+						35000 697
+						40000 605
+						45000 523
+						50000 449
+						55000 384
+						60000 327
+						65000 279
+						70000 237
+						75000 202
+						80000 172
+						85000 147
+						90000 125
+						95000 107
+						100000 92
+						105000 79
+						110000 68
+						115000 59
+						120000 51
+						125000 44>;
+	};
+
 	usb_vbus: regulator-5v0-usb-vbus {
 		compatible = "regulator-fixed";
 		regulator-name = "usb-vbus";
@@ -260,6 +331,10 @@  &gpu {
 	mali-supply = <&mt6315_7_vbuck1>;
 };
 
+&auxadc {
+	status = "okay";
+};
+
 &i2c0 {
 	status = "okay";
 
@@ -1098,6 +1173,36 @@  mt6315_7_vbuck1: vbuck1 {
 	};
 };
 
+&thermal_zones {
+	soc-area-thermal {
+		polling-delay = <1000>;
+		polling-delay-passive = <250>;
+		thermal-sensors = <&tboard_thermistor1>;
+
+		trips {
+			trip-crit {
+				temperature = <84000>;
+				hysteresis = <1000>;
+				type = "critical";
+			};
+		};
+	};
+
+	pmic-area-thermal {
+		polling-delay = <1000>;
+		polling-delay-passive = <0>;
+		thermal-sensors = <&tboard_thermistor2>;
+
+		trips {
+			trip-crit {
+				temperature = <84000>;
+				hysteresis = <1000>;
+				type = "critical";
+			};
+		};
+	};
+};
+
 &u3phy0 {
 	status = "okay";
 };