Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: hp-wmi: fix platform profile values for Omen 16-wf1xxx

HP Omen 16-wf1xxx (board ID 8C78) currently sends the incorrect
Victus-specific thermal profile values via WMI, leading to a logical
inconsistency when switching between platform profiles.

The driver currently uses Victus S values:
0x00 => Balanced / Low-Power
0x01 => Performance

However, Omen Gaming Hub logs / EC register inspection on Windows shows
that this board is intended to use:
0x30 => Balanced / Low-Power
0x31 => Performance

This patch corrects the thermal profile command values to match the
values observed from Omen Gaming Hub logs. The performance benchmarks
and peak power draw (from both CPU and GPU) show no observable change
with this correction (suggesting that the firmware is currently tolerant
of the incorrect values). However sending the correct values prevents
potential regressions after future firmware updates.

Refactor victus_s_thermal_profile_boards from a list of strings to a
dmi_system_id table and move the lookup to module init. The new struct
thermal_profile_params is used to store board-specific WMI parameters,
allowing the driver to cache these values in a static pointer. This
avoids repeated DMI string comparisons and allows marking of DMI table as
__initconst.

Testing on HP Omen 16-wf1xxx (board 8C78) confirmed WMI codes 0x30/0x31
are now sent, resolving the logical inconsistency and ensuring the value
visible in EC registers match the Windows state for this profile.

Fixes: fb146a38cb11 ("platform/x86: hp-wmi: Add Omen 16-wf1xxx fan support")
Signed-off-by: Krishna Chomal <krishna.chomal108@gmail.com>
Link: https://patch.msgid.link/20260113182604.115211-2-krishna.chomal108@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Krishna Chomal and committed by
Ilpo Järvinen
8ca7515d c203c59f

