[PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC

Aleksander Jan Bajkowski posted 3 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
Posted by Aleksander Jan Bajkowski 3 months, 1 week ago
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
Re: [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
Posted by AngeloGioacchino Del Regno 3 months, 1 week ago
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,
Re: [PATCH 2/3] thermal/drivers/mediatek: Add support for MT7981 SoC
Posted by Jonathan Cameron 3 months, 1 week ago
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,