From f6120732836b6b1b2dd01039e3f6e1f97a82a0d4 Mon Sep 17 00:00:00 2001 From: Soomin Kim Date: Thu, 28 Jul 2016 15:33:05 +0900 Subject: [PATCH] [8895] thermal: samsung: Change AVG_CON setting If thermal sensor is TEM1002X, AVG_CON register is used. If 2X, 4X mode is used, EN_DEM bit sholud be set to 1. In case of the other mode, this bit isn't set. This setting is only needed for TEM1002X. Other sensors like TEM1455X, TEM1456X isn't needed. Change-Id: I5fe47bdb4f67474c594770214a3dca3a830cf3f6 Signed-off-by: Soomin Kim --- drivers/thermal/samsung/exynos_tmu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1f83df6ae62c..576a299595fd 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -603,10 +603,13 @@ static void exynos8895_tmu_control(struct platform_device *pdev, bool on) con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); avg_con = readl(data->base + EXYNOS_TMU_REG_AVG_CON); - if(avg_sel) + if (avg_sel) { avg_con |= ((avg_con & EXYNOS_TMU_AVG_MODE_MASK) | EXYNOS_TMU_AVG_MODE_DEFAULT); - else + avg_con &= ~(EXYNOS_TMU_DEM_ENABLE << EXYNOS_TMU_DEM_SHIFT); + } else { avg_con |= ((avg_con & EXYNOS_TMU_AVG_MODE_MASK) | EXYNOS_TMU_AVG_MODE_4); + avg_con |= EXYNOS_TMU_DEM_ENABLE << EXYNOS_TMU_DEM_SHIFT; + } /* Set MUX_ADDR SFR according to sensor_type */ switch (data->pdata->sensor_type) { @@ -663,7 +666,11 @@ static void exynos8895_tmu_control(struct platform_device *pdev, bool on) } } writel(con, data->base + EXYNOS_TMU_REG_CONTROL); - writel(avg_con, data->base + EXYNOS_TMU_REG_AVG_CON); + + /* Only TEM1002X sensor needs AVG_CON setting */ + if (data->pdata->sensor_type == TEM1002X) + writel(avg_con, data->base + EXYNOS_TMU_REG_AVG_CON); + } static int exynos_get_temp(void *p, int *temp) { -- 2.20.1