arm64: dts: mediatek: cherry: Add platform thermal configuration
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 24 Apr 2023 11:25:20 +0000 (13:25 +0200)
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Mon, 11 Dec 2023 10:12:52 +0000 (11:12 +0100)
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.

Tested-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230424112523.1436926-2-angelogioacchino.delregno@collabora.com
arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi

index dd5b89b73190392cedeb7ecb7822fa9613c18b1d..e8b0a6b8a188475c17dfbc414552784f27df133d 100644 (file)
                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";
        memory-region = <&afe_mem>;
 };
 
+&auxadc {
+       status = "okay";
+};
+
 &dp_intf0 {
        status = "okay";
 
        };
 };
 
+&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";
 };