This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0ebaa7bfbf03d238156632d3064f217b80ba2d73
Author: Justin Hammond <[email protected]>
AuthorDate: Sat Aug 15 19:43:07 2026 +0800

    sim/thermal: Exercise the devfreq cooling path.
    
    The dummy driver's frequency cooling device is now a devfreq one, so the
    configuration that tests it needs devfreq built.  This is a change in what
    the configuration covers, not just a symbol rename: nothing in the tree
    registered a devfreq device before, and this is now the one place the
    thermal to devfreq path runs without hardware.
    
    Walking the dummy zone from 45 to 90 degrees steps the device through
    every entry of its table, 900 down to 100, and back up as it cools.
    
    The documentation follows the same rename, and devfreq's own page now says
    that thermal is a requester and that a driver expecting to be throttled
    wants DEVFREQ_CONFLICT_PREFER_LOW.
    
    Assisted-by: Claude:claude-opus-5
    Signed-off-by: Justin Hammond <[email protected]>
---
 Documentation/components/drivers/special/devfreq.rst | 14 ++++++++++++++
 Documentation/components/drivers/thermal/index.rst   | 10 +++++-----
 boards/sim/sim/sim/configs/thermal/defconfig         |  3 +++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/Documentation/components/drivers/special/devfreq.rst 
b/Documentation/components/drivers/special/devfreq.rst
index 85e2f142897..a12d709a983 100644
--- a/Documentation/components/drivers/special/devfreq.rst
+++ b/Documentation/components/drivers/special/devfreq.rst
@@ -52,6 +52,20 @@ aggregate ``max``) the driver's ``conflict_policy`` decides 
who wins:
 - ``DEVFREQ_CONFLICT_PREFER_LOW`` clamps to the ceiling and chooses the lower
   frequency. A device protecting a thermal or power budget picks this.
 
+The thermal framework is one such requester. With
+``CONFIG_THERMAL_CDEV_DEVFREQ`` it registers a cooling device over the
+devfreq device named by ``CONFIG_THERMAL_CDEV_DEVFREQ_NAME``, and each
+cooling state installs a ceiling one entry further down the table. Drivers
+that expect to be throttled should carry ``DEVFREQ_CONFLICT_PREFER_LOW``, so
+that the ceiling wins against anything asking for more.
+
+A table of *n* usable frequencies gives the cooling device a maximum state of
+*n* - 1: state zero caps at the highest frequency, which leaves the device
+unthrottled, and the maximum state caps at the lowest. Entries of
+``DEVFREQ_ENTRY_INVALID`` are not frequencies the device can be held at, so
+they earn no state, and the ``low`` and ``high`` bounds of a thermal zone's
+cooling map therefore count usable frequencies rather than table positions.
+
 The resolved ``[min, max]`` is then snapped to the table: ``min`` rounds up to
 the lowest entry at or above it, ``max`` rounds down to the highest entry at
 or below it. The governor picks within that snapped range, and the lower half
diff --git a/Documentation/components/drivers/thermal/index.rst 
b/Documentation/components/drivers/thermal/index.rst
index 019c62ea27f..b14820afdb6 100644
--- a/Documentation/components/drivers/thermal/index.rst
+++ b/Documentation/components/drivers/thermal/index.rst
@@ -8,7 +8,7 @@ Brief
 =====
 1. Support Zone, Cooling Device and Governor
     - ``Zone``: Responsible for monitoring the temperature of the specified 
area, obtains the temperature through the temperature sensor, and the sensor 
driver returns the temperature through callback function.
-    - ``Cooling Device``: A cooling device is a device that can reduce the 
temperature by using resources such as cpufreq, fan, etc. The cpufreq cooling 
device driver is preset to simplify CPU frequency modulation temperature 
control.
+    - ``Cooling Device``: A cooling device is a device that can reduce the 
temperature by using resources such as devfreq, fan, etc. The devfreq cooling 
device driver is preset to simplify frequency modulation temperature control: 
it caps the frequency of the devfreq device named by 
``CONFIG_THERMAL_CDEV_DEVFREQ_NAME``, which must be registered before 
``thermal_init()`` runs.
     - ``Governor``: For temperature control, you can use the preset or custom 
registered one, preset "step_wise" governor:
         - When the temperature of the "Zone" reaches the temperature trip 
point, and the temperature change trend rises or stabilizes ("step_wise" 
obtains the value of the corresponding "Zone" every 20ms 
[``CONFIG_THERMAL_DUMMY_POLLING_DELAY=200``, ``CONFIG_USEC_PER_TICK=100``]), 
the current temperature equals to OR greater than the last obtained temperature 
value), improve the state of the "Cooling Device" (trigger the cooling 
operation executed by the corresponding state, Through ``set [...]
         - When the temperature of the zone is lower than the temperature trip 
point, and the temperature trend is steadily decreasing, the state of the 
"Cooling Device" is reduced.
@@ -80,8 +80,8 @@ Device Driver
 
         nsh> cat /proc/thermal/cpu-thermal
         z:cpu-thermal t:77 t:1 h:16 l:0 c:fan0 s:7|7
-        z:cpu-thermal t:77 t:1 h:3 l:3 c:cpufreq s:3|3
-        z:cpu-thermal t:77 t:2 h:2 l:0 c:cpufreq s:3|2
+        z:cpu-thermal t:77 t:1 h:3 l:3 c:cpu s:3|3
+        z:cpu-thermal t:77 t:2 h:2 l:0 c:cpu s:3|2
 
 Board Customization
 ===================
@@ -127,7 +127,7 @@ The binding relationship between Trip, Cooling Device, 
Governor and Zone is show
   {
     {
       .trip_name = "cpu_alert1",
-      .cdev_name = "cpufreq",
+      .cdev_name = CONFIG_THERMAL_CDEV_DEVFREQ_NAME,
       .low    = 3,
       .high   = THERMAL_NO_LIMIT,
       .weight = 20
@@ -141,7 +141,7 @@ The binding relationship between Trip, Cooling Device, 
Governor and Zone is show
     },
     {
       .trip_name = "cpu_alert0",
-      .cdev_name = "cpufreq",
+      .cdev_name = CONFIG_THERMAL_CDEV_DEVFREQ_NAME,
       .low    = THERMAL_NO_LIMIT,
       .high   = 2,
       .weight = 20
diff --git a/boards/sim/sim/sim/configs/thermal/defconfig 
b/boards/sim/sim/sim/configs/thermal/defconfig
index ed59eb3eab7..89dd469238a 100644
--- a/boards/sim/sim/sim/configs/thermal/defconfig
+++ b/boards/sim/sim/sim/configs/thermal/defconfig
@@ -4,9 +4,12 @@ CONFIG_DEBUG_THERMAL=y
 CONFIG_DEBUG_THERMAL_ERROR=y
 CONFIG_DEBUG_THERMAL_INFO=y
 CONFIG_DEBUG_THERMAL_WARN=y
+CONFIG_DEVFREQ=y
+CONFIG_DEVFREQ_PROCFS=y
 CONFIG_PM=y
 CONFIG_READLINE_CMD_HISTORY=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_THERMAL=y
 CONFIG_THERMAL_DUMMY=y
+CONFIG_THERMAL_DUMMY_DEVFREQ=y
 CONFIG_THERMAL_PROCFS=y

Reply via email to