linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] Exynos Thermal code improvement
@ 2025-04-10  6:37 Anand Moon
  2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-10  6:37 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Alim Akhtar,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: Anand Moon

Hi All,

This patch series is a rework of my previous patch series [1],
where the code changes were not adequately justified.

In this new series, I have improved the commit subject
and commit message to better explain the changes.

v5: Drop the guard mutex patch
v4: Tried to address Lukasz review comments.

Tested on Odroid U3 amd XU4 SoC boards.
Build with clang with W=1 enable.

[3] https://lore.kernel.org/all/20250310143450.8276-2-linux.amoon@gmail.com/
[2] https://lore.kernel.org/all/20250216195850.5352-2-linux.amoon@gmail.com/
[1] https://lore.kernel.org/all/20220515064126.1424-1-linux.amoon@gmail.com/
[0] https://lore.kernel.org/lkml/CANAwSgS=08fVsqn95WHzSF71WTTyD2-=K2C6-BEz0tY0t6A1-g@mail.gmail.com/T/#m77e57120d230d57f34c29e1422d7fc5f5587ac30

Thanks
-Anand

Anand Moon (3):
  drivers/thermal/exynos: Refactor clk_sec initialization inside
    SOC-specific case
  drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec
    clock
  drivers/thermal/exymos: Fixed the efuse min max value for exynos5422

 drivers/thermal/samsung/exynos_tmu.c | 62 ++++++++++++++++------------
 1 file changed, 35 insertions(+), 27 deletions(-)


base-commit: 3b07108ada81a8ebcebf1fe61367b4e436c895bd
-- 
2.49.0



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

