Jonghwa Lee assistant engineer Samsung Electronics
Contents Generic Thermal Framework Thermal zone device Cooling device Binding & Thermal instance Governors SYSFS interfaces Thermal management CPU Cooling device EXYNOS thermal driver 2
THERMAL FRAMEWORK 3
Thermal Framework Thermal zone Thermal sensor unit Cooling device Governor Fair share Step wise User SYSFS interface 4
User Interaction (sysfs, uevent) user kernel Thermal FW TMU driver Governor Cooling device Cooling device HW Sensor Sensor Fan 5
Devices in Thermal FW Thermal zone device Represents a region managed by thermal framework. Includes a thermal sensor and multiple cooling devices. 6
Thermal zone Thermal Sensor Cooling Device.0 Cooling Device.1 Governor 7
Interrupt Polling Thermal zone Thermal Sensor Cooling Device.0 Cooling Device.1 Governor 8
Thermal zone Thermal Sensor Thermal zone Thermal Sensor Governor Cooling Device.0 Cooling Device.1 Governor Cooling Device.0 Thermal zone Thermal Sensor Cooling Device.0 Governor 9
Devices in Thermal FW Cooling devices Actual functional units for cooling down the thermal zone. Can be hardware devices and also be software method. Hardware : Fans, various physical cooler Software : CPU frequency control 10
Binding Thermal zone devices and cooling devices will work after proper binding. Binding happens when any of thermal devices is newly registered. As a succeed result of binding, thermal instance would be created. 11
Binding Thermal instance Describes how cooling devices work at certain trip point in the thermal zone. Created at binding time of thermal zone devices and cooing devices. Added to thermal devices own thermal instances list. Governor handles the thermal instance not thermal devices. 12
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_cdev_list cooling_dev.0 cooling_dev.1 cooling_dev.2. 13
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_zone_dev.2 thermal_cdev_list cooling_dev.0 cooling_dev.1 cooling_dev.2. Newly thermal zone device is registered. After attaching to the list, it seeks cooling devices which can be bound to it. 14
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_zone_dev.2 bind_tz() thermal_cdev_list cooling_dev.0 cooling_dev.1 cooling_dev.2. Newly thermal zone device is registered. After attaching to the list, it seeks cooling devices which can be bound to it. 15
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_zone_dev.2 thermal_cdev_list cooling_dev.0 cooling_dev.1 cooling_dev.2. Binding can be done with - platform data s matching function (.match( ) ) - driver s binding function (.bind( ) ) 16
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_zone_dev.2 thermal_cdev_list cooling_dev.0 cooling_dev.1 cooling_dev.2. thermal_instance After succeed binding, thermal instance will be created. 17
Binding thermal_tz_list thermal_zone_dev.0 thermal_zone_dev.1 thermal_zone_dev.2 thermal_instance_list thermal_cdev_list cooling_dev.0 cooling_dev.1 thermal_instance_list thermal_instance Lastly, it adds thermal instance to related device s list It is almost same when cooling device is registered. 18
Governors Determines cooling policy. Currently, three candidates exist. USER_SPACE FAIR_SHARE STEP_WISE Can be varied for each thermal zone. 19
Governors Step wise governor Sets cooling state based on thermal trend. ( STABLE, RAISING, DROPPING, RASING_FULL, DROPPING_FULL ) Allows only one step change for increasing or decreasing at decision time. 20
Governors Fair share governor Sets cooling state according to its efficiency and potential ability and also current state. Gives the higher cooing state to more weighted device. 21
SYSFS interface Nodes under /sys/class/thermal/thermal_zone Get basic information (name, enabling, cooling devices) Manage how to work (set governor, trip temperature, passive, hysteresis, emulation) Monitor current state Nodes under /sys/class/thermal/cooling_device Get basic information (name) Set/get cooling state 22
THERMAL MANAGEMENT 23
Thermal management Thermal management starts with updating thermal zone. thermal_zone_device_update(). Possible factors for updating thermal zone. Polling Interrupt Passive 24
Start reset poling thermal_zone_update() governor->throttle() ACTIVE & PASSIVE temperature > HOT trip point? yes no.notify()? no trip_type == CRITICAL? no yes yes Make notify call /* Hibernation */ Shutdown HOT & CRITICAL 25
Thermal management CPU cooling device Controls CPU frequency according to cooling state. Higher cooling state, lower frequency. Limits the maximum CPU frequency with updating CPUFREQ policy. (Indirect) 26
Start Notify policy is updating max_freq = get_cpu_freq(cooling_state) update_cpufreq_policy() CPUFREQ Framework policy.max = max_freq Call cpufreq governor to update limits End 27
EXYNOS s thermal driver EXYNOS TMU(thermal management unit) Features HW interrupt (Falling/Raising) Trip point (hardware) Temperature history (currently not using) Trimming Emulation 28
EXYNOS s thermal driver Trimming Trimming value is runtime value supported by HW. (TRIMINFO register) Sensor s value can be calibrated with. (noise compensation) T_ERROR = TRIM - 25 T( ) = sensor_t (T_ERROR) 29
EXYNOS s thermal driver Emulation For test purpose, EXYNOS TMU supports hardware emulation mode. Emulation temperature can be set with sysfs node, emul_temp. Hardware interrupt also works in emulation mode. 30
EXYNOS s thermal driver Cooling device Currently exynos_thermal driver uses CPU cooling device only. When create CPU cooling device, it sets 0 for CPU mask. (Core 0) At binding time, it creates multiple thermal instances based on number of ACTIVE trips. 31
EXYNOS s thermal driver Thermal Instance #1 Thermal Instance #2 800Mhz for Trip1 Thermal zone 200Mhz for Trip2 Trip 1 T( ) : 85 Trip 2 T( ) : 103 Trip 3 T( ) : 110 Thermal Sensor Cooling Device CPU cooing Governor default governor 32
Thermal management in TIZEN Up to TIZEN 2.0, it doesn t support generic thermal framework. It supports same functionality with private platform driver. Generic thermal framework will be supported from 3.0. 33
To do Thermal FW is isolated. No available APIs to get thermal data. Hard to know current thermal state. Solution can be one of followings, Introducing APIs to get thermal data. Implementing notification method. Allowing to add own thermal handler. 34
In progress To open thermal data is now attempting. [Patch] : Get thermal zone device by name To separate sensor from thermal zone as a new thermal device. It ll enable, multiple sensors in one thermal zone. more intuitive binding of thermal zone units. 35
Q & A 36