18c2ecf20Sopenharmony_ci======================== 28c2ecf20Sopenharmony_ciKernel driver exynos_tmu 38c2ecf20Sopenharmony_ci======================== 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciSupported chips: 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci* ARM Samsung Exynos4, Exynos5 series of SoC 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci Datasheet: Not publicly available 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciAuthors: Donggeun Kim <dg77.kim@samsung.com> 128c2ecf20Sopenharmony_ciAuthors: Amit Daniel <amit.daniel@samsung.com> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciTMU controller Description: 158c2ecf20Sopenharmony_ci--------------------------- 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciThis driver allows to read temperature inside Samsung Exynos4/5 series of SoC. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciThe chip only exposes the measured 8-bit temperature code value 208c2ecf20Sopenharmony_cithrough a register. 218c2ecf20Sopenharmony_ciTemperature can be taken from the temperature code. 228c2ecf20Sopenharmony_ciThere are three equations converting from temperature to temperature code. 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciThe three equations are: 258c2ecf20Sopenharmony_ci 1. Two point trimming:: 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci Tc = (T - 25) * (TI2 - TI1) / (85 - 25) + TI1 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci 2. One point trimming:: 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci Tc = T + TI1 - 25 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci 3. No trimming:: 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci Tc = T + 50 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci Tc: 388c2ecf20Sopenharmony_ci Temperature code, T: Temperature, 398c2ecf20Sopenharmony_ci TI1: 408c2ecf20Sopenharmony_ci Trimming info for 25 degree Celsius (stored at TRIMINFO register) 418c2ecf20Sopenharmony_ci Temperature code measured at 25 degree Celsius which is unchanged 428c2ecf20Sopenharmony_ci TI2: 438c2ecf20Sopenharmony_ci Trimming info for 85 degree Celsius (stored at TRIMINFO register) 448c2ecf20Sopenharmony_ci Temperature code measured at 85 degree Celsius which is unchanged 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciTMU(Thermal Management Unit) in Exynos4/5 generates interrupt 478c2ecf20Sopenharmony_ciwhen temperature exceeds pre-defined levels. 488c2ecf20Sopenharmony_ciThe maximum number of configurable threshold is five. 498c2ecf20Sopenharmony_ciThe threshold levels are defined as follows:: 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci Level_0: current temperature > trigger_level_0 + threshold 528c2ecf20Sopenharmony_ci Level_1: current temperature > trigger_level_1 + threshold 538c2ecf20Sopenharmony_ci Level_2: current temperature > trigger_level_2 + threshold 548c2ecf20Sopenharmony_ci Level_3: current temperature > trigger_level_3 + threshold 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciThe threshold and each trigger_level are set 578c2ecf20Sopenharmony_cithrough the corresponding registers. 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciWhen an interrupt occurs, this driver notify kernel thermal framework 608c2ecf20Sopenharmony_ciwith the function exynos_report_trigger. 618c2ecf20Sopenharmony_ciAlthough an interrupt condition for level_0 can be set, 628c2ecf20Sopenharmony_ciit can be used to synchronize the cooling action. 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciTMU driver description: 658c2ecf20Sopenharmony_ci----------------------- 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciThe exynos thermal driver is structured as:: 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci Kernel Core thermal framework 708c2ecf20Sopenharmony_ci (thermal_core.c, step_wise.c, cpufreq_cooling.c) 718c2ecf20Sopenharmony_ci ^ 728c2ecf20Sopenharmony_ci | 738c2ecf20Sopenharmony_ci | 748c2ecf20Sopenharmony_ci TMU configuration data -----> TMU Driver <----> Exynos Core thermal wrapper 758c2ecf20Sopenharmony_ci (exynos_tmu_data.c) (exynos_tmu.c) (exynos_thermal_common.c) 768c2ecf20Sopenharmony_ci (exynos_tmu_data.h) (exynos_tmu.h) (exynos_thermal_common.h) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_cia) TMU configuration data: 798c2ecf20Sopenharmony_ci This consist of TMU register offsets/bitfields 808c2ecf20Sopenharmony_ci described through structure exynos_tmu_registers. Also several 818c2ecf20Sopenharmony_ci other platform data (struct exynos_tmu_platform_data) members 828c2ecf20Sopenharmony_ci are used to configure the TMU. 838c2ecf20Sopenharmony_cib) TMU driver: 848c2ecf20Sopenharmony_ci This component initialises the TMU controller and sets different 858c2ecf20Sopenharmony_ci thresholds. It invokes core thermal implementation with the call 868c2ecf20Sopenharmony_ci exynos_report_trigger. 878c2ecf20Sopenharmony_cic) Exynos Core thermal wrapper: 888c2ecf20Sopenharmony_ci This provides 3 wrapper function to use the 898c2ecf20Sopenharmony_ci Kernel core thermal framework. They are exynos_unregister_thermal, 908c2ecf20Sopenharmony_ci exynos_register_thermal and exynos_report_trigger. 91