* [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case
  2025-04-10  6:37 [PATCH v5 0/3] Exynos Thermal code improvement Anand Moon
@ 2025-04-10  6:37 ` Anand Moon
  2025-04-15  8:47   ` Lukasz Luba
  2025-04-18  8:06   ` Daniel Lezcano
  2025-04-10  6:37 ` [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock Anand Moon
  2025-04-10  6:37 ` [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422 Anand Moon
  2 siblings, 2 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-10  6:37 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Alim Akhtar,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: Anand Moon

Refactor the initialization of the clk_sec clock to be inside the
SOC_ARCH_EXYNOS5420_TRIMINFO case. It ensures that the clk_sec clock
is only initialized for the specified SOC and not for other SOCs,
thereby simplifying the code. The clk_sec clock is used by the TMU
for GPU on the Exynos 542x platform.

Removed redundant IS_ERR() checks for the clk_sec clock since error
handling is already managed internally by clk_unprepare() functions.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v5: None
v4: Fix the aligment of code clk for clk_prepare in proper if/else block.
    update the commit for clk_sec used.
    checked to goto clean up all the clks are proper.
    drop IS_ERR() check for clk_sec.
v3: improve the commit message.
---
 drivers/thermal/samsung/exynos_tmu.c | 37 ++++++++++++++--------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 47a99b3c5395..3657920de000 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1037,29 +1037,30 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 		return ret;
 
 	data->clk = devm_clk_get(dev, "tmu_apbif");
-	if (IS_ERR(data->clk))
+	if (IS_ERR(data->clk)) {
 		return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");
-
-	data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
-	if (IS_ERR(data->clk_sec)) {
-		if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
-			return dev_err_probe(dev, PTR_ERR(data->clk_sec),
-					     "Failed to get triminfo clock\n");
 	} else {
-		ret = clk_prepare(data->clk_sec);
+		ret = clk_prepare(data->clk);
 		if (ret) {
 			dev_err(dev, "Failed to get clock\n");
 			return ret;
 		}
 	}
 
-	ret = clk_prepare(data->clk);
-	if (ret) {
-		dev_err(dev, "Failed to get clock\n");
-		goto err_clk_sec;
-	}
-
 	switch (data->soc) {
+	case SOC_ARCH_EXYNOS5420_TRIMINFO:
+		data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
+		if (IS_ERR(data->clk_sec)) {
+			ret = dev_err_probe(dev, PTR_ERR(data->clk_sec),
+					    "Failed to get clk_sec clock\n");
+			goto err_clk;
+		}
+		ret = clk_prepare(data->clk_sec);
+		if (ret) {
+			dev_err(dev, "Failed to prepare clk_sec clock\n");
+			goto err_clk_sec;
+		}
+		break;
 	case SOC_ARCH_EXYNOS5433:
 	case SOC_ARCH_EXYNOS7:
 		data->sclk = devm_clk_get(dev, "tmu_sclk");
@@ -1112,11 +1113,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 
 err_sclk:
 	clk_disable_unprepare(data->sclk);
+err_clk_sec:
+	clk_unprepare(data->clk_sec);
 err_clk:
 	clk_unprepare(data->clk);
-err_clk_sec:
-	if (!IS_ERR(data->clk_sec))
-		clk_unprepare(data->clk_sec);
 	return ret;
 }
 
@@ -1128,8 +1128,7 @@ static void exynos_tmu_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(data->sclk);
 	clk_unprepare(data->clk);
-	if (!IS_ERR(data->clk_sec))
-		clk_unprepare(data->clk_sec);
+	clk_unprepare(data->clk_sec);
 }
 
 #ifdef CONFIG_PM_SLEEP
-- 
2.49.0



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

* [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock
  2025-04-10  6:37 [PATCH v5 0/3] Exynos Thermal code improvement Anand Moon
  2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
@ 2025-04-10  6:37 ` Anand Moon
  2025-04-15  8:38   ` Lukasz Luba
  2025-04-18  8:11   ` Daniel Lezcano
  2025-04-10  6:37 ` [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422 Anand Moon
  2 siblings, 2 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-10  6:37 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Alim Akhtar,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: Anand Moon

Remove unnecessary IS_ERR() checks for the clk_sec clock,
the clk_enable() and clk_disable() functions can handle NULL clock
pointers, so the additional checks are redundant and have been removed
to simplify the code.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v5: None
v4: drop IE_ERR() for clk_unprepare() as its handle in earlier code.
v3: improve the commit message.
---
 drivers/thermal/samsung/exynos_tmu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 3657920de000..ac3b9d2c900c 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -258,8 +258,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 
 	mutex_lock(&data->lock);
 	clk_enable(data->clk);
-	if (!IS_ERR(data->clk_sec))
-		clk_enable(data->clk_sec);
+	clk_enable(data->clk_sec);
 
 	status = readb(data->base + EXYNOS_TMU_REG_STATUS);
 	if (!status) {
@@ -269,8 +268,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
 		data->tmu_clear_irqs(data);
 	}
 
-	if (!IS_ERR(data->clk_sec))
-		clk_disable(data->clk_sec);
+	clk_disable(data->clk_sec);
 	clk_disable(data->clk);
 	mutex_unlock(&data->lock);
 
-- 
2.49.0



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

* [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422
  2025-04-10  6:37 [PATCH v5 0/3] Exynos Thermal code improvement Anand Moon
  2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
  2025-04-10  6:37 ` [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock Anand Moon
@ 2025-04-10  6:37 ` Anand Moon
  2025-04-15  8:36   ` Lukasz Luba
  2025-04-18  8:19   ` Daniel Lezcano
  2 siblings, 2 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-10  6:37 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Alim Akhtar,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
  Cc: Anand Moon

As per Exynos5422 user manual e-Fuse range min~max range is 16~76.
if e-Fuse value is out of this range, then thermal sensor may not
sense thermal data properly. Refactors the efuse value
initialization logic within exynos_map_dt_data function by
replacing the nested if-else statements with a switch statement.
Ensures proper initialization of efuse values based on the SOC type.

Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v5: None
v4: None
v3: Improve the logic to convert if/else to switch
---
 drivers/thermal/samsung/exynos_tmu.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index ac3b9d2c900c..a71cde0a4b17 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -899,12 +899,23 @@ static int exynos_map_dt_data(struct platform_device *pdev)
 		data->gain = 8;
 		data->reference_voltage = 16;
 		data->efuse_value = 55;
-		if (data->soc != SOC_ARCH_EXYNOS5420 &&
-		    data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO)
+		data->max_efuse_value = 100;
+		switch (data->soc) {
+		case SOC_ARCH_EXYNOS3250:
+		case SOC_ARCH_EXYNOS4412:
+		case SOC_ARCH_EXYNOS5250:
+		case SOC_ARCH_EXYNOS5260:
 			data->min_efuse_value = 40;
-		else
+			break;
+		case SOC_ARCH_EXYNOS5420:
+		case SOC_ARCH_EXYNOS5420_TRIMINFO:
+			data->min_efuse_value = 16;
+			data->max_efuse_value = 76;
+			break;
+		default:
 			data->min_efuse_value = 0;
-		data->max_efuse_value = 100;
+			break;
+		}
 		break;
 	case SOC_ARCH_EXYNOS5433:
 		data->tmu_set_low_temp = exynos5433_tmu_set_low_temp;
-- 
2.49.0



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

* Re: [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422
  2025-04-10  6:37 ` [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422 Anand Moon
@ 2025-04-15  8:36   ` Lukasz Luba
  2025-04-18  8:19   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Lukasz Luba @ 2025-04-15  8:36 UTC (permalink / raw)
  To: Anand Moon
  Cc: Bartlomiej Zolnierkiewicz, open list:SAMSUNG THERMAL DRIVER,
	Justin Stitt, Bill Wendling, Zhang Rui, Daniel Lezcano, open list,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b,
	open list:SAMSUNG THERMAL DRIVER, Rafael J. Wysocki,
	Krzysztof Kozlowski, Nick Desaulniers, Nathan Chancellor,
	Alim Akhtar



On 4/10/25 07:37, Anand Moon wrote:
> As per Exynos5422 user manual e-Fuse range min~max range is 16~76.
> if e-Fuse value is out of this range, then thermal sensor may not
> sense thermal data properly. Refactors the efuse value
> initialization logic within exynos_map_dt_data function by
> replacing the nested if-else statements with a switch statement.
> Ensures proper initialization of efuse values based on the SOC type.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> v5: None
> v4: None
> v3: Improve the logic to convert if/else to switch
> ---
>   drivers/thermal/samsung/exynos_tmu.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index ac3b9d2c900c..a71cde0a4b17 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -899,12 +899,23 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>   		data->gain = 8;
>   		data->reference_voltage = 16;
>   		data->efuse_value = 55;
> -		if (data->soc != SOC_ARCH_EXYNOS5420 &&
> -		    data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO)
> +		data->max_efuse_value = 100;
> +		switch (data->soc) {
> +		case SOC_ARCH_EXYNOS3250:
> +		case SOC_ARCH_EXYNOS4412:
> +		case SOC_ARCH_EXYNOS5250:
> +		case SOC_ARCH_EXYNOS5260:
>   			data->min_efuse_value = 40;
> -		else
> +			break;
> +		case SOC_ARCH_EXYNOS5420:
> +		case SOC_ARCH_EXYNOS5420_TRIMINFO:
> +			data->min_efuse_value = 16;
> +			data->max_efuse_value = 76;
> +			break;
> +		default:
>   			data->min_efuse_value = 0;
> -		data->max_efuse_value = 100;
> +			break;
> +		}
>   		break;
>   	case SOC_ARCH_EXYNOS5433:
>   		data->tmu_set_low_temp = exynos5433_tmu_set_low_temp;

I should have added that in earlier version: LGTM,

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>


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

* Re: [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock
  2025-04-10  6:37 ` [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock Anand Moon
@ 2025-04-15  8:38   ` Lukasz Luba
  2025-04-18  8:11   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Lukasz Luba @ 2025-04-15  8:38 UTC (permalink / raw)
  To: Anand Moon
  Cc: Bartlomiej Zolnierkiewicz, open list:SAMSUNG THERMAL DRIVER,
	Justin Stitt, Bill Wendling, Nathan Chancellor, Alim Akhtar,
	open list,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b,
	open list:SAMSUNG THERMAL DRIVER, Zhang Rui, Daniel Lezcano,
	Nick Desaulniers, Krzysztof Kozlowski, Rafael J. Wysocki



On 4/10/25 07:37, Anand Moon wrote:
> Remove unnecessary IS_ERR() checks for the clk_sec clock,
> the clk_enable() and clk_disable() functions can handle NULL clock
> pointers, so the additional checks are redundant and have been removed
> to simplify the code.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> v5: None
> v4: drop IE_ERR() for clk_unprepare() as its handle in earlier code.
> v3: improve the commit message.
> ---
>   drivers/thermal/samsung/exynos_tmu.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 3657920de000..ac3b9d2c900c 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -258,8 +258,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>   
>   	mutex_lock(&data->lock);
>   	clk_enable(data->clk);
> -	if (!IS_ERR(data->clk_sec))
> -		clk_enable(data->clk_sec);
> +	clk_enable(data->clk_sec);
>   
>   	status = readb(data->base + EXYNOS_TMU_REG_STATUS);
>   	if (!status) {
> @@ -269,8 +268,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>   		data->tmu_clear_irqs(data);
>   	}
>   
> -	if (!IS_ERR(data->clk_sec))
> -		clk_disable(data->clk_sec);
> +	clk_disable(data->clk_sec);
>   	clk_disable(data->clk);
>   	mutex_unlock(&data->lock);
>   


Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>


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

* Re: [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case
  2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
@ 2025-04-15  8:47   ` Lukasz Luba
  2025-04-18  8:06   ` Daniel Lezcano
  1 sibling, 0 replies; 13+ messages in thread
From: Lukasz Luba @ 2025-04-15  8:47 UTC (permalink / raw)
  To: Anand Moon
  Cc: open list, Justin Stitt, Bill Wendling, Alim Akhtar,
	Krzysztof Kozlowski, Daniel Lezcano, Zhang Rui,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER, Rafael J. Wysocki,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	Nathan Chancellor, Nick Desaulniers, Bartlomiej Zolnierkiewicz



On 4/10/25 07:37, Anand Moon wrote:
> Refactor the initialization of the clk_sec clock to be inside the
> SOC_ARCH_EXYNOS5420_TRIMINFO case. It ensures that the clk_sec clock
> is only initialized for the specified SOC and not for other SOCs,
> thereby simplifying the code. The clk_sec clock is used by the TMU
> for GPU on the Exynos 542x platform.
> 
> Removed redundant IS_ERR() checks for the clk_sec clock since error
> handling is already managed internally by clk_unprepare() functions.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> v5: None
> v4: Fix the aligment of code clk for clk_prepare in proper if/else block.
>      update the commit for clk_sec used.
>      checked to goto clean up all the clks are proper.
>      drop IS_ERR() check for clk_sec.
> v3: improve the commit message.
> ---
>   drivers/thermal/samsung/exynos_tmu.c | 37 ++++++++++++++--------------
>   1 file changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 47a99b3c5395..3657920de000 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -1037,29 +1037,30 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>   		return ret;
>   
>   	data->clk = devm_clk_get(dev, "tmu_apbif");
> -	if (IS_ERR(data->clk))
> +	if (IS_ERR(data->clk)) {
>   		return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");
> -
> -	data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> -	if (IS_ERR(data->clk_sec)) {
> -		if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
> -			return dev_err_probe(dev, PTR_ERR(data->clk_sec),
> -					     "Failed to get triminfo clock\n");
>   	} else {
> -		ret = clk_prepare(data->clk_sec);
> +		ret = clk_prepare(data->clk);
>   		if (ret) {
>   			dev_err(dev, "Failed to get clock\n");
>   			return ret;
>   		}
>   	}
>   
> -	ret = clk_prepare(data->clk);
> -	if (ret) {
> -		dev_err(dev, "Failed to get clock\n");
> -		goto err_clk_sec;
> -	}
> -
>   	switch (data->soc) {
> +	case SOC_ARCH_EXYNOS5420_TRIMINFO:
> +		data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> +		if (IS_ERR(data->clk_sec)) {
> +			ret = dev_err_probe(dev, PTR_ERR(data->clk_sec),
> +					    "Failed to get clk_sec clock\n");
> +			goto err_clk;
> +		}
> +		ret = clk_prepare(data->clk_sec);
> +		if (ret) {
> +			dev_err(dev, "Failed to prepare clk_sec clock\n");
> +			goto err_clk_sec;
> +		}
> +		break;
>   	case SOC_ARCH_EXYNOS5433:
>   	case SOC_ARCH_EXYNOS7:
>   		data->sclk = devm_clk_get(dev, "tmu_sclk");
> @@ -1112,11 +1113,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>   
>   err_sclk:
>   	clk_disable_unprepare(data->sclk);
> +err_clk_sec:
> +	clk_unprepare(data->clk_sec);
>   err_clk:
>   	clk_unprepare(data->clk);
> -err_clk_sec:
> -	if (!IS_ERR(data->clk_sec))
> -		clk_unprepare(data->clk_sec);
>   	return ret;
>   }
>   
> @@ -1128,8 +1128,7 @@ static void exynos_tmu_remove(struct platform_device *pdev)
>   
>   	clk_disable_unprepare(data->sclk);
>   	clk_unprepare(data->clk);
> -	if (!IS_ERR(data->clk_sec))
> -		clk_unprepare(data->clk_sec);
> +	clk_unprepare(data->clk_sec);
>   }
>   
>   #ifdef CONFIG_PM_SLEEP

It looks good. I've missed the v4 where you addressed my comments.

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>


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

* Re: [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case
  2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
  2025-04-15  8:47   ` Lukasz Luba
@ 2025-04-18  8:06   ` Daniel Lezcano
  2025-04-18 13:31     ` Anand Moon
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Lezcano @ 2025-04-18  8:06 UTC (permalink / raw)
  To: Anand Moon
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

On Thu, Apr 10, 2025 at 12:07:48PM +0530, Anand Moon wrote:
> Refactor the initialization of the clk_sec clock to be inside the
> SOC_ARCH_EXYNOS5420_TRIMINFO case. It ensures that the clk_sec clock
> is only initialized for the specified SOC and not for other SOCs,
> thereby simplifying the code. The clk_sec clock is used by the TMU
> for GPU on the Exynos 542x platform.
> 
> Removed redundant IS_ERR() checks for the clk_sec clock since error
> handling is already managed internally by clk_unprepare() functions.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
> v5: None
> v4: Fix the aligment of code clk for clk_prepare in proper if/else block.
>     update the commit for clk_sec used.
>     checked to goto clean up all the clks are proper.
>     drop IS_ERR() check for clk_sec.
> v3: improve the commit message.
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 37 ++++++++++++++--------------
>  1 file changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 47a99b3c5395..3657920de000 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -1037,29 +1037,30 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	data->clk = devm_clk_get(dev, "tmu_apbif");
> -	if (IS_ERR(data->clk))
> +	if (IS_ERR(data->clk)) {
>  		return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");

As this branch returns, the else block can be removed.

	if (IS_ERR(data->clk))
		return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");

	ret = clk_prepare(data->clk);
	if (ret) {
		...
	}

May be worth to group both calls with devm_clk_get_enabled()

> -
> -	data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> -	if (IS_ERR(data->clk_sec)) {
> -		if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
> -			return dev_err_probe(dev, PTR_ERR(data->clk_sec),
> -					     "Failed to get triminfo clock\n");
>  	} else {
> -		ret = clk_prepare(data->clk_sec);
> +		ret = clk_prepare(data->clk);
>  		if (ret) {
>  			dev_err(dev, "Failed to get clock\n");
>  			return ret;
>  		}
>  	}
>  
> -	ret = clk_prepare(data->clk);
> -	if (ret) {
> -		dev_err(dev, "Failed to get clock\n");
> -		goto err_clk_sec;
> -	}
> -
>  	switch (data->soc) {
> +	case SOC_ARCH_EXYNOS5420_TRIMINFO:
> +		data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> +		if (IS_ERR(data->clk_sec)) {
> +			ret = dev_err_probe(dev, PTR_ERR(data->clk_sec),
> +					    "Failed to get clk_sec clock\n");
> +			goto err_clk;
> +		}
> +		ret = clk_prepare(data->clk_sec);

Same comment, devm_clk_get_enabled()

> +		if (ret) {
> +			dev_err(dev, "Failed to prepare clk_sec clock\n");
> +			goto err_clk_sec;
> +		}
> +		break;
>  	case SOC_ARCH_EXYNOS5433:
>  	case SOC_ARCH_EXYNOS7:
>  		data->sclk = devm_clk_get(dev, "tmu_sclk");
> @@ -1112,11 +1113,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
>  
>  err_sclk:
>  	clk_disable_unprepare(data->sclk);
> +err_clk_sec:
> +	clk_unprepare(data->clk_sec);
>  err_clk:
>  	clk_unprepare(data->clk);
> -err_clk_sec:
> -	if (!IS_ERR(data->clk_sec))
> -		clk_unprepare(data->clk_sec);

With devm_ variant those labels should go away

>  	return ret;
>  }
>  
> @@ -1128,8 +1128,7 @@ static void exynos_tmu_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(data->sclk);
>  	clk_unprepare(data->clk);
> -	if (!IS_ERR(data->clk_sec))
> -		clk_unprepare(data->clk_sec);
> +	clk_unprepare(data->clk_sec);
>  }
>  
>  #ifdef CONFIG_PM_SLEEP
> -- 
> 2.49.0
> 

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock
  2025-04-10  6:37 ` [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock Anand Moon
  2025-04-15  8:38   ` Lukasz Luba
@ 2025-04-18  8:11   ` Daniel Lezcano
  2025-04-18 13:31     ` Anand Moon
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Lezcano @ 2025-04-18  8:11 UTC (permalink / raw)
  To: Anand Moon
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

On Thu, Apr 10, 2025 at 12:07:49PM +0530, Anand Moon wrote:
> Remove unnecessary IS_ERR() checks for the clk_sec clock,
> the clk_enable() and clk_disable() functions can handle NULL clock
> pointers, so the additional checks are redundant and have been removed
> to simplify the code.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>

Typo in the subject: s/exymos/exynos/

> ---
> v5: None
> v4: drop IE_ERR() for clk_unprepare() as its handle in earlier code.
> v3: improve the commit message.
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 3657920de000..ac3b9d2c900c 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -258,8 +258,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>  
>  	mutex_lock(&data->lock);
>  	clk_enable(data->clk);
> -	if (!IS_ERR(data->clk_sec))
> -		clk_enable(data->clk_sec);
> +	clk_enable(data->clk_sec);
>  
>  	status = readb(data->base + EXYNOS_TMU_REG_STATUS);
>  	if (!status) {
> @@ -269,8 +268,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
>  		data->tmu_clear_irqs(data);
>  	}
>  
> -	if (!IS_ERR(data->clk_sec))
> -		clk_disable(data->clk_sec);
> +	clk_disable(data->clk_sec);
>  	clk_disable(data->clk);
>  	mutex_unlock(&data->lock);

To be replaced by devm_clk_get_enabled() ?

>  
> -- 
> 2.49.0
> 

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422
  2025-04-10  6:37 ` [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422 Anand Moon
  2025-04-15  8:36   ` Lukasz Luba
@ 2025-04-18  8:19   ` Daniel Lezcano
  2025-04-18 13:32     ` Anand Moon
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Lezcano @ 2025-04-18  8:19 UTC (permalink / raw)
  To: Anand Moon
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

On Thu, Apr 10, 2025 at 12:07:50PM +0530, Anand Moon wrote:
> As per Exynos5422 user manual e-Fuse range min~max range is 16~76.
> if e-Fuse value is out of this range, then thermal sensor may not
> sense thermal data properly. Refactors the efuse value
> initialization logic within exynos_map_dt_data function by
> replacing the nested if-else statements with a switch statement.
> Ensures proper initialization of efuse values based on the SOC type.
> 
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>

Same subject typo: s/exymos/exynos/

> ---
> v5: None
> v4: None
> v3: Improve the logic to convert if/else to switch
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index ac3b9d2c900c..a71cde0a4b17 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -899,12 +899,23 @@ static int exynos_map_dt_data(struct platform_device *pdev)
>  		data->gain = 8;
>  		data->reference_voltage = 16;
>  		data->efuse_value = 55;
> -		if (data->soc != SOC_ARCH_EXYNOS5420 &&
> -		    data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO)
> +		data->max_efuse_value = 100;
> +		switch (data->soc) {
> +		case SOC_ARCH_EXYNOS3250:
> +		case SOC_ARCH_EXYNOS4412:
> +		case SOC_ARCH_EXYNOS5250:
> +		case SOC_ARCH_EXYNOS5260:
>  			data->min_efuse_value = 40;
> -		else
> +			break;
> +		case SOC_ARCH_EXYNOS5420:
> +		case SOC_ARCH_EXYNOS5420_TRIMINFO:
> +			data->min_efuse_value = 16;
> +			data->max_efuse_value = 76;
> +			break;
> +		default:
>  			data->min_efuse_value = 0;
> -		data->max_efuse_value = 100;
> +			break;
> +		}
>  		break;
>  	case SOC_ARCH_EXYNOS5433:
>  		data->tmu_set_low_temp = exynos5433_tmu_set_low_temp;

Thanks for taking care of cleaning up this portion of code. IMO, it would be
interesting to go a bit further in the house keeping by replacing this big
switch with a set of structures stored as __init sections. The initialization
finds the right structure and does a structure copy to 'data'.

It is up to you to do this change or not.

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case
  2025-04-18  8:06   ` Daniel Lezcano
@ 2025-04-18 13:31     ` Anand Moon
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-18 13:31 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

Hi Daniel,

On Fri, 18 Apr 2025 at 13:36, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On Thu, Apr 10, 2025 at 12:07:48PM +0530, Anand Moon wrote:
> > Refactor the initialization of the clk_sec clock to be inside the
> > SOC_ARCH_EXYNOS5420_TRIMINFO case. It ensures that the clk_sec clock
> > is only initialized for the specified SOC and not for other SOCs,
> > thereby simplifying the code. The clk_sec clock is used by the TMU
> > for GPU on the Exynos 542x platform.
> >
> > Removed redundant IS_ERR() checks for the clk_sec clock since error
> > handling is already managed internally by clk_unprepare() functions.
> >
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> > ---
> > v5: None
> > v4: Fix the aligment of code clk for clk_prepare in proper if/else block.
> >     update the commit for clk_sec used.
> >     checked to goto clean up all the clks are proper.
> >     drop IS_ERR() check for clk_sec.
> > v3: improve the commit message.
> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 37 ++++++++++++++--------------
> >  1 file changed, 18 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index 47a99b3c5395..3657920de000 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -1037,29 +1037,30 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >               return ret;
> >
> >       data->clk = devm_clk_get(dev, "tmu_apbif");
> > -     if (IS_ERR(data->clk))
> > +     if (IS_ERR(data->clk)) {
> >               return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");
>
> As this branch returns, the else block can be removed.
>
>         if (IS_ERR(data->clk))
>                 return dev_err_probe(dev, PTR_ERR(data->clk), "Failed to get clock\n");
>
>         ret = clk_prepare(data->clk);
>         if (ret) {
>                 ...
>         }
>
Earlier I got this review comment on this.
[0] https://patchwork.kernel.org/project/linux-samsung-soc/patch/20250216195850.5352-2-linux.amoon@gmail.com/
I will try to fix this in next vrsion.

> May be worth to group both calls with devm_clk_get_enabled()

Earlier, I attempted to change the clock ABI, but it didn't work.

[1] https://lore.kernel.org/all/20220515064126.1424-2-linux.amoon@gmail.com/
If you're okay with changing this, I'll update it in the next version.

> > -
> > -     data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> > -     if (IS_ERR(data->clk_sec)) {
> > -             if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
> > -                     return dev_err_probe(dev, PTR_ERR(data->clk_sec),
> > -                                          "Failed to get triminfo clock\n");
> >       } else {
> > -             ret = clk_prepare(data->clk_sec);
> > +             ret = clk_prepare(data->clk);
> >               if (ret) {
> >                       dev_err(dev, "Failed to get clock\n");
> >                       return ret;
> >               }
> >       }
> >
> > -     ret = clk_prepare(data->clk);
> > -     if (ret) {
> > -             dev_err(dev, "Failed to get clock\n");
> > -             goto err_clk_sec;
> > -     }
> > -
> >       switch (data->soc) {
> > +     case SOC_ARCH_EXYNOS5420_TRIMINFO:
> > +             data->clk_sec = devm_clk_get(dev, "tmu_triminfo_apbif");
> > +             if (IS_ERR(data->clk_sec)) {
> > +                     ret = dev_err_probe(dev, PTR_ERR(data->clk_sec),
> > +                                         "Failed to get clk_sec clock\n");
> > +                     goto err_clk;
> > +             }
> > +             ret = clk_prepare(data->clk_sec);
>
> Same comment, devm_clk_get_enabled()
If you're okay with changing this, I'll update it in the next version.
>
> > +             if (ret) {
> > +                     dev_err(dev, "Failed to prepare clk_sec clock\n");
> > +                     goto err_clk_sec;
> > +             }
> > +             break;
> >       case SOC_ARCH_EXYNOS5433:
> >       case SOC_ARCH_EXYNOS7:
> >               data->sclk = devm_clk_get(dev, "tmu_sclk");
> > @@ -1112,11 +1113,10 @@ static int exynos_tmu_probe(struct platform_device *pdev)
> >
> >  err_sclk:
> >       clk_disable_unprepare(data->sclk);
> > +err_clk_sec:
> > +     clk_unprepare(data->clk_sec);
> >  err_clk:
> >       clk_unprepare(data->clk);
> > -err_clk_sec:
> > -     if (!IS_ERR(data->clk_sec))
> > -             clk_unprepare(data->clk_sec);
>
> With devm_ variant those labels should go away
Correct.

Thanks
-Anand
>
> >       return ret;
> >  }
> >
> > @@ -1128,8 +1128,7 @@ static void exynos_tmu_remove(struct platform_device *pdev)
> >
> >       clk_disable_unprepare(data->sclk);
> >       clk_unprepare(data->clk);
> > -     if (!IS_ERR(data->clk_sec))
> > -             clk_unprepare(data->clk_sec);
> > +     clk_unprepare(data->clk_sec);
> >  }
> >
> >  #ifdef CONFIG_PM_SLEEP
> > --
> > 2.49.0
> >
>
> --
>
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock
  2025-04-18  8:11   ` Daniel Lezcano
@ 2025-04-18 13:31     ` Anand Moon
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-18 13:31 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

Hi Daniel,

On Fri, 18 Apr 2025 at 13:41, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On Thu, Apr 10, 2025 at 12:07:49PM +0530, Anand Moon wrote:
> > Remove unnecessary IS_ERR() checks for the clk_sec clock,
> > the clk_enable() and clk_disable() functions can handle NULL clock
> > pointers, so the additional checks are redundant and have been removed
> > to simplify the code.
> >
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
>
> Typo in the subject: s/exymos/exynos/
>
Thanks for your review comments.
Opps, I will fix this next version it got skipped.

Thanks

-Anand


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

* Re: [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422
  2025-04-18  8:19   ` Daniel Lezcano
@ 2025-04-18 13:32     ` Anand Moon
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Moon @ 2025-04-18 13:32 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski, Rafael J. Wysocki,
	Zhang Rui, Lukasz Luba, Alim Akhtar, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	open list:SAMSUNG THERMAL DRIVER,
	open list:SAMSUNG THERMAL DRIVER,
	moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,
	open list,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b

Hi Daniel,

On Fri, 18 Apr 2025 at 13:49, Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
>
> On Thu, Apr 10, 2025 at 12:07:50PM +0530, Anand Moon wrote:
> > As per Exynos5422 user manual e-Fuse range min~max range is 16~76.
> > if e-Fuse value is out of this range, then thermal sensor may not
> > sense thermal data properly. Refactors the efuse value
> > initialization logic within exynos_map_dt_data function by
> > replacing the nested if-else statements with a switch statement.
> > Ensures proper initialization of efuse values based on the SOC type.
> >
> > Signed-off-by: Anand Moon <linux.amoon@gmail.com>
>
> Same subject typo: s/exymos/exynos/

Thanks for your review comments.
Opps, I will fix this next version it got skipped.

>
> > ---
> > v5: None
> > v4: None
> > v3: Improve the logic to convert if/else to switch
> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 19 +++++++++++++++----
> >  1 file changed, 15 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index ac3b9d2c900c..a71cde0a4b17 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -899,12 +899,23 @@ static int exynos_map_dt_data(struct platform_device *pdev)
> >               data->gain = 8;
> >               data->reference_voltage = 16;
> >               data->efuse_value = 55;
> > -             if (data->soc != SOC_ARCH_EXYNOS5420 &&
> > -                 data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO)
> > +             data->max_efuse_value = 100;
> > +             switch (data->soc) {
> > +             case SOC_ARCH_EXYNOS3250:
> > +             case SOC_ARCH_EXYNOS4412:
> > +             case SOC_ARCH_EXYNOS5250:
> > +             case SOC_ARCH_EXYNOS5260:
> >                       data->min_efuse_value = 40;
> > -             else
> > +                     break;
> > +             case SOC_ARCH_EXYNOS5420:
> > +             case SOC_ARCH_EXYNOS5420_TRIMINFO:
> > +                     data->min_efuse_value = 16;
> > +                     data->max_efuse_value = 76;
> > +                     break;
> > +             default:
> >                       data->min_efuse_value = 0;
> > -             data->max_efuse_value = 100;
> > +                     break;
> > +             }
> >               break;
> >       case SOC_ARCH_EXYNOS5433:
> >               data->tmu_set_low_temp = exynos5433_tmu_set_low_temp;
>
> Thanks for taking care of cleaning up this portion of code. IMO, it would be
> interesting to go a bit further in the house keeping by replacing this big
> switch with a set of structures stored as __init sections. The initialization
> finds the right structure and does a structure copy to 'data'.
>
> It is up to you to do this change or not.

I'll be sure to check this out.

Thanks
-Anand
>
> --
>
>  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog


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

end of thread, other threads:[~2025-04-18 13:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10  6:37 [PATCH v5 0/3] Exynos Thermal code improvement Anand Moon
2025-04-10  6:37 ` [PATCH v5 1/3] drivers/thermal/exynos: Refactor clk_sec initialization inside SOC-specific case Anand Moon
2025-04-15  8:47   ` Lukasz Luba
2025-04-18  8:06   ` Daniel Lezcano
2025-04-18 13:31     ` Anand Moon
2025-04-10  6:37 ` [PATCH v5 2/3] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock Anand Moon
2025-04-15  8:38   ` Lukasz Luba
2025-04-18  8:11   ` Daniel Lezcano
2025-04-18 13:31     ` Anand Moon
2025-04-10  6:37 ` [PATCH v5 3/3] drivers/thermal/exymos: Fixed the efuse min max value for exynos5422 Anand Moon
2025-04-15  8:36   ` Lukasz Luba
2025-04-18  8:19   ` Daniel Lezcano
2025-04-18 13:32     ` Anand Moon

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).