1eaf7b460SMauro Carvalho Chehab========================
2eaf7b460SMauro Carvalho ChehabKernel driver exynos_tmu
3eaf7b460SMauro Carvalho Chehab========================
4eaf7b460SMauro Carvalho Chehab
5eaf7b460SMauro Carvalho ChehabSupported chips:
6eaf7b460SMauro Carvalho Chehab
7ca07ee4eSKrzysztof Kozlowski* ARM Samsung Exynos4, Exynos5 series of SoC
8eaf7b460SMauro Carvalho Chehab
9eaf7b460SMauro Carvalho Chehab  Datasheet: Not publicly available
10eaf7b460SMauro Carvalho Chehab
11eaf7b460SMauro Carvalho ChehabAuthors: Donggeun Kim <dg77.kim@samsung.com>
12eaf7b460SMauro Carvalho ChehabAuthors: Amit Daniel <amit.daniel@samsung.com>
13eaf7b460SMauro Carvalho Chehab
14eaf7b460SMauro Carvalho ChehabTMU controller Description:
15eaf7b460SMauro Carvalho Chehab---------------------------
16eaf7b460SMauro Carvalho Chehab
17ca07ee4eSKrzysztof KozlowskiThis driver allows to read temperature inside Samsung Exynos4/5 series of SoC.
18eaf7b460SMauro Carvalho Chehab
19eaf7b460SMauro Carvalho ChehabThe chip only exposes the measured 8-bit temperature code value
20eaf7b460SMauro Carvalho Chehabthrough a register.
21eaf7b460SMauro Carvalho ChehabTemperature can be taken from the temperature code.
22eaf7b460SMauro Carvalho ChehabThere are three equations converting from temperature to temperature code.
23eaf7b460SMauro Carvalho Chehab
24eaf7b460SMauro Carvalho ChehabThe three equations are:
25eaf7b460SMauro Carvalho Chehab  1. Two point trimming::
26eaf7b460SMauro Carvalho Chehab
27eaf7b460SMauro Carvalho Chehab	Tc = (T - 25) * (TI2 - TI1) / (85 - 25) + TI1
28eaf7b460SMauro Carvalho Chehab
29eaf7b460SMauro Carvalho Chehab  2. One point trimming::
30eaf7b460SMauro Carvalho Chehab
31eaf7b460SMauro Carvalho Chehab	Tc = T + TI1 - 25
32eaf7b460SMauro Carvalho Chehab
33eaf7b460SMauro Carvalho Chehab  3. No trimming::
34eaf7b460SMauro Carvalho Chehab
35eaf7b460SMauro Carvalho Chehab	Tc = T + 50
36eaf7b460SMauro Carvalho Chehab
37eaf7b460SMauro Carvalho Chehab  Tc:
38eaf7b460SMauro Carvalho Chehab       Temperature code, T: Temperature,
39eaf7b460SMauro Carvalho Chehab  TI1:
40eaf7b460SMauro Carvalho Chehab       Trimming info for 25 degree Celsius (stored at TRIMINFO register)
41eaf7b460SMauro Carvalho Chehab       Temperature code measured at 25 degree Celsius which is unchanged
42eaf7b460SMauro Carvalho Chehab  TI2:
43eaf7b460SMauro Carvalho Chehab       Trimming info for 85 degree Celsius (stored at TRIMINFO register)
44eaf7b460SMauro Carvalho Chehab       Temperature code measured at 85 degree Celsius which is unchanged
45eaf7b460SMauro Carvalho Chehab
46ca07ee4eSKrzysztof KozlowskiTMU(Thermal Management Unit) in Exynos4/5 generates interrupt
47eaf7b460SMauro Carvalho Chehabwhen temperature exceeds pre-defined levels.
48eaf7b460SMauro Carvalho ChehabThe maximum number of configurable threshold is five.
49eaf7b460SMauro Carvalho ChehabThe threshold levels are defined as follows::
50eaf7b460SMauro Carvalho Chehab
51eaf7b460SMauro Carvalho Chehab  Level_0: current temperature > trigger_level_0 + threshold
52eaf7b460SMauro Carvalho Chehab  Level_1: current temperature > trigger_level_1 + threshold
53eaf7b460SMauro Carvalho Chehab  Level_2: current temperature > trigger_level_2 + threshold
54eaf7b460SMauro Carvalho Chehab  Level_3: current temperature > trigger_level_3 + threshold
55eaf7b460SMauro Carvalho Chehab
56eaf7b460SMauro Carvalho ChehabThe threshold and each trigger_level are set
57eaf7b460SMauro Carvalho Chehabthrough the corresponding registers.
58eaf7b460SMauro Carvalho Chehab
59eaf7b460SMauro Carvalho ChehabWhen an interrupt occurs, this driver notify kernel thermal framework
60eaf7b460SMauro Carvalho Chehabwith the function exynos_report_trigger.
61eaf7b460SMauro Carvalho ChehabAlthough an interrupt condition for level_0 can be set,
62eaf7b460SMauro Carvalho Chehabit can be used to synchronize the cooling action.
63eaf7b460SMauro Carvalho Chehab
64eaf7b460SMauro Carvalho ChehabTMU driver description:
65eaf7b460SMauro Carvalho Chehab-----------------------
66eaf7b460SMauro Carvalho Chehab
67eaf7b460SMauro Carvalho ChehabThe exynos thermal driver is structured as::
68eaf7b460SMauro Carvalho Chehab
69eaf7b460SMauro Carvalho Chehab					Kernel Core thermal framework
7023affa2eSDaniel Lezcano				(thermal_core.c, step_wise.c, cpufreq_cooling.c)
71eaf7b460SMauro Carvalho Chehab								^
72eaf7b460SMauro Carvalho Chehab								|
73eaf7b460SMauro Carvalho Chehab								|
74eaf7b460SMauro Carvalho Chehab  TMU configuration data -----> TMU Driver  <----> Exynos Core thermal wrapper
75eaf7b460SMauro Carvalho Chehab  (exynos_tmu_data.c)	      (exynos_tmu.c)	   (exynos_thermal_common.c)
76eaf7b460SMauro Carvalho Chehab  (exynos_tmu_data.h)	      (exynos_tmu.h)	   (exynos_thermal_common.h)
77eaf7b460SMauro Carvalho Chehab
78eaf7b460SMauro Carvalho Chehaba) TMU configuration data:
79eaf7b460SMauro Carvalho Chehab		This consist of TMU register offsets/bitfields
80eaf7b460SMauro Carvalho Chehab		described through structure exynos_tmu_registers. Also several
81eaf7b460SMauro Carvalho Chehab		other platform data (struct exynos_tmu_platform_data) members
82eaf7b460SMauro Carvalho Chehab		are used to configure the TMU.
83eaf7b460SMauro Carvalho Chehabb) TMU driver:
84eaf7b460SMauro Carvalho Chehab		This component initialises the TMU controller and sets different
85eaf7b460SMauro Carvalho Chehab		thresholds. It invokes core thermal implementation with the call
86eaf7b460SMauro Carvalho Chehab		exynos_report_trigger.
87eaf7b460SMauro Carvalho Chehabc) Exynos Core thermal wrapper:
88eaf7b460SMauro Carvalho Chehab		This provides 3 wrapper function to use the
89eaf7b460SMauro Carvalho Chehab		Kernel core thermal framework. They are exynos_unregister_thermal,
90eaf7b460SMauro Carvalho Chehab		exynos_register_thermal and exynos_report_trigger.
91