mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] thermal/drivers/mediatek/lvts_thermal: Add coeff for mt8192
@ 2024-04-10 10:06 Hsin-Te Yuan
  2024-04-10 10:07 ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 2+ messages in thread
From: Hsin-Te Yuan @ 2024-04-10 10:06 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Matthias Brugger, AngeloGioacchino Del Regno,
	Nícolas F. R. A. Prado, Bernhard Rosenkränzer,
	Balsam CHIHI
  Cc: Alexandre Mergnat, linux-pm, linux-kernel, linux-arm-kernel,
	linux-mediatek, Hsin-Te Yuan

In order for lvts_raw_to_temp to function properly on mt8192,
temperature coefficients for mt8192 need to be added.

Fixes: 288732242db4 ("thermal/drivers/mediatek/lvts_thermal: Add mt8192 support")
Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
---
 drivers/thermal/mediatek/lvts_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index fd4bd650c77a6..6d226c3e135ca 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -80,6 +80,8 @@
 #define LVTS_SENSOR_MAX				4
 #define LVTS_GOLDEN_TEMP_MAX		62
 #define LVTS_GOLDEN_TEMP_DEFAULT	50
+#define LVTS_COEFF_A_MT8192			-250460
+#define LVTS_COEFF_B_MT8192			250460
 #define LVTS_COEFF_A_MT8195			-250460
 #define LVTS_COEFF_B_MT8195			250460
 #define LVTS_COEFF_A_MT7988			-204650
@@ -1530,11 +1532,15 @@ static const struct lvts_data mt7988_lvts_ap_data = {
 static const struct lvts_data mt8192_lvts_mcu_data = {
 	.lvts_ctrl	= mt8192_lvts_mcu_data_ctrl,
 	.num_lvts_ctrl	= ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl),
+	.temp_factor	= LVTS_COEFF_A_MT8192,
+	.temp_offset	= LVTS_COEFF_B_MT8192,
 };
 
 static const struct lvts_data mt8192_lvts_ap_data = {
 	.lvts_ctrl	= mt8192_lvts_ap_data_ctrl,
 	.num_lvts_ctrl	= ARRAY_SIZE(mt8192_lvts_ap_data_ctrl),
+	.temp_factor	= LVTS_COEFF_A_MT8192,
+	.temp_offset	= LVTS_COEFF_B_MT8192,
 };
 
 static const struct lvts_data mt8195_lvts_mcu_data = {

---
base-commit: 20cb38a7af88dc40095da7c2c9094da3873fea23
change-id: 20240410-lvts_thermal-3d365847acff

Best regards,
-- 
Hsin-Te Yuan <yuanhsinte@chromium.org>


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

* Re: [PATCH] thermal/drivers/mediatek/lvts_thermal: Add coeff for mt8192
  2024-04-10 10:06 [PATCH] thermal/drivers/mediatek/lvts_thermal: Add coeff for mt8192 Hsin-Te Yuan
@ 2024-04-10 10:07 ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-04-10 10:07 UTC (permalink / raw)
  To: Hsin-Te Yuan, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Matthias Brugger, Nícolas F. R. A. Prado,
	Bernhard Rosenkränzer, Balsam CHIHI
  Cc: Alexandre Mergnat, linux-pm, linux-kernel, linux-arm-kernel,
	linux-mediatek

Il 10/04/24 12:06, Hsin-Te Yuan ha scritto:
> In order for lvts_raw_to_temp to function properly on mt8192,
> temperature coefficients for mt8192 need to be added.
> 
> Fixes: 288732242db4 ("thermal/drivers/mediatek/lvts_thermal: Add mt8192 support")
> Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
> ---
>   drivers/thermal/mediatek/lvts_thermal.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index fd4bd650c77a6..6d226c3e135ca 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -80,6 +80,8 @@
>   #define LVTS_SENSOR_MAX				4
>   #define LVTS_GOLDEN_TEMP_MAX		62
>   #define LVTS_GOLDEN_TEMP_DEFAULT	50
> +#define LVTS_COEFF_A_MT8192			-250460
> +#define LVTS_COEFF_B_MT8192			250460

This is the same as LVTS_COEFF_{A,B}_MT8195, please just assign that to both
7988 and 8192's lvts_ap_data.

No need to create duplicate definitions.

Cheers,
Angelo

>   #define LVTS_COEFF_A_MT8195			-250460
>   #define LVTS_COEFF_B_MT8195			250460
>   #define LVTS_COEFF_A_MT7988			-204650
> @@ -1530,11 +1532,15 @@ static const struct lvts_data mt7988_lvts_ap_data = {
>   static const struct lvts_data mt8192_lvts_mcu_data = {
>   	.lvts_ctrl	= mt8192_lvts_mcu_data_ctrl,
>   	.num_lvts_ctrl	= ARRAY_SIZE(mt8192_lvts_mcu_data_ctrl),
> +	.temp_factor	= LVTS_COEFF_A_MT8192,
> +	.temp_offset	= LVTS_COEFF_B_MT8192,
>   };
>   
>   static const struct lvts_data mt8192_lvts_ap_data = {
>   	.lvts_ctrl	= mt8192_lvts_ap_data_ctrl,
>   	.num_lvts_ctrl	= ARRAY_SIZE(mt8192_lvts_ap_data_ctrl),
> +	.temp_factor	= LVTS_COEFF_A_MT8192,
> +	.temp_offset	= LVTS_COEFF_B_MT8192,
>   };
>   
>   static const struct lvts_data mt8195_lvts_mcu_data = {
> 
> ---
> base-commit: 20cb38a7af88dc40095da7c2c9094da3873fea23
> change-id: 20240410-lvts_thermal-3d365847acff
> 
> Best regards,


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

end of thread, other threads:[~2024-04-10 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 10:06 [PATCH] thermal/drivers/mediatek/lvts_thermal: Add coeff for mt8192 Hsin-Te Yuan
2024-04-10 10:07 ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®