[][Add upstream thermal driver for MT7981]
[Description]
Add upstream thermal driver for MT7981.
Currently the driver supports cross-platform thermal feature.
- V1 : MT8173, MT8183, MT2701, MT2712
- V2 : MT7622
- V3 : MT7981, MT7986
If without this change, MT7981 ASIC is unable to read
ARM CPU temperature.
[How-to]
The way to show current temperature.
- cat /sys/class/thermal/thermal_zone0/temp
[Release-log]
N/A
Change-Id: I0244bbb897fffc2f33b494ec4a8f69787a14a6e9
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/5401091
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
index 1a302ee..19df422 100644
--- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-clkitg.dtsi
@@ -84,7 +84,7 @@
<&infracfg_ao CK_INFRA_AP_DMA_CK>,
<&infracfg_ao CK_INFRA_SEJ_CK>,
<&infracfg_ao CK_INFRA_SEJ_13M_CK>,
- <&infracfg_ao CK_INFRA_THERM_CK>,
+ <&clk40m>,
<&clk40m>,
<&clk40m>,
<&clk40m>,
diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
index 0f5c805..f4d0b78 100644
--- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
@@ -52,6 +52,29 @@
clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
};
+ thermal-zones {
+ cpu_thermal: cpu-thermal {
+ polling-delay-passive = <1000>;
+ polling-delay = <1000>;
+ thermal-sensors = <&thermal 0>;
+ };
+ };
+
+ thermal: thermal@1100c800 {
+ #thermal-sensor-cells = <1>;
+ compatible = "mediatek,mt7981-thermal";
+ reg = <0 0x1100c800 0 0x800>;
+ interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&infracfg_ao CK_INFRA_THERM_CK>,
+ <&infracfg_ao CK_INFRA_ADC_26M_CK>,
+ <&infracfg_ao CK_INFRA_ADC_FRC_CK>;
+ clock-names = "therm", "auxadc", "adc_32k";
+ mediatek,auxadc = <&auxadc>;
+ mediatek,apmixedsys = <&apmixedsys>;
+ nvmem-cells = <&thermal_calibration>;
+ nvmem-cell-names = "calibration-data";
+ };
+
auxadc: adc@1100d000 {
compatible = "mediatek,mt7981-auxadc",
"mediatek,mt7622-auxadc";