Skip to content

Commit

Permalink
platform/x86: hp-wmi: Setting thermal profile fails with 0x06
Browse files Browse the repository at this point in the history
Error 0x06 (invalid command parameter) is reported by hp-wmi module
when reading the current thermal profile and then proceed to set it
back. The failing condition occurs in Linux NixOS after user
configures the thermal profile to ‘quiet mode’ in Windows.  Quiet Fan
Mode is supported in Windows but was not supported in hp-wmi module.

This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for
HP notebooks other than HP Omen series.  Quiet thermal profile is not
supported in HP Omen series notebooks.

Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>
Link: https://lore.kernel.org/r/20220912192603.4001-1-jorge.lopez2@hp.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Jorge Lopez authored and Hans de Goede committed Sep 19, 2022
1 parent 4b93c6e commit 00b1829
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion drivers/platform/x86/hp-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {
enum hp_thermal_profile {
HP_THERMAL_PROFILE_PERFORMANCE = 0x00,
HP_THERMAL_PROFILE_DEFAULT = 0x01,
HP_THERMAL_PROFILE_COOL = 0x02
HP_THERMAL_PROFILE_COOL = 0x02,
HP_THERMAL_PROFILE_QUIET = 0x03,
};

#define IS_HWBLOCKED(x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
Expand Down Expand Up @@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,
case HP_THERMAL_PROFILE_COOL:
*profile = PLATFORM_PROFILE_COOL;
break;
case HP_THERMAL_PROFILE_QUIET:
*profile = PLATFORM_PROFILE_QUIET;
break;
default:
return -EINVAL;
}
Expand All @@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,
case PLATFORM_PROFILE_COOL:
tp = HP_THERMAL_PROFILE_COOL;
break;
case PLATFORM_PROFILE_QUIET:
tp = HP_THERMAL_PROFILE_QUIET;
break;
default:
return -EOPNOTSUPP;
}
Expand Down Expand Up @@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void)

platform_profile_handler.profile_get = hp_wmi_platform_profile_get;
platform_profile_handler.profile_set = hp_wmi_platform_profile_set;

set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);
}

set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
Expand Down

0 comments on commit 00b1829

Please sign in to comment.