Skip to contentSkip to conversation

Add thermal sensors support for MT7981

PATCH Applied Aleksander Jan Bajkowski 3 participants 7 messages Jul 8, 2025 – Jul 9, 2025

Subsystems (4)

v3 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add thermal sensors support for MT7981

This patch adds support for the temperature sensor in the MT7981 SoC. This sensor is exactly the same as the one in the MT7986.

CHanges in v3:
- added fallback in bindings

Changes in v2:
- added fallback to an existing compatible string
- removed second patch as obsolete

Aleksander Jan Bajkowski (3):
dt-bindings: iio: adc: Add support for MT7981
dt-bindings: thermal: mediatek: add falback compatible string for

    MT7981 and MT8516

arm64: dts: mediatek: add thermal sensor support on mt7981

 .../iio/adc/mediatek,mt2701-auxadc.yaml       |  4 +++
 .../bindings/thermal/mediatek,thermal.yaml    | 27 ++++++++++------
 arch/arm64/boot/dts/mediatek/mt7981b.dtsi     | 31 ++++++++++++++++++-
 3 files changed, 51 insertions(+), 11 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH v3 1/3 dt-bindings: iio: adc: Add support for MT7981

The temperature sensor in the MT7981 is same as in the MT7986. Add compatible string for mt7981.

---
 .../devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml   | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml +4 -0
index b489c984c1bb..14363389f30a 100644
@@ -32,6 +32,10 @@ properties:
           - enum:
               - mediatek,mt7623-auxadc
           - const: mediatek,mt2701-auxadc
+      - items:
+          - enum:
+              - mediatek,mt7981-auxadc
+          - const: mediatek,mt7986-auxadc
       - items:
           - enum:
               - mediatek,mt6893-auxadc
Signature · 1 line
2.39.5
Reviewed-by on v3 1/3
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: iio: adc: Add support for MT7981

Quoted 7 lines · Aleksander Jan Bajkowski

The temperature sensor in the MT7981 is same as in the MT7986. Add compatible string for mt7981.

---
 .../devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml   | 4 ++++
 1 file changed, 4 insertions(+)

<form letter>
This is an automated instruction, just in case, because many review tags are being ignored. If you know the process, just skip it entirely (please do not feel offended by me posting it here - no bad intentions intended, no patronizing, I just want to avoid wasted efforts). If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here ('b4 trailers -u ...'). However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L591
</form letter>

Best regards,
Krzysztof

maintainer Applied
#3 lore raw

Re: [PATCH v3 1/3] dt-bindings: iio: adc: Add support for MT7981

Quoted 11 lines · On Wed, 9 Jul 2025 10:27:50 +0200 Krzysztof Kozlowski <[email protected]> wrote:
Quoted 7 lines · Aleksander Jan Bajkowski

The temperature sensor in the MT7981 is same as in the MT7986. Add compatible string for mt7981.

---
 .../devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml   | 4 ++++
 1 file changed, 4 insertions(+)  

Picked up this patch for the togreg branch of iio.git. Initially pushed out as testing as other stuff on there needs some test build coverage.

Quoted 23 lines

<form letter>
This is an automated instruction, just in case, because many review tags are being ignored. If you know the process, just skip it entirely (please do not feel offended by me posting it here - no bad intentions intended, no patronizing, I just want to avoid wasted efforts). If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here ('b4 trailers -u ...'). However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L591
</form letter>

Best regards,
Krzysztof

#4 lore raw

PATCH v3 2/3 dt-bindings: thermal: mediatek: add falback compatible string for MT7981 and MT8516

In reply to Aleksander Jan Bajkowski

The ‘mediatek,mt7981-thermal’ and ‘mediatek,mt8516-thermal’ strings aren't definied in the driver. Both should have fallback compatible strings. This commit fixes this issue.

Fixes 788494ba0999 ("dt-bindings: thermal: convert Mediatek Thermal to the json-schema")
---
 .../bindings/thermal/mediatek,thermal.yaml    | 27 ++++++++++++-------
 1 file changed, 17 insertions(+), 10 deletions(-)
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml +17 -10
index d96a2e32bd8f..1c10d7adc77a 100644
@@ -20,16 +20,23 @@ allOf:
 
 properties:
   compatible:
