thermal: introduce clock cooling device
RFC 1/1 thermal: introduce clock cooling device
Hello all,
Here is a request for comments on how to implement a cooling device based on common clock framework. This patch introduces a new thermal cooling device based on common clock framework.
The original motivation to write this cooling device is to be able to cool down thermal zones using clocks that feed co-processors, such as GPUs, DSPs, Image Processing Co-processors, etc. But it is written in a way that it can be used on top of any clock.
The implementation is pretty straight forward. The code creates
a thermal cooling device based on a pair of a struct device and a clock name. The struct device is assumed to be usable by the OPP layer. The OPP layer is used as source of the list of possible frequencies. The (cpufreq) frequency table is then used as a map from frequencies to cooling states. Cooling states are indexes to the frequency table.
The logic sits on top of common clock framework, specifically on clock pre notifications. Any PRE_RATE_CHANGE is hijacked, and the transition is only allowed when the new rate is within the thermal limit (cooling state -> freq).
When a thermal cooling device state transition is requested, the clock is also checked to verify if the current clock rate is within the new thermal limit.
--- drivers/thermal/Kconfig | 10 + drivers/thermal/Makefile | 3 + drivers/thermal/clock_cooling.c | 488 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 501 insertions(+) create mode 100644 drivers/thermal/clock_cooling.c
drivers/thermal/Kconfig +10 -0
@@ -88,6 +88,16 @@ config CPU_THERMAL If you want this support, you should say Y here. +config CLOCK_THERMAL + bool "Generic clock cooling support" + depends on COMMON_CLK + depends on PM_OPP + help + This implements the generic clock cooling mechanism through frequency + reductioni. Typically used to cool off co-processors. + + If you want this support, you should say Y here. + config THERMAL_EMULATION bool "Thermal emulation mode support" help
drivers/thermal/Makefile +3 -0
@@ -16,6 +16,9 @@ thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE) += user_space.o # cpufreq cooling thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o +# clock cooling +thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o + # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
drivers/thermal/clock_cooling.c new file +488 -0
488 lines not on this page · raw message
Signature · 1 line
1.8.2.1.342.gfa7285d
RFC 1/1 thermal: introduce clock cooling device
Hello all,
Here is a request for comments on how to implement a cooling device based on common clock framework. This patch introduces a new thermal cooling device based on common clock framework.
The original motivation to write this cooling device is to be able to cool down thermal zones using clocks that feed co-processors, such as GPUs, DSPs, Image Processing Co-processors, etc. But it is written in a way that it can be used on top of any clock.
The implementation is pretty straight forward. The code creates
a thermal cooling device based on a pair of a struct device and a clock name. The struct device is assumed to be usable by the OPP layer. The OPP layer is used as source of the list of possible frequencies. The (cpufreq) frequency table is then used as a map from frequencies to cooling states. Cooling states are indexes to the frequency table.
The logic sits on top of common clock framework, specifically on clock pre notifications. Any PRE_RATE_CHANGE is hijacked, and the transition is only allowed when the new rate is within the thermal limit (cooling state -> freq).
When a thermal cooling device state transition is requested, the clock is also checked to verify if the current clock rate is within the new thermal limit.
--- drivers/thermal/Kconfig | 10 + drivers/thermal/Makefile | 3 + drivers/thermal/clock_cooling.c | 488 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 501 insertions(+) create mode 100644 drivers/thermal/clock_cooling.c
drivers/thermal/Kconfig +10 -0
@@ -88,6 +88,16 @@ config CPU_THERMAL If you want this support, you should say Y here. +config CLOCK_THERMAL + bool "Generic clock cooling support" + depends on COMMON_CLK + depends on PM_OPP + help + This implements the generic clock cooling mechanism through frequency + reductioni. Typically used to cool off co-processors. + + If you want this support, you should say Y here. + config THERMAL_EMULATION bool "Thermal emulation mode support" help
drivers/thermal/Makefile +3 -0
@@ -16,6 +16,9 @@ thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE) += user_space.o # cpufreq cooling thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o +# clock cooling +thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o + # platform thermal drivers obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
drivers/thermal/clock_cooling.c new file +488 -0
488 lines not on this page · raw message
Signature · 1 line
1.8.2.1.342.gfa7285d