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