Skip to content

Changes related to PID controller and some man page updates - #590

Merged
spandruvada merged 4 commits into
masterfrom
thermald_next
Aug 14, 2026
Merged

Changes related to PID controller and some man page updates#590
spandruvada merged 4 commits into
masterfrom
thermald_next

Conversation

@spandruvada

Copy link
Copy Markdown
Contributor

No description provided.

RevySR and others added 4 commits August 7, 2026 12:05
Per Intel DPTF ConditionType.h, condition ids in [0x2000, 0x10000) are
software-OEM conditions set at runtime by OEM software via DPTF/ESIF;
they have no equivalent on Linux. thermald instead lumped the whole
[0x1000, 0x10000) range into ODVP and mapped e.g. 0x200D to a
non-existent odvp4115, logging "Unable to read odvp4115" every poll.

Restrict the ODVP mapping to [0x1000, 0x2000). SwOem conditions are
still recognized by verify_condition() so engine startup behavior is
unchanged (failing verify_conditions() would enter the unsupported
condition fallback and stop evaluating conditions at poll time), but
they are no longer evaluated via ODVP: the containing condition set
quietly never matches, exactly as before when the odvpN read failed,
just without the per-poll error spam. A one-time info message is
logged at startup instead.

No functional change - such sets were never satisfiable on Linux.

Signed-off-by: Han Gao <rabenda.cn@gmail.com>
AMD platforms expose CPU temperature via k10temp/hwmon but lack a
thermal_zone in /sys/class/thermal, so thermald cannot auto-discover
the sensor. This causes the well-known 'No coretemp sysfs found' and
'No Zones present' messages on AMD systems.

Existing examples 1-7 all assume Intel coretemp or pre-existing sysfs
sensors. Add Example 8 showing the correct configuration for AMD:

- Define a custom sensor under <ThermalSensors><ThermalSensor> with
  <Type>, <Path>, and <AsyncCapable> tags
- Point the path at the k10temp hwmon input (e.g. hwmon2/temp1_input)
- Use a unique sensor name (not the hwmon driver name) to avoid
  conflicts with auto-discovered sensors
- Requires --ignore-cpuid-check on the thermald command line

Verified on AMD Ryzen 9 5950X (ASUS B550-E) with thermald 2.5.11.
Tag names confirmed against source (thd_parse.cpp parse_new_sensor).

Signed-off-by: Greg Weyer <gweyer@live.com>
Power-limit devices (RAPL, SPEL) use an inverted state range where
min_state is the maximum allowed power and max_state is the minimum.
This patch fixes PID control for such devices and adds an incremental
PID mode.

- Negate PID output for inverted-range devices so a positive error
  (temp > target) reduces the power limit (thd_cdev.cpp)
- Bypass in_max_state() guard for PID on inverted-range devices so
  the controller keeps running after hitting max restriction
  (thd_trip_point.cpp)
- Fix unsigned subtraction wrap-around in pid_output() (thd_pid.cpp)
- Add PID_INCREMENTAL mode: same formula as absolute but applied to
  curr_state instead of min_state, so the power limit keeps decreasing
  each poll while temperature stays above the trip threshold
- Extend XML PID gain range from [0, 100] to [0, 1000] to support
  temperature-to-power mappings (thd_parse.cpp)
- Add <PidMode>incremental</PidMode> XML element to select the mode

Changes in v2:
- thd_trip_point.cpp: extend in_max_state() bypass to cover cdev-level
  PID (is_pid_enabled()) in addition to trip-level PID (pid_param.valid);
  add is_pid_enabled() accessor to thd_cdev.h
- thd_cdev.cpp: use get_curr_state(true) in incremental PID branches to
  anchor each step to the actual hardware state, not the cached value

Signed-off-by: Priyansh Jain <priyansh.jain@oss.qualcomm.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@spandruvada
spandruvada merged commit ce12c6b into master Aug 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants