Skip to content

Add manual fan target control for Victus 8A3D - #4

Closed
jR4dh3y wants to merge 1 commit into
ranisalt:rebase-6.15from
jR4dh3y:codex/manual-fan-target-8a3d
Closed

jR4dh3y wants to merge 1 commit into
ranisalt:rebase-6.15from
jR4dh3y:codex/manual-fan-target-8a3d

Conversation

@jR4dh3y

@jR4dh3y jR4dh3y commented May 7, 2026

Copy link
Copy Markdown

Summary

Add experimental manual fan RPM target control for HP Victus board 8A3D through the existing hp-wmi hwmon device.

This exposes standard hwmon fan target attributes:

  • fan1_target
  • fan2_target
  • fan1_max
  • fan2_max

It also accepts pwm1_enable=1 as manual mode, while preserving the existing mappings:

  • pwm1_enable=0: max fan
  • pwm1_enable=2: automatic fan control

Notes

The implementation uses the existing HPWMI_FAN_SPEED_SET_QUERY path and keeps manual fan control gated to board 8A3D, with an opt-in force_manual_fan_control module parameter for testing other systems.

Requested RPM values are clamped to conservative board-specific bounds before being converted to the firmware payload values.

Validation

Tested on:

  • Product: Victus by HP Gaming Laptop 15-fb0xxx
  • Board: 8A3D
  • BIOS: F.22
  • Kernel: 7.0.3-1-cachyos-bore-lto

Build validation:

make -C src KERNELDIR=/lib/modules/$(uname -r)/build LLVM=1 CC=clang

Runtime validation after installing and reloading hp_wmi:

ls /sys/devices/platform/hp-wmi/hwmon/hwmon*/fan*_target

Observed both fan1_target and fan2_target, and userspace probe reported direct fan control available.

Copilot AI review requested due to automatic review settings May 7, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds experimental manual fan RPM target control for HP Victus board 8A3D by extending the existing hp-wmi hwmon interface to expose standard fan*_target/fan*_max attributes and a manual pwm1_enable=1 mode.

Changes:

  • Introduces a per-hwmon-device private state to track target/max RPM and the selected PWM mode.
  • Exposes fan1_target, fan2_target, fan1_max, and fan2_max conditionally (board 8A3D or force_manual_fan_control).
  • Implements a firmware write path for applying clamped RPM targets via HPWMI_FAN_SPEED_SET_QUERY, and extends pwm1_enable handling to support manual mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/hp-wmi.c
Comment on lines +373 to +375
module_param(force_manual_fan_control, bool, 0644);
MODULE_PARM_DESC(force_manual_fan_control,
"Expose experimental fan_target manual fan control");
Comment thread src/hp-wmi.c
Comment on lines +747 to +766
static int hp_wmi_fan_speed_set_targets(struct hp_wmi_hwmon_priv *priv)
{
u8 fan_speed[HPWMI_FAN_COUNT];
int ret;

fan_speed[HPWMI_CPU_FAN] = DIV_ROUND_CLOSEST(priv->target_rpm[HPWMI_CPU_FAN], 100);
fan_speed[HPWMI_GPU_FAN] = DIV_ROUND_CLOSEST(priv->target_rpm[HPWMI_GPU_FAN], 100);

ret = hp_wmi_get_fan_count_userdefine_trigger();
if (ret < 0)
return ret;

ret = hp_wmi_fan_speed_max_set(0);
if (ret < 0)
return ret;

ret = hp_wmi_perform_query(HPWMI_FAN_SPEED_SET_QUERY, HPWMI_GM,
&fan_speed, sizeof(fan_speed), 0);
if (ret)
return ret < 0 ? ret : -EINVAL;
Comment thread src/hp-wmi.c
Comment on lines +772 to +782
static int hp_wmi_apply_manual_fan_target(struct hp_wmi_hwmon_priv *priv,
int fan, long rpm)
{
if (!hp_wmi_manual_fan_control_available())
return -EOPNOTSUPP;
if (fan < 0 || fan >= HPWMI_FAN_COUNT)
return -EINVAL;

priv->target_rpm[fan] = hp_wmi_clamp_fan_target(fan, rpm);
return hp_wmi_fan_speed_set_targets(priv);
}
Comment thread src/hp-wmi.c
Comment on lines +2502 to 2512
if (hp_wmi_manual_fan_control_available() &&
priv->fan_mode == HPWMI_PWM_MANUAL) {
*val = HPWMI_PWM_MANUAL;
return 0;
}
switch (hp_wmi_fan_speed_max_get()) {
case 0:
/* 0 is automatic fan, which is 2 for hwmon */
*val = 2;
priv->fan_mode = HPWMI_PWM_AUTO;
*val = HPWMI_PWM_AUTO;
return 0;
Comment thread src/hp-wmi.c
Comment on lines 2541 to 2566
case hwmon_pwm:
switch (val) {
case 0:
if (is_victus_s_thermal_profile())
hp_wmi_get_fan_count_userdefine_trigger();
/* 0 is no fan speed control (max), which is 1 for us */
return hp_wmi_fan_speed_max_set(1);
ret = hp_wmi_fan_speed_max_set(1);
if (!ret)
priv->fan_mode = HPWMI_PWM_MAX;
return ret;
case 1:
if (!hp_wmi_manual_fan_control_available())
return -EOPNOTSUPP;
return hp_wmi_fan_speed_set_targets(priv);
case 2:
/* 2 is automatic speed control, which is 0 for us */
if (is_victus_s_thermal_profile()) {
hp_wmi_get_fan_count_userdefine_trigger();
return hp_wmi_fan_speed_max_reset();
} else
return hp_wmi_fan_speed_max_set(0);
ret = hp_wmi_fan_speed_max_reset();
} else {
ret = hp_wmi_fan_speed_max_set(0);
}
if (!ret)
priv->fan_mode = HPWMI_PWM_AUTO;
return ret;
default:
@jR4dh3y

jR4dh3y commented May 7, 2026

Copy link
Copy Markdown
Author

Closing this because the active upstream is the Linux kernel, and manual Victus fan control has already landed there via the platform-drivers-x86 v7.0 pull. The accepted mainline implementation exposes the standard hwmon PWM interface (/) rather than the interface from this experimental DKMS patch.\n\nRelevant upstream references:\n- platform/x86 pull includes hp-wmi manual fan control and keep-alive: https://www.spinics.net/lists/platform-driver-x86/msg58776.html\n- Linus merge: https://linux.googlesource.com/linux/kernel/git/torvalds/linux/+/f50822fd8675c68d294e89bd102f7b487ca3acd3\n

@jR4dh3y jR4dh3y closed this May 7, 2026
@jR4dh3y

jR4dh3y commented May 7, 2026

Copy link
Copy Markdown
Author

Correction to my previous comment: shell quoting stripped the inline code names.

Closing this because the active upstream is the Linux kernel, and manual Victus fan control has already landed there via the platform-drivers-x86 v7.0 pull. The accepted mainline implementation exposes the standard hwmon PWM interface (pwm1 / pwm1_enable) rather than the fan*_target interface from this experimental DKMS patch.

Relevant upstream references:

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.

2 participants