linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Add thermal sensors support for MT7981
@ 2025-06-28 22:38 Aleksander Jan Bajkowski
  2025-06-28 22:38 ` [PATCH 1/3] arm64: dts: mediatek: add thermal sensor support on mt7981 Aleksander Jan Bajkowski
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-06-28 22:38 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, lukasz.luba, jic23, dlechner,
	nuno.sa, andy, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, olek2, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

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

Aleksander Jan Bajkowski (3):
  arm64: dts: mediatek: add thermal sensor support on mt7981
  thermal/drivers/mediatek: Add support for MT7981 SoC
  dt-bindings: iio: adc: Add support for MT7981

 .../iio/adc/mediatek,mt2701-auxadc.yaml       |  1 +
 arch/arm64/boot/dts/mediatek/mt7981b.dtsi     | 29 ++++++++++++++++++-
 drivers/thermal/mediatek/auxadc_thermal.c     |  4 +++
 3 files changed, 33 insertions(+), 1 deletion(-)

-- 
2.39.5



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] arm64: dts: mediatek: add thermal sensor support on mt7981
  2025-06-28 22:38 [PATCH 0/3] Add thermal sensors support for MT7981 Aleksander Jan Bajkowski
@ 2025-06-28 22:38 ` Aleksander Jan Bajkowski
  2025-06-28 22:38 ` [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC Aleksander Jan Bajkowski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-06-28 22:38 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, lukasz.luba, jic23, dlechner,
	nuno.sa, andy, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, olek2, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

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

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 arch/arm64/boot/dts/mediatek/mt7981b.dtsi | 29 ++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7981b.dtsi b/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
index 5cbea9cd411f..c2001a82722a 100644
--- a/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7981b.dtsi
@@ -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,29 @@ spi@1100b000 {
 			status = "disabled";
 		};
 
+		thermal@1100c800 {
+			compatible = "mediatek,mt7981-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";
+			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 +234,10 @@ efuse@11f20000 {
 			reg = <0 0x11f20000 0 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <1>;
+
+			thermal_calibration: calib@274 {
+				reg = <0x274 0xc>;
+			};
 		};
 
 		clock-controller@15000000 {
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
  2025-06-28 22:38 [PATCH 0/3] Add thermal sensors support for MT7981 Aleksander Jan Bajkowski
  2025-06-28 22:38 ` [PATCH 1/3] arm64: dts: mediatek: add thermal sensor support on mt7981 Aleksander Jan Bajkowski
@ 2025-06-28 22:38 ` Aleksander Jan Bajkowski
  2025-06-29 16:33   ` Jonathan Cameron
  2025-06-30  7:29   ` AngeloGioacchino Del Regno
  2025-06-28 22:38 ` [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981 Aleksander Jan Bajkowski
  2025-06-29 17:24 ` [PATCH 0/3] Add thermal sensors " David Lechner
  3 siblings, 2 replies; 9+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-06-28 22:38 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, lukasz.luba, jic23, dlechner,
	nuno.sa, andy, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, olek2, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

The temperature sensor support on the MT7981 is exactly the same
as on the MT7986.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 drivers/thermal/mediatek/auxadc_thermal.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
index 9ee2e7283435..020324901505 100644
--- a/drivers/thermal/mediatek/auxadc_thermal.c
+++ b/drivers/thermal/mediatek/auxadc_thermal.c
@@ -1149,6 +1149,10 @@ static const struct of_device_id mtk_thermal_of_match[] = {
 		.compatible = "mediatek,mt7622-thermal",
 		.data = (void *)&mt7622_thermal_data,
 	},
+	{
+		.compatible = "mediatek,mt7981-thermal",
+		.data = (void *)&mt7986_thermal_data,
+	},
 	{
 		.compatible = "mediatek,mt7986-thermal",
 		.data = (void *)&mt7986_thermal_data,
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981
  2025-06-28 22:38 [PATCH 0/3] Add thermal sensors support for MT7981 Aleksander Jan Bajkowski
  2025-06-28 22:38 ` [PATCH 1/3] arm64: dts: mediatek: add thermal sensor support on mt7981 Aleksander Jan Bajkowski
  2025-06-28 22:38 ` [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC Aleksander Jan Bajkowski
@ 2025-06-28 22:38 ` Aleksander Jan Bajkowski
  2025-06-29 17:26   ` David Lechner
  2025-06-30  7:30   ` AngeloGioacchino Del Regno
  2025-06-29 17:24 ` [PATCH 0/3] Add thermal sensors " David Lechner
  3 siblings, 2 replies; 9+ messages in thread
From: Aleksander Jan Bajkowski @ 2025-06-28 22:38 UTC (permalink / raw)
  To: rafael, daniel.lezcano, rui.zhang, lukasz.luba, jic23, dlechner,
	nuno.sa, andy, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, olek2, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

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

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 .../devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml      | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml b/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
index b489c984c1bb..ceb914dde15b 100644
--- a/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
@@ -26,6 +26,7 @@ properties:
           - mediatek,mt2712-auxadc
           - mediatek,mt6765-auxadc
           - mediatek,mt7622-auxadc
+          - mediatek,mt7981-auxadc
           - mediatek,mt7986-auxadc
           - mediatek,mt8173-auxadc
       - items:
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
  2025-06-28 22:38 ` [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC Aleksander Jan Bajkowski
@ 2025-06-29 16:33   ` Jonathan Cameron
  2025-06-30  7:29   ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 9+ messages in thread
From: Jonathan Cameron @ 2025-06-29 16:33 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski
  Cc: rafael, daniel.lezcano, rui.zhang, lukasz.luba, dlechner, nuno.sa,
	andy, robh, krzk+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, zhiyong.tao, linux-pm, linux-iio,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

On Sun, 29 Jun 2025 00:38:36 +0200
Aleksander Jan Bajkowski <olek2@wp.pl> wrote:

> The temperature sensor support on the MT7981 is exactly the same
> as on the MT7986.
> 
> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>  drivers/thermal/mediatek/auxadc_thermal.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index 9ee2e7283435..020324901505 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -1149,6 +1149,10 @@ static const struct of_device_id mtk_thermal_of_match[] = {
>  		.compatible = "mediatek,mt7622-thermal",
>  		.data = (void *)&mt7622_thermal_data,
>  	},
> +	{
> +		.compatible = "mediatek,mt7981-thermal",
> +		.data = (void *)&mt7986_thermal_data,

Random drive by question.  Why the (void *) casts?

static const struct mtk_thermal_data mt7986_thermal_data;
is the definition and data is a const void * so
you should be able to assign directly without a cast and not
have the casting away of const only to assign it to a
const void *

> +	},
>  	{
>  		.compatible = "mediatek,mt7986-thermal",
>  		.data = (void *)&mt7986_thermal_data,



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] Add thermal sensors support for MT7981
  2025-06-28 22:38 [PATCH 0/3] Add thermal sensors support for MT7981 Aleksander Jan Bajkowski
                   ` (2 preceding siblings ...)
  2025-06-28 22:38 ` [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981 Aleksander Jan Bajkowski
@ 2025-06-29 17:24 ` David Lechner
  3 siblings, 0 replies; 9+ messages in thread
From: David Lechner @ 2025-06-29 17:24 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, rafael, daniel.lezcano, rui.zhang,
	lukasz.luba, jic23, nuno.sa, andy, robh, krzk+dt, conor+dt,
	matthias.bgg, angelogioacchino.delregno, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 6/28/25 5:38 PM, Aleksander Jan Bajkowski wrote:
> This patch adds support for the temperature sensor in the MT7981 SoC.
> This sensor is exactly the same as the one in the MT7986.
> 
> Aleksander Jan Bajkowski (3):
>   arm64: dts: mediatek: add thermal sensor support on mt7981
>   thermal/drivers/mediatek: Add support for MT7981 SoC
>   dt-bindings: iio: adc: Add support for MT7981

When considering building and testing at each commit, it would make sense
to reverse the order of these patches to reduce the possibility of errors.

> 
>  .../iio/adc/mediatek,mt2701-auxadc.yaml       |  1 +
>  arch/arm64/boot/dts/mediatek/mt7981b.dtsi     | 29 ++++++++++++++++++-
>  drivers/thermal/mediatek/auxadc_thermal.c     |  4 +++
>  3 files changed, 33 insertions(+), 1 deletion(-)
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981
  2025-06-28 22:38 ` [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981 Aleksander Jan Bajkowski
@ 2025-06-29 17:26   ` David Lechner
  2025-06-30  7:30   ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 9+ messages in thread
From: David Lechner @ 2025-06-29 17:26 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, rafael, daniel.lezcano, rui.zhang,
	lukasz.luba, jic23, nuno.sa, andy, robh, krzk+dt, conor+dt,
	matthias.bgg, angelogioacchino.delregno, zhiyong.tao, linux-pm,
	linux-iio, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek

On 6/28/25 5:38 PM, Aleksander Jan Bajkowski wrote:
> The temperature sensor in the MT7981 is same as in the MT7986.
> Add compatible string for mt7981.
> 

If they are exactly the same, then we would want to include fallback to
the existing identical compatible string rather than adding a new standalone
compatible.

> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>  .../devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml      | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml b/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
> index b489c984c1bb..ceb914dde15b 100644
> --- a/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/mediatek,mt2701-auxadc.yaml
> @@ -26,6 +26,7 @@ properties:
>            - mediatek,mt2712-auxadc
>            - mediatek,mt6765-auxadc
>            - mediatek,mt7622-auxadc
> +          - mediatek,mt7981-auxadc
>            - mediatek,mt7986-auxadc
>            - mediatek,mt8173-auxadc
>        - items:



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
  2025-06-28 22:38 ` [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC Aleksander Jan Bajkowski
  2025-06-29 16:33   ` Jonathan Cameron
@ 2025-06-30  7:29   ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 9+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-30  7:29 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, rafael, daniel.lezcano, rui.zhang,
	lukasz.luba, jic23, dlechner, nuno.sa, andy, robh, krzk+dt,
	conor+dt, matthias.bgg, zhiyong.tao, linux-pm, linux-iio,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

Il 29/06/25 00:38, Aleksander Jan Bajkowski ha scritto:
> The temperature sensor support on the MT7981 is exactly the same
> as on the MT7986.
> 

If it is exactly the same, great! ... but then this change is wrong :-)
You should, instead, change the bindings to allow you to specify

compatible = "mediatek,mt7981-thermal", "mediatek,mt7986-thermal";

...and that's about it, no driver changes to be done.

Cheers,
Angelo

> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
> ---
>   drivers/thermal/mediatek/auxadc_thermal.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c
> index 9ee2e7283435..020324901505 100644
> --- a/drivers/thermal/mediatek/auxadc_thermal.c
> +++ b/drivers/thermal/mediatek/auxadc_thermal.c
> @@ -1149,6 +1149,10 @@ static const struct of_device_id mtk_thermal_of_match[] = {
>   		.compatible = "mediatek,mt7622-thermal",
>   		.data = (void *)&mt7622_thermal_data,
>   	},
> +	{
> +		.compatible = "mediatek,mt7981-thermal",
> +		.data = (void *)&mt7986_thermal_data,
> +	},
>   	{
>   		.compatible = "mediatek,mt7986-thermal",
>   		.data = (void *)&mt7986_thermal_data,



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981
  2025-06-28 22:38 ` [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981 Aleksander Jan Bajkowski
  2025-06-29 17:26   ` David Lechner
@ 2025-06-30  7:30   ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 9+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-30  7:30 UTC (permalink / raw)
  To: Aleksander Jan Bajkowski, rafael, daniel.lezcano, rui.zhang,
	lukasz.luba, jic23, dlechner, nuno.sa, andy, robh, krzk+dt,
	conor+dt, matthias.bgg, zhiyong.tao, linux-pm, linux-iio,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek

Il 29/06/25 00:38, Aleksander Jan Bajkowski ha scritto:
> The temperature sensor in the MT7981 is same as in the MT7986.
> Add compatible string for mt7981.
> 
> Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-06-30  7:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28 22:38 [PATCH 0/3] Add thermal sensors support for MT7981 Aleksander Jan Bajkowski
2025-06-28 22:38 ` [PATCH 1/3] arm64: dts: mediatek: add thermal sensor support on mt7981 Aleksander Jan Bajkowski
2025-06-28 22:38 ` [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC Aleksander Jan Bajkowski
2025-06-29 16:33   ` Jonathan Cameron
2025-06-30  7:29   ` AngeloGioacchino Del Regno
2025-06-28 22:38 ` [PATCH 3/3] dt-bindings: iio: adc: Add support for MT7981 Aleksander Jan Bajkowski
2025-06-29 17:26   ` David Lechner
2025-06-30  7:30   ` AngeloGioacchino Del Regno
2025-06-29 17:24 ` [PATCH 0/3] Add thermal sensors " David Lechner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).