Lines Matching +full:tmu +full:- +full:range

6  * EXYNOS - Thermal Management Unit
17 * MA 02111-1307 USA
23 #include <tmu.h>
24 #include <asm/arch/tmu.h>
52 /* minimum value in temperature code range */
54 /* maximum value in temperature code range */
64 /* Pre-defined values and thresholds for calibration of current temperature */
66 /* pre-defined temperature thresholds */
68 /* pre-defined efuse range minimum value */
70 /* pre-defined efuse value for temperature calibration */
72 /* pre-defined efuse range maximum value */
78 /* TMU device specific details and status */
80 /* base Address for the TMU */
82 /* mux Address for the TMU */
84 /* pre-defined values for calibration and thresholds */
92 /* enum value indicating status of the TMU */
104 * @return current temperature of the chip as sensed by TMU
108 struct exynos5_tmu_reg *reg = info->tmu_base; in get_cur_temp()
113 * Temperature code range between min 25 and max 125. in get_cur_temp()
117 if (info->tmu_state == TMU_STATUS_NORMAL) { in get_cur_temp()
120 cur_temp = readl(&reg->current_temp) & 0xff; in get_cur_temp()
128 cur_temp = cur_temp - info->te1 + info->dc_value; in get_cur_temp()
134 * Monitors status of the TMU device and exynos temperature
156 if ((cur_temp >= data->ts.start_tripping) && in tmu_monitor()
157 (cur_temp <= data->ts.max_val)) in tmu_monitor()
160 if (cur_temp >= data->ts.start_warning) in tmu_monitor()
163 if ((cur_temp < data->ts.start_warning) && in tmu_monitor()
164 (cur_temp >= data->ts.min_val)) in tmu_monitor()
175 * Get TMU specific pre-defined values from FDT
188 /* Get the node from FDT for TMU */ in get_tmu_fdt_values()
192 debug("EXYNOS_TMU: No node for tmu in device tree\n"); in get_tmu_fdt_values()
193 return -ENODEV; in get_tmu_fdt_values()
197 * Get the pre-defined TMU specific values from FDT. in get_tmu_fdt_values()
204 debug("%s: Missing tmu-base\n", __func__); in get_tmu_fdt_values()
205 return -ENODEV; in get_tmu_fdt_values()
207 info->tmu_base = (struct exynos5_tmu_reg *)addr; in get_tmu_fdt_values()
210 info->tmu_mux = fdtdec_get_int(blob, in get_tmu_fdt_values()
211 node, "samsung,mux", -1); in get_tmu_fdt_values()
213 if (info->tmu_mux == -1) in get_tmu_fdt_values()
214 info->tmu_mux = 0x6; in get_tmu_fdt_values()
216 info->data.ts.min_val = fdtdec_get_int(blob, in get_tmu_fdt_values()
217 node, "samsung,min-temp", -1); in get_tmu_fdt_values()
218 error |= (info->data.ts.min_val == -1); in get_tmu_fdt_values()
219 info->data.ts.max_val = fdtdec_get_int(blob, in get_tmu_fdt_values()
220 node, "samsung,max-temp", -1); in get_tmu_fdt_values()
221 error |= (info->data.ts.max_val == -1); in get_tmu_fdt_values()
222 info->data.ts.start_warning = fdtdec_get_int(blob, in get_tmu_fdt_values()
223 node, "samsung,start-warning", -1); in get_tmu_fdt_values()
224 error |= (info->data.ts.start_warning == -1); in get_tmu_fdt_values()
225 info->data.ts.start_tripping = fdtdec_get_int(blob, in get_tmu_fdt_values()
226 node, "samsung,start-tripping", -1); in get_tmu_fdt_values()
227 error |= (info->data.ts.start_tripping == -1); in get_tmu_fdt_values()
228 info->data.ts.hardware_tripping = fdtdec_get_int(blob, in get_tmu_fdt_values()
229 node, "samsung,hw-tripping", -1); in get_tmu_fdt_values()
230 error |= (info->data.ts.hardware_tripping == -1); in get_tmu_fdt_values()
231 info->data.efuse_min_value = fdtdec_get_int(blob, in get_tmu_fdt_values()
232 node, "samsung,efuse-min-value", -1); in get_tmu_fdt_values()
233 error |= (info->data.efuse_min_value == -1); in get_tmu_fdt_values()
234 info->data.efuse_value = fdtdec_get_int(blob, in get_tmu_fdt_values()
235 node, "samsung,efuse-value", -1); in get_tmu_fdt_values()
236 error |= (info->data.efuse_value == -1); in get_tmu_fdt_values()
237 info->data.efuse_max_value = fdtdec_get_int(blob, in get_tmu_fdt_values()
238 node, "samsung,efuse-max-value", -1); in get_tmu_fdt_values()
239 error |= (info->data.efuse_max_value == -1); in get_tmu_fdt_values()
240 info->data.slope = fdtdec_get_int(blob, in get_tmu_fdt_values()
241 node, "samsung,slope", -1); in get_tmu_fdt_values()
242 error |= (info->data.slope == -1); in get_tmu_fdt_values()
243 info->dc_value = fdtdec_get_int(blob, in get_tmu_fdt_values()
244 node, "samsung,dc-value", -1); in get_tmu_fdt_values()
245 error |= (info->dc_value == -1); in get_tmu_fdt_values()
248 debug("fail to get tmu node properties\n"); in get_tmu_fdt_values()
249 return -EINVAL; in get_tmu_fdt_values()
253 return -ENODEV; in get_tmu_fdt_values()
271 struct tmu_data *data = &info->data; in tmu_setup_parameters()
272 struct exynos5_tmu_reg *reg = info->tmu_base; in tmu_setup_parameters()
275 writel(TRIMINFO_RELOAD, &reg->triminfo_control); in tmu_setup_parameters()
278 te_code = readl(&reg->triminfo); in tmu_setup_parameters()
279 info->te1 = te_code & TRIM_INFO_MASK; in tmu_setup_parameters()
280 info->te2 = ((te_code >> 8) & TRIM_INFO_MASK); in tmu_setup_parameters()
282 if ((data->efuse_min_value > info->te1) || in tmu_setup_parameters()
283 (info->te1 > data->efuse_max_value) in tmu_setup_parameters()
284 || (info->te2 != 0)) in tmu_setup_parameters()
285 info->te1 = data->efuse_value; in tmu_setup_parameters()
288 warning_code = data->ts.start_warning in tmu_setup_parameters()
289 + info->te1 - info->dc_value; in tmu_setup_parameters()
290 trip_code = data->ts.start_tripping in tmu_setup_parameters()
291 + info->te1 - info->dc_value; in tmu_setup_parameters()
292 hwtrip_code = data->ts.hardware_tripping in tmu_setup_parameters()
293 + info->te1 - info->dc_value; in tmu_setup_parameters()
302 writel(rising_value, &reg->threshold_temp_rise); in tmu_setup_parameters()
303 writel(cooling_temp, &reg->threshold_temp_fall); in tmu_setup_parameters()
306 * Init TMU control tuning parameters in tmu_setup_parameters()
307 * [28:24] VREF - Voltage reference in tmu_setup_parameters()
308 * [15:13] THERM_TRIP_MODE - Tripping mode in tmu_setup_parameters()
309 * [12] THERM_TRIP_EN - Thermal tripping enable in tmu_setup_parameters()
310 * [11:8] BUF_SLOPE_SEL - Gain of amplifier in tmu_setup_parameters()
311 * [6] THERM_TRIP_BY_TQ_EN - Tripping by TQ pin in tmu_setup_parameters()
313 writel(data->slope, &reg->tmu_control); in tmu_setup_parameters()
315 writel(INTCLEARALL, &reg->intclear); in tmu_setup_parameters()
317 /* TMU core enable */ in tmu_setup_parameters()
318 con = readl(&reg->tmu_control); in tmu_setup_parameters()
319 con |= THERM_TRIP_EN | CORE_EN | (info->tmu_mux << 20); in tmu_setup_parameters()
321 writel(con, &reg->tmu_control); in tmu_setup_parameters()
327 writel(INTEN_RISE1 | INTEN_RISE2, &reg->inten); in tmu_setup_parameters()
331 * Initialize TMU device