Bug 217020

Summary: hp-wmi: Unable to change platform profile: Operation not supported
Product: Drivers Reporter: Luis Bocanegra (luisbocanegra17b)
Component: Platform_x86Assignee: drivers_platform_x86 (drivers_platform_x86)
Status: NEW ---    
Severity: normal CC: jwrdegoede, luisbocanegra17b
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 6.2.0-rc7 Subsystem:
Regression: No Bisected commit-id:
Attachments: ACPI table

Description Luis Bocanegra 2023-02-11 03:51:28 UTC
Created attachment 303711 [details]
ACPI table

Hi,

I have a hp omen 15-dc1004la (board 8575, latest BIOS installed) and currently can't change the thermal profile, I get this error:

# echo cool > /sys/firmware/acpi/platform_profile
bash: echo: write error: Operation not supported

# cat /sys/firmware/acpi/platform_profile_choices 
cool balanced performance

# cat /sys/firmware/acpi/platform_profile
balanced

I see no errors in dmesg

I remember being able to change it before (could hear fans spin up/down) so I rebuilt older versions of the module (on top of mainline) and these are my findings:

From 4c51ba9af42dff0ef6a2ca3edcefa76f3466959e to be9d73e64957bbd31ee9a0d11adc0f720974c558 can change power profiles with the above command, but the value in /sys/firmware/acpi/platform_profile stays the same.

After 4b4967cbd2685f313411e6facf915fb2ae01d796 /sys/firmware/acpi/platform_profile_choices disappears, it comes back on dc6a6ab58379f25bf991d8e4a13b001ed806e881 but I get the Operation not supported error, same until HEAD(ce95010ef62d4bf470928969bafc9070ae98cbb1).

Attached a ACPI dump in case that's useful.

I'm not a developer so that's all the information I can give at the moment, but I'm open to provide more information if needed, also testing patches to debug/test this bug.
Comment 1 Luis Bocanegra 2023-04-14 03:42:54 UTC
So tried to debug this issue the best I could and these are my findings
omen_get_thermal_policy_version() (HPWMI_GET_SYSTEM_DESIGN_DATA) reads as 0x03, same as windows using ec-probe tool

Bypassing the return in omen_get_thermal_policy_version()
seems to allow platform_profile_omen_set() to change the power profile, at least with 
cool because I hear the fans spin up and then down when setting balanced, just like the gaming hub on windows

But omen_thermal_profile_get() (HP_OMEN_EC_THERMAL_PROFILE_OFFSET) always 
returns 0 making the sysfs entry always stay on balanced and breaking the funcionality of power-profiles-daemon

Here the logs of changing to cool then performance profiles

[Thu Apr 13 21:29:40 2023] hp_wmi: omen_thermal_profile_get > data = 0x0
[Thu Apr 13 21:29:42 2023] hp_wmi: platform_profile_omen_set > profile = 0x1
[Thu Apr 13 21:29:42 2023] hp_wmi: omen_get_thermal_policy_version > ret = 0x3
[Thu Apr 13 21:29:42 2023] hp_wmi: omen_get_thermal_policy_version > buffer[3] = 0x0 //bypassed
[Thu Apr 13 21:29:42 2023] hp_wmi: omen_thermal_profile_set 2 > ret = 0x0
[Thu Apr 13 21:29:43 2023] hp_wmi: omen_thermal_profile_get > data = 0x0
[Thu Apr 13 21:29:49 2023] hp_wmi: platform_profile_omen_set > profile = 0x5
[Thu Apr 13 21:29:49 2023] hp_wmi: omen_get_thermal_policy_version > ret = 0x3
[Thu Apr 13 21:29:49 2023] hp_wmi: omen_get_thermal_policy_version > buffer[3] = 0x0
[Thu Apr 13 21:29:49 2023] hp_wmi: omen_thermal_profile_set 1 > ret = 0x0
[Thu Apr 13 21:29:52 2023] hp_wmi: omen_thermal_profile_get > data = 0x0

Is this a very edge case bug or the controller somehow broken? Happy to provide more information/test patches as needed.
Comment 2 Luis Bocanegra 2023-04-14 10:09:19 UTC
Looking at the registers on windows the HP_OMEN_EC_THERMAL_PROFILE_OFFSET (0x95) doesn't change on windows when switching modes either, could it be that the gaming hub is doing something different or straight up ignoring the readings due to a bug in firmware?

Here is an updated log with more debug prints:

[Fri Apr 14 02:47:32 2023] hp_wmi: omen_thermal_profile_get > data = 0x0                            

[Fri Apr 14 02:48:24 2023] hp_wmi: platform_profile_omen_set > profile = 0x5                        ## write performance
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query commandtype=0x28 command=0x20008 size=0x8
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query actual_insize=0x80
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query > wmi_evaluate_method ret=0x0
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query > bios_return_code=0x3
[Fri Apr 14 02:48:24 2023] hp_wmi: omen_get_thermal_policy_version > ret = 0x3
[Fri Apr 14 02:48:24 2023] hp_wmi: omen_get_thermal_policy_version > buffer[3] = 0x0
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query commandtype=0x1a command=0x20008 size=0x2
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query actual_insize=0x80
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query > wmi_evaluate_method ret=0x0
[Fri Apr 14 02:48:24 2023] hp_wmi: hp_wmi_perform_query > bios_return_code=0x0
[Fri Apr 14 02:48:24 2023] hp_wmi: Ignore output data of zero size outsize=0x0
[Fri Apr 14 02:48:24 2023] hp_wmi: omen_thermal_profile_set 1 > ret = 0x0

[Fri Apr 14 02:48:50 2023] hp_wmi: omen_thermal_profile_get > data = 0x0                            

[Fri Apr 14 02:49:02 2023] hp_wmi: omen_thermal_profile_get > data = 0x0                            ## write cool
[Fri Apr 14 02:49:49 2023] hp_wmi: platform_profile_omen_set > profile = 0x1
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query commandtype=0x28 command=0x20008 size=0x8
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query actual_insize=0x80
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query > wmi_evaluate_method ret=0x0
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query > bios_return_code=0x3
[Fri Apr 14 02:49:49 2023] hp_wmi: omen_get_thermal_policy_version > ret = 0x3
[Fri Apr 14 02:49:49 2023] hp_wmi: omen_get_thermal_policy_version > buffer[3] = 0x0
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query commandtype=0x1a command=0x20008 size=0x2
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query actual_insize=0x80
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query > wmi_evaluate_method ret=0x0
[Fri Apr 14 02:49:49 2023] hp_wmi: hp_wmi_perform_query > bios_return_code=0x0
[Fri Apr 14 02:49:49 2023] hp_wmi: Ignore output data of zero size outsize=0x0
[Fri Apr 14 02:49:49 2023] hp_wmi: omen_thermal_profile_set 2 > ret = 0x0

[Fri Apr 14 02:50:00 2023] hp_wmi: omen_thermal_profile_get > data = 0x0