[8895] thermal: samsung: Add thermal emulation function
authorSoomin Kim <sm8326.kim@samsung.com>
Sat, 23 Jul 2016 07:25:02 +0000 (16:25 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:08 +0000 (17:13 +0900)
Add thermal emulation function for Exynos8895.

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

index 4d255343d4c4cb458290f0f1bd630fe2ab53c33b..75de75f25217b340cbea1f90c43877e186b7c0fa 100644 (file)
@@ -786,6 +786,28 @@ static void exynos8890_tmu_set_emulation(struct exynos_tmu_data *data,
        writel(val, data->base + emul_con);
 }
 
+static void exynos8895_tmu_set_emulation(struct exynos_tmu_data *data,
+                                        int temp)
+{
+       unsigned int val;
+       u32 emul_con;
+
+       emul_con = EXYNOS_TMU_REG_EMUL_CON;
+
+       val = readl(data->base + emul_con);
+
+       if (temp) {
+               temp /= MCELSIUS;
+               val &= ~(EXYNOS_EMUL_DATA_MASK << EXYNOS_EMUL_DATA_SHIFT);
+               val |= (temp_to_code_with_index(data, temp, 0) << EXYNOS_EMUL_DATA_SHIFT)
+                       | EXYNOS_EMUL_ENABLE;
+       } else {
+               val &= ~EXYNOS_EMUL_ENABLE;
+       }
+
+       writel(val, data->base + emul_con);
+}
+
 static int exynos_tmu_set_emulation(void *drv_data, int temp)
 {
        struct exynos_tmu_data *data = drv_data;
@@ -803,6 +825,7 @@ out:
 }
 #else
 #define exynos8890_tmu_set_emulation NULL
+#define exynos8895_tmu_set_emulation NULL
 static int exynos_tmu_set_emulation(void *drv_data, int temp)
        { return -EINVAL; }
 #endif /* CONFIG_THERMAL_EMULATION */
@@ -1084,7 +1107,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
                data->tmu_initialize = exynos8895_tmu_initialize;
                data->tmu_control = exynos8895_tmu_control;
                data->tmu_read = exynos8895_tmu_read;
-               data->tmu_set_emulation = exynos8890_tmu_set_emulation;
+               data->tmu_set_emulation = exynos8895_tmu_set_emulation;
                data->tmu_clear_irqs = exynos8895_tmu_clear_irqs;
                break;