+127 -52
+127 -52
drivers/platform/x86/hp/hp-wmi.c
··· 58 58 59 59 #define zero_if_sup(tmp) (zero_insize_support?0:sizeof(tmp)) // use when zero insize is required 60 60 61 + enum hp_thermal_profile_omen_v0 { 62 + HP_OMEN_V0_THERMAL_PROFILE_DEFAULT = 0x00, 63 + HP_OMEN_V0_THERMAL_PROFILE_PERFORMANCE = 0x01, 64 + HP_OMEN_V0_THERMAL_PROFILE_COOL = 0x02, 65 + }; 66 + 67 + enum hp_thermal_profile_omen_v1 { 68 + HP_OMEN_V1_THERMAL_PROFILE_DEFAULT = 0x30, 69 + HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE = 0x31, 70 + HP_OMEN_V1_THERMAL_PROFILE_COOL = 0x50, 71 + }; 72 + 73 + enum hp_thermal_profile_omen_flags { 74 + HP_OMEN_EC_FLAGS_TURBO = 0x04, 75 + HP_OMEN_EC_FLAGS_NOTIMER = 0x02, 76 + HP_OMEN_EC_FLAGS_JUSTSET = 0x01, 77 + }; 78 + 79 + enum hp_thermal_profile_victus { 80 + HP_VICTUS_THERMAL_PROFILE_DEFAULT = 0x00, 81 + HP_VICTUS_THERMAL_PROFILE_PERFORMANCE = 0x01, 82 + HP_VICTUS_THERMAL_PROFILE_QUIET = 0x03, 83 + }; 84 + 85 + enum hp_thermal_profile_victus_s { 86 + HP_VICTUS_S_THERMAL_PROFILE_DEFAULT = 0x00, 87 + HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE = 0x01, 88 + }; 89 + 90 + enum hp_thermal_profile { 91 + HP_THERMAL_PROFILE_PERFORMANCE = 0x00, 92 + HP_THERMAL_PROFILE_DEFAULT = 0x01, 93 + HP_THERMAL_PROFILE_COOL = 0x02, 94 + HP_THERMAL_PROFILE_QUIET = 0x03, 95 + }; 96 + 97 + struct thermal_profile_params { 98 + u8 performance; 99 + u8 balanced; 100 + u8 low_power; 101 + }; 102 + 103 + static const struct thermal_profile_params victus_s_thermal_params = { 104 + .performance = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE, 105 + .balanced = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT, 106 + .low_power = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT, 107 + }; 108 + 109 + static const struct thermal_profile_params omen_v1_thermal_params = { 110 + .performance = HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE, 111 + .balanced = HP_OMEN_V1_THERMAL_PROFILE_DEFAULT, 112 + .low_power = HP_OMEN_V1_THERMAL_PROFILE_DEFAULT, 113 + }; 114 + 115 + /* 116 + * A generic pointer for the currently-active board's thermal profile 117 + * parameters. 118 + */ 119 + static struct thermal_profile_params *active_thermal_profile_params; 120 + 61 121 /* DMI board names of devices that should use the omen specific path for 62 122 * thermal profiles. 63 123 * This was obtained by taking a look in the windows omen command center ··· 164 104 }; 165 105 166 106 /* DMI Board names of Victus 16-r and Victus 16-s laptops */ 167 - static const char * const victus_s_thermal_profile_boards[] = { 168 - "8BBE", "8BD4", "8BD5", 169 - "8C78", "8C99", "8C9C", 170 - "8D41", 107 + static const struct dmi_system_id victus_s_thermal_profile_boards[] __initconst = { 108 + { 109 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8BBE") }, 110 + .driver_data = (void *)&victus_s_thermal_params, 111 + }, 112 + { 113 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8BD4") }, 114 + .driver_data = (void *)&victus_s_thermal_params, 115 + }, 116 + { 117 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8BD5") }, 118 + .driver_data = (void *)&victus_s_thermal_params, 119 + }, 120 + { 121 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8C78") }, 122 + .driver_data = (void *)&omen_v1_thermal_params, 123 + }, 124 + { 125 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8C99") }, 126 + .driver_data = (void *)&victus_s_thermal_params, 127 + }, 128 + { 129 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8C9C") }, 130 + .driver_data = (void *)&victus_s_thermal_params, 131 + }, 132 + { 133 + .matches = { DMI_MATCH(DMI_BOARD_NAME, "8D41") }, 134 + .driver_data = (void *)&victus_s_thermal_params, 135 + }, 136 + {}, 171 137 }; 138 + 139 + static bool is_victus_s_board; 172 140 173 141 enum hp_wmi_radio { 174 142 HPWMI_WIFI = 0x0, ··· 317 229 HPWMI_POWER_BIOS = 0x04, 318 230 HPWMI_POWER_HARD = 0x08, 319 231 HPWMI_POWER_FW_OR_HW = HPWMI_POWER_BIOS | HPWMI_POWER_HARD, 320 - }; 321 - 322 - enum hp_thermal_profile_omen_v0 { 323 - HP_OMEN_V0_THERMAL_PROFILE_DEFAULT = 0x00, 324 - HP_OMEN_V0_THERMAL_PROFILE_PERFORMANCE = 0x01, 325 - HP_OMEN_V0_THERMAL_PROFILE_COOL = 0x02, 326 - }; 327 - 328 - enum hp_thermal_profile_omen_v1 { 329 - HP_OMEN_V1_THERMAL_PROFILE_DEFAULT = 0x30, 330 - HP_OMEN_V1_THERMAL_PROFILE_PERFORMANCE = 0x31, 331 - HP_OMEN_V1_THERMAL_PROFILE_COOL = 0x50, 332 - }; 333 - 334 - enum hp_thermal_profile_omen_flags { 335 - HP_OMEN_EC_FLAGS_TURBO = 0x04, 336 - HP_OMEN_EC_FLAGS_NOTIMER = 0x02, 337 - HP_OMEN_EC_FLAGS_JUSTSET = 0x01, 338 - }; 339 - 340 - enum hp_thermal_profile_victus { 341 - HP_VICTUS_THERMAL_PROFILE_DEFAULT = 0x00, 342 - HP_VICTUS_THERMAL_PROFILE_PERFORMANCE = 0x01, 343 - HP_VICTUS_THERMAL_PROFILE_QUIET = 0x03, 344 - }; 345 - 346 - enum hp_thermal_profile_victus_s { 347 - HP_VICTUS_S_THERMAL_PROFILE_DEFAULT = 0x00, 348 - HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE = 0x01, 349 - }; 350 - 351 - enum hp_thermal_profile { 352 - HP_THERMAL_PROFILE_PERFORMANCE = 0x00, 353 - HP_THERMAL_PROFILE_DEFAULT = 0x01, 354 - HP_THERMAL_PROFILE_COOL = 0x02, 355 - HP_THERMAL_PROFILE_QUIET = 0x03, 356 232 }; 357 233 358 234 #define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW) ··· 1703 1651 1704 1652 static bool is_victus_s_thermal_profile(void) 1705 1653 { 1706 - const char *board_name; 1707 - 1708 - board_name = dmi_get_system_info(DMI_BOARD_NAME); 1709 - if (!board_name) 1710 - return false; 1711 - 1712 - return match_string(victus_s_thermal_profile_boards, 1713 - ARRAY_SIZE(victus_s_thermal_profile_boards), 1714 - board_name) >= 0; 1654 + /* Initialised in driver init, hence safe to use here */ 1655 + return is_victus_s_board; 1715 1656 } 1716 1657 1717 1658 static int victus_s_gpu_thermal_profile_get(bool *ctgp_enable, ··· 1787 1742 1788 1743 static int platform_profile_victus_s_set_ec(enum platform_profile_option profile) 1789 1744 { 1745 + struct thermal_profile_params *params; 1790 1746 bool gpu_ctgp_enable, gpu_ppab_enable; 1791 1747 u8 gpu_dstate; /* Test shows 1 = 100%, 2 = 50%, 3 = 25%, 4 = 12.5% */ 1792 1748 int err, tp; 1793 1749 1750 + params = active_thermal_profile_params; 1751 + if (!params) 1752 + return -ENODEV; 1753 + 1794 1754 switch (profile) { 1795 1755 case PLATFORM_PROFILE_PERFORMANCE: 1796 - tp = HP_VICTUS_S_THERMAL_PROFILE_PERFORMANCE; 1756 + tp = params->performance; 1797 1757 gpu_ctgp_enable = true; 1798 1758 gpu_ppab_enable = true; 1799 1759 gpu_dstate = 1; 1800 1760 break; 1801 1761 case PLATFORM_PROFILE_BALANCED: 1802 - tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT; 1762 + tp = params->balanced; 1803 1763 gpu_ctgp_enable = false; 1804 1764 gpu_ppab_enable = true; 1805 1765 gpu_dstate = 1; 1806 1766 break; 1807 1767 case PLATFORM_PROFILE_LOW_POWER: 1808 - tp = HP_VICTUS_S_THERMAL_PROFILE_DEFAULT; 1768 + tp = params->low_power; 1809 1769 gpu_ctgp_enable = false; 1810 1770 gpu_ppab_enable = false; 1811 1771 gpu_dstate = 1; ··· 2488 2438 return 0; 2489 2439 } 2490 2440 2441 + static void __init setup_active_thermal_profile_params(void) 2442 + { 2443 + const struct dmi_system_id *id; 2444 + 2445 + /* 2446 + * Currently only victus_s devices use the 2447 + * active_thermal_profile_params 2448 + */ 2449 + id = dmi_first_match(victus_s_thermal_profile_boards); 2450 + if (id) { 2451 + /* 2452 + * Marking this boolean is required to ensure that 2453 + * is_victus_s_thermal_profile() behaves like a valid 2454 + * wrapper. 2455 + */ 2456 + is_victus_s_board = true; 2457 + active_thermal_profile_params = id->driver_data; 2458 + } 2459 + } 2460 + 2491 2461 static int __init hp_wmi_init(void) 2492 2462 { 2493 2463 int event_capable = wmi_has_guid(HPWMI_EVENT_GUID); ··· 2535 2465 goto err_destroy_input; 2536 2466 } 2537 2467 2468 + /* 2469 + * Setup active board's thermal profile parameters before 2470 + * starting platform driver probe. 2471 + */ 2472 + setup_active_thermal_profile_params(); 2538 2473 err = platform_driver_probe(&hp_wmi_driver, hp_wmi_bios_setup); 2539 2474 if (err) 2540 2475 goto err_unregister_device;