-    enum:
-      - mediatek,mt2701-thermal
-      - mediatek,mt2712-thermal
-      - mediatek,mt7622-thermal
-      - mediatek,mt7981-thermal
-      - mediatek,mt7986-thermal
-      - mediatek,mt8173-thermal
-      - mediatek,mt8183-thermal
-      - mediatek,mt8365-thermal
-      - mediatek,mt8516-thermal
+    oneOf:
+      - enum:
+          - mediatek,mt2701-thermal
+          - mediatek,mt2712-thermal
+          - mediatek,mt7622-thermal
+          - mediatek,mt7986-thermal
+          - mediatek,mt8173-thermal
+          - mediatek,mt8183-thermal
+          - mediatek,mt8365-thermal
+      - items:
+          - enum:
+              - mediatek,mt7981-thermal
+          - const: mediatek,mt7986-thermal
+      - items:
+          - enum:
+              - mediatek,mt8516-thermal
+          - const: mediatek,mt2701-thermal
 
   reg:
     maxItems: 1
Signature · 1 line
2.39.5
Reviewed-by on v3 2/3
#5 lore raw

Re: [PATCH v3 2/3] dt-bindings: thermal: mediatek: add falback compatible string for MT7981 and MT8516

Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml allOf: · line 39

Quoted 8 lines · Aleksander Jan Bajkowski
Documentation/devicetree/bindings/thermal/mediatek,thermal.yaml +8 -0
+      - items:
+          - enum:
+              - mediatek,mt7981-thermal
+          - const: mediatek,mt7986-thermal
+      - items:
+          - enum:
+              - mediatek,mt8516-thermal
+          - const: mediatek,mt2701-thermal

Groups of lists usually we order by fallback, so first goes items with mediatek,mt2701-thermal fallback and then items with mediatek,mt7986-thermal fallback.

Anyway:

Best regards,
Krzysztof

#6 lore raw

PATCH v3 3/3 arm64: dts: mediatek: add thermal sensor support on mt7981

In reply to Aleksander Jan Bajkowski

The temperature sensor in the MT7981 is same as in the MT7986.

---
 arch/arm64/boot/dts/mediatek/mt7981b.dtsi | 31 ++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt7981b.dtsi +30 -1
index 5cbea9cd411f..277c11247c13 100644
@@ -76,7 +76,7 @@ watchdog: watchdog@1001c000 {
 			#reset-cells = <1>;
 		};
 
-		clock-controller@1001e000 {
+		apmixedsys: clock-controller@1001e000 {
 			compatible = "mediatek,mt7981-apmixedsys";
 			reg = <0 0x1001e000 0 0x1000>;
 			#clock-cells = <1>;
@@ -184,6 +184,31 @@ spi@1100b000 {
 			status = "disabled";
 		};
 
+		thermal@1100c800 {
+			compatible = "mediatek,mt7981-thermal",
+				     "mediatek,mt7986-thermal";
+			reg = <0 0x1100c800 0 0x800>;
+			interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&infracfg CLK_INFRA_THERM_CK>,
+				 <&infracfg CLK_INFRA_ADC_26M_CK>;
+			clock-names = "therm", "auxadc";
+			nvmem-cells = <&thermal_calibration>;
+			nvmem-cell-names = "calibration-data";
+			#thermal-sensor-cells = <1>;
+			mediatek,auxadc = <&auxadc>;
+			mediatek,apmixedsys = <&apmixedsys>;
+		};
+
+		auxadc: adc@1100d000 {
+			compatible = "mediatek,mt7981-auxadc",
+				     "mediatek,mt7986-auxadc";
+			reg = <0 0x1100d000 0 0x1000>;
+			clocks = <&infracfg CLK_INFRA_ADC_26M_CK>;
+			clock-names = "main";
+			#io-channel-cells = <1>;
+			status = "disabled";
+		};
+
 		pio: pinctrl@11d00000 {
 			compatible = "mediatek,mt7981-pinctrl";
 			reg = <0 0x11d00000 0 0x1000>,
@@ -211,6 +236,10 @@ efuse@11f20000 {
 			reg = <0 0x11f20000 0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
+
+			thermal_calibration: thermal-calib@274 {
+				reg = <0x274 0xc>;
+			};
 		};
 
 		clock-controller@15000000 {
Signature · 1 line
2.39.5