[COMMON] thermal: samsung: Change temp. translation function
authorSoomin Kim <sm8326.kim@samsung.com>
Mon, 1 Aug 2016 07:53:52 +0000 (16:53 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:17 +0000 (17:13 +0900)
code_to_temp_with_index() is changed to code_to_temp_with_sensorinfo()
to sync with temp_to_code_with_sensorinfo() function.

Change-Id: I86475785162a5092b69a03addc13cef69ee496f6
Signed-off-by: Soomin Kim <sm8326.kim@samsung.com>
drivers/thermal/samsung/exynos_tmu.c

index c42a3f9a2f4b45acd026e012c6cd27a32836da2b..29ef5486405a9efdc78d1cff3f228fc6a3c40c42 100644 (file)
@@ -241,20 +241,20 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code)
  * Calculate a temperature value with the index from a temperature code.
  * The unit of the temperature is degree Celsius.
  */
-static int code_to_temp_with_index(struct exynos_tmu_data *data, u16 temp_code, u8 index)
+static int code_to_temp_with_sensorinfo(struct exynos_tmu_data *data, u16 temp_code, struct sensor_info *info)
 {
        struct exynos_tmu_platform_data *pdata = data->pdata;
        int temp;
 
-       switch (data->sensor_info[index].cal_type) {
+       switch (info->cal_type) {
        case TYPE_TWO_POINT_TRIMMING:
-               temp = (temp_code - data->sensor_info[index].temp_error1) *
+               temp = (temp_code - info->temp_error1) *
                        (pdata->second_point_trim - pdata->first_point_trim) /
-                       (data->sensor_info[index].temp_error2 - data->sensor_info[index].temp_error1) +
+                       (info->temp_error2 - info->temp_error1) +
                        pdata->first_point_trim;
                break;
        case TYPE_ONE_POINT_TRIMMING:
-               temp = temp_code - data->sensor_info[index].temp_error1 + pdata->first_point_trim;
+               temp = temp_code - info->temp_error1 + pdata->first_point_trim;
                break;
        default:
                temp = temp_code - pdata->default_temp_offset;
@@ -829,7 +829,7 @@ static int exynos8895_tmu_read(struct exynos_tmu_data *data)
 
                temp_code = (readl(data->base + EXYNOS_TMU_REG_CURRENT_TEMP1_0 + reg_offset)
                                >> bit_offset) & EXYNOS_TMU_TEMP_MASK;
-               temp_cel = code_to_temp_with_index(data, temp_code, i);
+               temp_cel = code_to_temp_with_sensorinfo(data, temp_code, &data->sensor_info[i]);
 
                switch (data->sensing_mode) {
                        case AVG : result = result + temp_cel;