From: Soomin Kim Date: Sat, 23 Jul 2016 07:25:02 +0000 (+0900) Subject: [8895] thermal: samsung: Add thermal emulation function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d40807b9d023f592ade08e2ca965a9d4c0bbf781;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [8895] thermal: samsung: Add thermal emulation function Add thermal emulation function for Exynos8895. Change-Id: I27ffeb491593709e331799a5eca0c7c75e6b5d8b Signed-off-by: Soomin Kim --- diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 4d255343d4c4..75de75f25217 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -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;