diff mbox series

[PATCHv2,4/6] thermal: exynos: fixed the efuse min/max value for exynos5422

Message ID 20220515064126.1424-5-linux.amoon@gmail.com (mailing list archive)
State New
Headers show
Series Exynos Thermal code inprovement | expand

Commit Message

Anand Moon May 15, 2022, 6:41 a.m. UTC
As per Exynos5422 user manaul 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.

Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v1: Fix the commit message
---
 drivers/thermal/samsung/exynos_tmu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Krzysztof Kozlowski May 15, 2022, 9:45 a.m. UTC | #1
On 15/05/2022 08:41, Anand Moon wrote:
> As per Exynos5422 user manaul 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.
> 
> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof
kernel test robot May 16, 2022, 10:42 a.m. UTC | #2
Hi Anand,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ec7f49619d8ee13e108740c82f942cd401b989e9]

url:    https://github.com/intel-lab-lkp/linux/commits/Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
base:   ec7f49619d8ee13e108740c82f942cd401b989e9
config: hexagon-randconfig-r033-20220516 (https://download.01.org/0day-ci/archive/20220516/202205161820.8rHIcsvI-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/eb50b0c2100fabd6d09b87abd11f52c5295512e8
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
        git checkout eb50b0c2100fabd6d09b87abd11f52c5295512e8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/thermal/samsung/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/thermal/samsung/exynos_tmu.c:929:40: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
                   if (data->soc == SOC_ARCH_EXYNOS5420 &&
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
   1 warning generated.


vim +929 drivers/thermal/samsung/exynos_tmu.c

   865	
   866	static int exynos_map_dt_data(struct platform_device *pdev)
   867	{
   868		struct exynos_tmu_data *data = platform_get_drvdata(pdev);
   869		struct resource res;
   870	
   871		if (!data || !pdev->dev.of_node)
   872			return -ENODEV;
   873	
   874		data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl");
   875		if (data->id < 0)
   876			data->id = 0;
   877	
   878		data->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
   879		if (data->irq <= 0) {
   880			dev_err(&pdev->dev, "failed to get IRQ\n");
   881			return -ENODEV;
   882		}
   883	
   884		if (of_address_to_resource(pdev->dev.of_node, 0, &res)) {
   885			dev_err(&pdev->dev, "failed to get Resource 0\n");
   886			return -ENODEV;
   887		}
   888	
   889		data->base = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
   890		if (!data->base) {
   891			dev_err(&pdev->dev, "Failed to ioremap memory\n");
   892			return -EADDRNOTAVAIL;
   893		}
   894	
   895		data->soc = (enum soc_type)of_device_get_match_data(&pdev->dev);
   896	
   897		switch (data->soc) {
   898		case SOC_ARCH_EXYNOS4210:
   899			data->tmu_set_trip_temp = exynos4210_tmu_set_trip_temp;
   900			data->tmu_set_trip_hyst = exynos4210_tmu_set_trip_hyst;
   901			data->tmu_initialize = exynos4210_tmu_initialize;
   902			data->tmu_control = exynos4210_tmu_control;
   903			data->tmu_read = exynos4210_tmu_read;
   904			data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
   905			data->ntrip = 4;
   906			data->gain = 15;
   907			data->reference_voltage = 7;
   908			data->efuse_value = 55;
   909			data->min_efuse_value = 40;
   910			data->max_efuse_value = 100;
   911			break;
   912		case SOC_ARCH_EXYNOS3250:
   913		case SOC_ARCH_EXYNOS4412:
   914		case SOC_ARCH_EXYNOS5250:
   915		case SOC_ARCH_EXYNOS5260:
   916		case SOC_ARCH_EXYNOS5420:
   917		case SOC_ARCH_EXYNOS5420_TRIMINFO:
   918			data->tmu_set_trip_temp = exynos4412_tmu_set_trip_temp;
   919			data->tmu_set_trip_hyst = exynos4412_tmu_set_trip_hyst;
   920			data->tmu_initialize = exynos4412_tmu_initialize;
   921			data->tmu_control = exynos4210_tmu_control;
   922			data->tmu_read = exynos4412_tmu_read;
   923			data->tmu_set_emulation = exynos4412_tmu_set_emulation;
   924			data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
   925			data->ntrip = 4;
   926			data->gain = 8;
   927			data->reference_voltage = 16;
   928			data->efuse_value = 55;
 > 929			if (data->soc == SOC_ARCH_EXYNOS5420 &&
   930			    data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) {
   931				data->min_efuse_value = 16;
   932				data->max_efuse_value = 76;
   933			} else {
   934				data->min_efuse_value = 40;
   935				data->max_efuse_value = 100;
   936			}
   937			break;
   938		case SOC_ARCH_EXYNOS5433:
   939			data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp;
   940			data->tmu_set_trip_hyst = exynos5433_tmu_set_trip_hyst;
   941			data->tmu_initialize = exynos5433_tmu_initialize;
   942			data->tmu_control = exynos5433_tmu_control;
   943			data->tmu_read = exynos4412_tmu_read;
   944			data->tmu_set_emulation = exynos4412_tmu_set_emulation;
   945			data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
   946			data->ntrip = 8;
   947			data->gain = 8;
   948			if (res.start == EXYNOS5433_G3D_BASE)
   949				data->reference_voltage = 23;
   950			else
   951				data->reference_voltage = 16;
   952			data->efuse_value = 75;
   953			data->min_efuse_value = 40;
   954			data->max_efuse_value = 150;
   955			break;
   956		case SOC_ARCH_EXYNOS7:
   957			data->tmu_set_trip_temp = exynos7_tmu_set_trip_temp;
   958			data->tmu_set_trip_hyst = exynos7_tmu_set_trip_hyst;
   959			data->tmu_initialize = exynos7_tmu_initialize;
   960			data->tmu_control = exynos7_tmu_control;
   961			data->tmu_read = exynos7_tmu_read;
   962			data->tmu_set_emulation = exynos4412_tmu_set_emulation;
   963			data->tmu_clear_irqs = exynos4210_tmu_clear_irqs;
   964			data->ntrip = 8;
   965			data->gain = 9;
   966			data->reference_voltage = 17;
   967			data->efuse_value = 75;
   968			data->min_efuse_value = 15;
   969			data->max_efuse_value = 100;
   970			break;
   971		default:
   972			dev_err(&pdev->dev, "Platform not supported\n");
   973			return -EINVAL;
   974		}
   975	
   976		data->cal_type = TYPE_ONE_POINT_TRIMMING;
   977	
   978		/*
   979		 * Check if the TMU shares some registers and then try to map the
   980		 * memory of common registers.
   981		 */
   982		if (data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO)
   983			return 0;
   984	
   985		if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
   986			dev_err(&pdev->dev, "failed to get Resource 1\n");
   987			return -ENODEV;
   988		}
   989	
   990		data->base_second = devm_ioremap(&pdev->dev, res.start,
   991						resource_size(&res));
   992		if (!data->base_second) {
   993			dev_err(&pdev->dev, "Failed to ioremap memory\n");
   994			return -ENOMEM;
   995		}
   996	
   997		return 0;
   998	}
   999
Krzysztof Kozlowski May 16, 2022, 10:44 a.m. UTC | #3
On 16/05/2022 12:42, kernel test robot wrote:
> Hi Anand,
> 
> Thank you for the patch! Perhaps something to improve:
> 
> [auto build test WARNING on ec7f49619d8ee13e108740c82f942cd401b989e9]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
> base:   ec7f49619d8ee13e108740c82f942cd401b989e9
> config: hexagon-randconfig-r033-20220516 (https://download.01.org/0day-ci/archive/20220516/202205161820.8rHIcsvI-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://github.com/intel-lab-lkp/linux/commit/eb50b0c2100fabd6d09b87abd11f52c5295512e8
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
>         git checkout eb50b0c2100fabd6d09b87abd11f52c5295512e8
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/thermal/samsung/
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/thermal/samsung/exynos_tmu.c:929:40: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
>                    if (data->soc == SOC_ARCH_EXYNOS5420 &&
>                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
>    1 warning generated.

Ah, I did not notice it and it seems code was not compile-tested with W=1.

Anand, please be sure you compile your code with W=1...


Best regards,
Krzysztof
Anand Moon May 17, 2022, 6:44 p.m. UTC | #4
Hi Krzysztof,

On Mon, 16 May 2022 at 16:14, Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 16/05/2022 12:42, kernel test robot wrote:
> > Hi Anand,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on ec7f49619d8ee13e108740c82f942cd401b989e9]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
> > base:   ec7f49619d8ee13e108740c82f942cd401b989e9
> > config: hexagon-randconfig-r033-20220516 (https://download.01.org/0day-ci/archive/20220516/202205161820.8rHIcsvI-lkp@intel.com/config)
> > compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
> > reproduce (this is a W=1 build):
> >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # https://github.com/intel-lab-lkp/linux/commit/eb50b0c2100fabd6d09b87abd11f52c5295512e8
> >         git remote add linux-review https://github.com/intel-lab-lkp/linux
> >         git fetch --no-tags linux-review Anand-Moon/Exynos-Thermal-code-inprovement/20220515-144336
> >         git checkout eb50b0c2100fabd6d09b87abd11f52c5295512e8
> >         # save the config file
> >         mkdir build_dir && cp config build_dir/.config
> >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/thermal/samsung/
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> >>> drivers/thermal/samsung/exynos_tmu.c:929:40: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
> >                    if (data->soc == SOC_ARCH_EXYNOS5420 &&
> >                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
> >    1 warning generated.
>
> Ah, I did not notice it and it seems code was not compile-tested with W=1.
>
> Anand, please be sure you compile your code with W=1...
>
Ok I will try to resolve this warning in the next version.
>
> Best regards,
> Krzysztof

Thanks & Regards

-Anand
diff mbox series

Patch

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 58ff1b577c47..0faec0f16db6 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -926,12 +926,14 @@  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)
+		if (data->soc == SOC_ARCH_EXYNOS5420 &&
+		    data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) {
+			data->min_efuse_value = 16;
+			data->max_efuse_value = 76;
+		} else {
 			data->min_efuse_value = 40;
-		else
-			data->min_efuse_value = 0;
-		data->max_efuse_value = 100;
+			data->max_efuse_value = 100;
+		}
 		break;
 	case SOC_ARCH_EXYNOS5433:
 		data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp;