Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/10] drm/xe/hwmon: Add fan control support
@ 2026-11-28  5:59 Karthik Poosa
  2026-11-28  5:59 ` [PATCH v5 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Karthik Poosa @ 2026-11-28  5:59 UTC (permalink / raw)
  To: intel-xe
  Cc: rodrigo.vivi, anshuman.gupta, badal.nilawar, raag.jadav,
	riana.tauro, sk.anirban, mallesh.koujalagi, soham.purkait,
	ravi.kishore.koppuravuri, Karthik Poosa

This series adds Intel Xe fan control through the hwmon sysfs ABI: fan
maximum speed, direct PWM control, mode selection and programmable fan
curves. Supported platforms are BMG in this series.

Each fan has a stock table read from firmware and a user table cached in
the driver and written back through PCODE.

Series overview

 01 Initialize fan-control backend and table cache
    Read the fan enable mask, max RPS, minimum PWM and stock fan tables.
 02 Expose fanN_max
    Maximum fan speed in RPM.
 03 Add ordered write batch helper
    PCODE helper that writes a fan table in order.
 04 Expose pwm[1-3]
    Constant duty cycle in the hwmon 0..255 range.
 05 Expose pwm[1-3]_enable
    0 = full speed, 1 = manual user table, 2 = firmware automatic.
 06 Enable fan curve control support
    pwm[1-3]_auto_point[1-10]_{temp,pwm}.
 07 Restore fan user tables after resume
 08 Refresh fan data after late binding
 09 Expose tjmax_fan_control_enable device sysfs
 10 Add kernel-doc for fan control

The ABI is documented in
Documentation/ABI/testing/sysfs-driver-intel-xe-hwmon.

Usage

Read fan speed and max RPM:
  cat /sys/class/hwmon/hwmonX/fan1_input
  cat /sys/class/hwmon/hwmonX/fan1_max

Manual mode with a fixed PWM:
  echo 1 > /sys/class/hwmon/hwmonX/pwm1_enable
  echo 120 > /sys/class/hwmon/hwmonX/pwm1

Back to firmware automatic control:
  echo 2 > /sys/class/hwmon/hwmonX/pwm1_enable

Program a 3-point fan curve:
  echo 1 > /sys/class/hwmon/hwmonX/pwm1_enable
  echo 30000 > /sys/class/hwmon/hwmonX/pwm1_auto_point1_temp
  echo 50 > /sys/class/hwmon/hwmonX/pwm1_auto_point1_pwm
  echo 60000 > /sys/class/hwmon/hwmonX/pwm1_auto_point2_temp
  echo 120 > /sys/class/hwmon/hwmonX/pwm1_auto_point2_pwm
  echo 85000 > /sys/class/hwmon/hwmonX/pwm1_auto_point3_temp
  echo 200 > /sys/class/hwmon/hwmonX/pwm1_auto_point3_pwm
  echo 0 > /sys/class/hwmon/hwmonX/pwm1_auto_point4_temp
  echo 0 > /sys/class/hwmon/hwmonX/pwm1_auto_point4_pwm

Notes
 - Package temperature (temp2_input) is the fan table temperature
   reference.
 - pwmN and curve point writes need pwmN_enable = 1.
 - A curve has 2 to 10 points. Temperature and PWM must not decrease
   from one point to the next.
 - Curve writes are staged and committed once point K+1 is (0, 0) or
   all 10 points are set.
 - PWM values below the fan's minimum duty cycle are raised to it.

v2:
 - Add kernel-doc for fan control.
 - Save/restore the user fan table across suspend/resume.
 - Refresh fan info after late binding; keep the user's PWM mode.
 - Show stock table points in the curve attributes when pwmN_enable = 2.

v3:
 - Address v2 review comments.
 - Add an ordered PCODE write batch helper.
 - Support a variable number of fan curve points.
 - Add missing failure checks.
 - Use only 2 fan curve points when setting pwmN.

v4:
 - Address v3 https://patchwork.freedesktop.org/series/176241/ review
   comments. (Soham)
 - Clamp oversized fan masks and stock tables; continue when one fan's
   stock table fails to read.
 - Clear cached values on failed pcode reads.
 - Use percent for fan speed and clamp min PWM to 100%.
 - Fail pwmN writes if pcode reports the wrong user point count.
 - Create fan curve attributes at probe time; add the (0, 0) end
   marker; points must not decrease.
 - Document pwmN_enable values and the curve rules.
 - Call the system PM hooks from xe_device_suspend()/xe_device_resume(),
   which also covers FLR; check d3cold only for runtime PM.
 - Fix the late binding firmware ID check; start fans enabled after
   late binding in automatic mode.
 - Rebase on drm-xe-next; update the ABI Date and KernelVersion.

v5:
 - Address review comments on v4 patch
   https://patchwork.freedesktop.org/series/179435/ from sashiko.
 - Add new sysfs tjmax_fan_control_enable for enable/disable of
   tjmax fan control.
 - Move CRI fan control support out of this patch series.
 - Add kgdoc patch at the end of the patch series.

Karthik Poosa (10):
  drm/xe/hwmon: Initialize fan-control backend and table cache
  drm/xe/hwmon: Expose fanN_max
  drm/xe/pcode: Add ordered write batch helper
  drm/xe/hwmon: Expose pwm[1-3]
  drm/xe/hwmon: Expose pwm[1-3]_enable
  drm/xe/hwmon: Enable fan curve control support
  drm/xe/hwmon: Restore fan user tables after resume
  drm/xe/hwmon: Refresh fan data after late binding
  drm/xe: Expose tjmax_fan_control_enable device sysfs
  drm/xe/hwmon: Add kernel-doc for fan control

 .../ABI/testing/sysfs-driver-intel-xe-gpu     |   15 +
 .../ABI/testing/sysfs-driver-intel-xe-hwmon   |   32 +
 drivers/gpu/drm/xe/regs/xe_pmt.h              |    5 +
 drivers/gpu/drm/xe/xe_device.c                |    3 +
 drivers/gpu/drm/xe/xe_device_sysfs.c          |   76 +
 drivers/gpu/drm/xe/xe_hwmon.c                 | 1322 ++++++++++++++++-
 drivers/gpu/drm/xe/xe_hwmon.h                 |    6 +
 drivers/gpu/drm/xe/xe_late_bind_fw.c          |   10 +
 drivers/gpu/drm/xe/xe_pcode.c                 |   39 +
 drivers/gpu/drm/xe/xe_pcode.h                 |   12 +
 drivers/gpu/drm/xe/xe_pcode_api.h             |   10 +
 drivers/gpu/drm/xe/xe_pm.c                    |   11 +-
 12 files changed, 1512 insertions(+), 29 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-11-28  6:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28  5:59 [PATCH v5 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-28  6:04   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-11-28  6:13   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-28  6:10   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
2026-11-28  6:15   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-11-28  6:27   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
2026-11-28  6:12   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-28  6:14 ` ✗ CI.KUnit: failure for drm/xe/hwmon: Add fan control support (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox