diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-09-02 23:09:02 -0400 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-11-02 22:02:48 -0500 |
commit | 56c64da7aa31c7e0422ec54e5d0ed60a98f28712 (patch) | |
tree | 3fe7e394a6cc7e9832a7933da1ab60ddf632b033 | |
parent | 60e203ecb1faf62efe369ca2bc22630bcda88bdc (diff) |
thermal: exynos: Add support for many TRIMINFO_CTRL registers
This patch support many TRIMINFO_CTRL registers if specific Exynos SoC
has one more TRIMINFO_CTRL registers. Also this patch uses proper 'RELOAD'
shift/mask bit operation to set RELOAD feature instead of static value.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Reviewed-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r-- | drivers/thermal/samsung/exynos_thermal_common.h | 1 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 15 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.h | 7 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.c | 4 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.h | 1 |
5 files changed, 22 insertions, 6 deletions
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h b/drivers/thermal/samsung/exynos_thermal_common.h index cd4471925cdd..158f5aa8dc5d 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.h +++ b/drivers/thermal/samsung/exynos_thermal_common.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define SENSOR_NAME_LEN 16 | 27 | #define SENSOR_NAME_LEN 16 |
28 | #define MAX_TRIP_COUNT 8 | 28 | #define MAX_TRIP_COUNT 8 |
29 | #define MAX_COOLING_DEVICE 4 | 29 | #define MAX_COOLING_DEVICE 4 |
30 | #define MAX_TRIMINFO_CTRL_REG 2 | ||
30 | 31 | ||
31 | #define ACTIVE_INTERVAL 500 | 32 | #define ACTIVE_INTERVAL 500 |
32 | #define IDLE_INTERVAL 10000 | 33 | #define IDLE_INTERVAL 10000 |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 35437dffaecc..092ab69d6282 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -127,7 +127,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
127 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); | 127 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
128 | struct exynos_tmu_platform_data *pdata = data->pdata; | 128 | struct exynos_tmu_platform_data *pdata = data->pdata; |
129 | const struct exynos_tmu_registers *reg = pdata->registers; | 129 | const struct exynos_tmu_registers *reg = pdata->registers; |
130 | unsigned int status, trim_info = 0, con; | 130 | unsigned int status, trim_info = 0, con, ctrl; |
131 | unsigned int rising_threshold = 0, falling_threshold = 0; | 131 | unsigned int rising_threshold = 0, falling_threshold = 0; |
132 | int ret = 0, threshold_code, i; | 132 | int ret = 0, threshold_code, i; |
133 | 133 | ||
@@ -144,8 +144,17 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) | 147 | if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) { |
148 | __raw_writel(1, data->base + reg->triminfo_ctrl); | 148 | for (i = 0; i < reg->triminfo_ctrl_count; i++) { |
149 | if (pdata->triminfo_reload[i]) { | ||
150 | ctrl = readl(data->base + | ||
151 | reg->triminfo_ctrl[i]); | ||
152 | ctrl |= pdata->triminfo_reload[i]; | ||
153 | writel(ctrl, data->base + | ||
154 | reg->triminfo_ctrl[i]); | ||
155 | } | ||
156 | } | ||
157 | } | ||
149 | 158 | ||
150 | /* Save trimming info in order to perform calibration */ | 159 | /* Save trimming info in order to perform calibration */ |
151 | if (data->soc == SOC_ARCH_EXYNOS5440) { | 160 | if (data->soc == SOC_ARCH_EXYNOS5440) { |
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index d503f35e3cd9..f67203bfd83c 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h | |||
@@ -78,6 +78,7 @@ enum soc_type { | |||
78 | * slightly across different exynos SOC's. | 78 | * slightly across different exynos SOC's. |
79 | * @triminfo_data: register containing 2 pont trimming data | 79 | * @triminfo_data: register containing 2 pont trimming data |
80 | * @triminfo_ctrl: trim info controller register. | 80 | * @triminfo_ctrl: trim info controller register. |
81 | * @triminfo_ctrl_count: the number of trim info controller register. | ||
81 | * @tmu_ctrl: TMU main controller register. | 82 | * @tmu_ctrl: TMU main controller register. |
82 | * @test_mux_addr_shift: shift bits of test mux address. | 83 | * @test_mux_addr_shift: shift bits of test mux address. |
83 | * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register. | 84 | * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register. |
@@ -112,8 +113,8 @@ enum soc_type { | |||
112 | struct exynos_tmu_registers { | 113 | struct exynos_tmu_registers { |
113 | u32 triminfo_data; | 114 | u32 triminfo_data; |
114 | 115 | ||
115 | u32 triminfo_ctrl; | 116 | u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG]; |
116 | u32 triminfo_ctrl1; | 117 | u32 triminfo_ctrl_count; |
117 | 118 | ||
118 | u32 tmu_ctrl; | 119 | u32 tmu_ctrl; |
119 | u32 test_mux_addr_shift; | 120 | u32 test_mux_addr_shift; |
@@ -200,6 +201,7 @@ struct exynos_tmu_registers { | |||
200 | * @second_point_trim: temp value of the second point trimming | 201 | * @second_point_trim: temp value of the second point trimming |
201 | * @default_temp_offset: default temperature offset in case of no trimming | 202 | * @default_temp_offset: default temperature offset in case of no trimming |
202 | * @test_mux; information if SoC supports test MUX | 203 | * @test_mux; information if SoC supports test MUX |
204 | * @triminfo_reload: reload value to read TRIMINFO register | ||
203 | * @cal_type: calibration type for temperature | 205 | * @cal_type: calibration type for temperature |
204 | * @freq_clip_table: Table representing frequency reduction percentage. | 206 | * @freq_clip_table: Table representing frequency reduction percentage. |
205 | * @freq_tab_count: Count of the above table as frequency reduction may | 207 | * @freq_tab_count: Count of the above table as frequency reduction may |
@@ -230,6 +232,7 @@ struct exynos_tmu_platform_data { | |||
230 | u8 second_point_trim; | 232 | u8 second_point_trim; |
231 | u8 default_temp_offset; | 233 | u8 default_temp_offset; |
232 | u8 test_mux; | 234 | u8 test_mux; |
235 | u8 triminfo_reload[MAX_TRIMINFO_CTRL_REG]; | ||
233 | 236 | ||
234 | enum calibration_type cal_type; | 237 | enum calibration_type cal_type; |
235 | enum soc_type type; | 238 | enum soc_type type; |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 177ada5846cd..362a1e148551 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
@@ -169,7 +169,8 @@ struct exynos_tmu_init_data const exynos3250_default_tmu_data = { | |||
169 | #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250) | 169 | #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250) |
170 | static const struct exynos_tmu_registers exynos4412_tmu_registers = { | 170 | static const struct exynos_tmu_registers exynos4412_tmu_registers = { |
171 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 171 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
172 | .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON, | 172 | .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON, |
173 | .triminfo_ctrl_count = 1, | ||
173 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 174 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
174 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, | 175 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, |
175 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 176 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
@@ -231,6 +232,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
231 | .temp_level = 95, \ | 232 | .temp_level = 95, \ |
232 | }, \ | 233 | }, \ |
233 | .freq_tab_count = 2, \ | 234 | .freq_tab_count = 2, \ |
235 | .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \ | ||
234 | .registers = &exynos4412_tmu_registers, \ | 236 | .registers = &exynos4412_tmu_registers, \ |
235 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | 237 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ |
236 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 238 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index ac03b76c51cc..6b47a174c8fa 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
@@ -51,6 +51,7 @@ | |||
51 | #define EXYNOS_THD_TEMP_FALL 0x54 | 51 | #define EXYNOS_THD_TEMP_FALL 0x54 |
52 | #define EXYNOS_EMUL_CON 0x80 | 52 | #define EXYNOS_EMUL_CON 0x80 |
53 | 53 | ||
54 | #define EXYNOS_TRIMINFO_RELOAD_ENABLE 1 | ||
54 | #define EXYNOS_TRIMINFO_25_SHIFT 0 | 55 | #define EXYNOS_TRIMINFO_25_SHIFT 0 |
55 | #define EXYNOS_TRIMINFO_85_SHIFT 8 | 56 | #define EXYNOS_TRIMINFO_85_SHIFT 8 |
56 | #define EXYNOS_TMU_RISE_INT_MASK 0x111 | 57 | #define EXYNOS_TMU_RISE_INT_MASK 0x111 |