[8895] thermal: samsung: Fix point calibration type
authorHyeonseong Gil <hs.gil@samsung.com>
Sat, 5 Nov 2016 13:30:37 +0000 (22:30 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:29 +0000 (17:13 +0900)
Change-Id: I6d15e999b7b8df5d48a274da6928b5195a2519f1
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/thermal/samsung/exynos_tmu.c

index 82f123ecd9bf74ec6aa57ce77fb35cd66a36b9b6..655aadb8b5872e13129d095c63d73b4c3ac9705f 100644 (file)
@@ -483,10 +483,12 @@ static int exynos8895_tmu_initialize(struct platform_device *pdev)
        u32 temp_error1;
        u32 temp_error2;
 
+       trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
+       cal_type = (trim_info >> EXYNOS_TMU_CALIB_SEL_SHIFT) & EXYNOS_TMU_CALIB_SEL_MASK;
+
        for (sensor = 0; sensor < TOTAL_SENSORS; sensor++) {
                /* Read the sensor error value from TRIMINFOX */
                trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO + 0x4 * sensor);
-               cal_type = (trim_info >> EXYNOS_TMU_CALIB_SEL_SHIFT) & EXYNOS_TMU_CALIB_SEL_MASK;
                temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
                temp_error2 = (trim_info >> EXYNOS_TMU_TRIMINFO_85_P0_SHIFT) & EXYNOS_TMU_TEMP_MASK;
 
@@ -505,7 +507,7 @@ static int exynos8895_tmu_initialize(struct platform_device *pdev)
                                data->sensor_info[count].temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK;
 
                        /* Check temp_error2 if calibration type is TYPE_TWO_POINT_TRIMMING */
-                       if(pdata->cal_type == TYPE_TWO_POINT_TRIMMING) {
+                       if (data->sensor_info[count].cal_type == TYPE_TWO_POINT_TRIMMING) {
                                data->sensor_info[count].temp_error2 = temp_error2;
 
                                if (!data->sensor_info[count].temp_error2)