From 4a0560f413863cc913787b67532356ccdb74083a Mon Sep 17 00:00:00 2001 From: Hyeonseong Gil Date: Wed, 3 Aug 2016 11:07:59 +0900 Subject: [PATCH] [COMMON] thermal: samsung: Set NUM_PROBE value After suspend and resume, NUM_PROBE value was initialized. So, save the set value from bootloader at probe time and write it to TMU_CONTROL1 SFR. Change-Id: I102d8dbc75168540a06ca27c137fcd2bd0e2b7ba Signed-off-by: Hyeonseong Gil --- drivers/thermal/samsung/exynos_tmu.c | 14 +++++++++++++- drivers/thermal/samsung/exynos_tmu.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 99df78a2fbc8..5d2db17ecf15 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -54,6 +54,7 @@ #define EXYNOS_TMU_REG_TRIMINFO1 0x4 #define EXYNOS_TMU_REG_TRIMINFO2 0x8 #define EXYNOS_TMU_REG_CONTROL 0x20 +#define EXYNOS_TMU_REG_CONTROL1 0x24 #define EXYNOS_TMU_REG_STATUS 0x28 #define EXYNOS_TMU_REG_CURRENT_TEMP1_0 0x40 #define EXYNOS_TMU_REG_CURRENT_TEMP4_2 0x44 @@ -135,6 +136,9 @@ #define EXYNOS_TMU_CLK_SENSE_ON_MASK (0xffff) #define EXYNOS_TMU_TEM1456X_SENSE_VALUE (0x0A28) +#define EXYNOS_TMU_NUM_PROBE_SHIFT (16) +#define EXYNOS_TMU_NUM_PROBE_MASK (0x7) + #define TOTAL_SENSORS 8 static bool suspended; @@ -587,7 +591,7 @@ static void exynos8895_tmu_control(struct platform_device *pdev, bool on) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct thermal_zone_device *tz = data->tzd; - unsigned int con, interrupt_en, trim_info, trim_info1, trim_info2; + unsigned int con, con1, interrupt_en, trim_info, trim_info1, trim_info2; unsigned int t_buf_vref_sel, t_buf_slope_sel; int i; u32 avg_con, avg_sel; @@ -600,6 +604,11 @@ static void exynos8895_tmu_control(struct platform_device *pdev, bool on) writel(con, data->base + EXYNOS_TMU_REG_CONTROL); con = 0; + con1 = readl(data->base + EXYNOS_TMU_REG_CONTROL1); + con1 &= ~(EXYNOS_TMU_NUM_PROBE_MASK << EXYNOS_TMU_NUM_PROBE_SHIFT); + con1 |= (data->num_probe << EXYNOS_TMU_NUM_PROBE_SHIFT); + writel(con1, data->base + EXYNOS_TMU_REG_CONTROL1); + trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); trim_info1 = readl(data->base + EXYNOS_TMU_REG_TRIMINFO1); trim_info2 = readl(data->base + EXYNOS_TMU_REG_TRIMINFO2); @@ -1486,6 +1495,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sensor; } + data->num_probe = (readl(data->base + EXYNOS_TMU_REG_CONTROL1) >> EXYNOS_TMU_NUM_PROBE_SHIFT) + & EXYNOS_TMU_NUM_PROBE_MASK; + ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index 50c587209efc..e92ed25063d3 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h @@ -120,6 +120,7 @@ struct sensor_info { * @lock: lock to implement synchronization. * @temp_error1: fused value of the first point trim. * @temp_error2: fused value of the second point trim. + * @num_probe: number of probe for TMU_CONTROL1 SFR setting. * @regulator: pointer to the TMU regulator structure. * @reg_conf: pointer to structure to register with core thermal. * @ntrip: number of supported trip points. @@ -147,6 +148,7 @@ struct exynos_tmu_data { struct thermal_cooling_device *cool_dev; struct list_head node; u32 sensors; + int num_probe; int num_of_sensors; struct sensor_info *sensor_info; int sensing_mode; -- 2.20.1