All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] hp-wmi: Setting thermal profile fails with 0x06
@ 2022-09-06 17:02 Jorge Lopez
  2022-09-09 18:01 ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Jorge Lopez @ 2022-09-06 17:02 UTC (permalink / raw)
  To: hdegoede, balalic.enver, platform-driver-x86, linux-kernel; +Cc: markgross

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>

---
Based on the latest platform-drivers-x86.git/for-next
---
 drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index bc7020e9df9e..f5c13df35af0 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -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)
@@ -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;
 	}
@@ -1216,6 +1220,10 @@ 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;
 	}
@@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
 	}
 
 	set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
+	set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);
 	set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
 	set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
 
-- 
2.34.1


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

* Re: [PATCH v1 1/1] hp-wmi: Setting thermal profile fails with 0x06
  2022-09-06 17:02 [PATCH v1 1/1] hp-wmi: Setting thermal profile fails with 0x06 Jorge Lopez
@ 2022-09-09 18:01 ` Hans de Goede
  2022-09-12 16:36   ` Jorge Lopez
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2022-09-09 18:01 UTC (permalink / raw)
  To: Jorge Lopez, balalic.enver, platform-driver-x86, linux-kernel; +Cc: markgross

Hi Jorge,

On 9/6/22 19:02, Jorge Lopez wrote:
> 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>

Thank you for looking into this!



> 
> ---
> Based on the latest platform-drivers-x86.git/for-next
> ---
>  drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index bc7020e9df9e..f5c13df35af0 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -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)
> @@ -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;
>  	}
> @@ -1216,6 +1220,10 @@ 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;
>  	}
> @@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
>  	}
>  
>  	set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
> +	set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);

In the commit msg you say that quiet profile is only supported on the non Omen
models, should this then not be inside the else branch of the:

if (is_omen_thermal_profile()) { ... } else { ... }

just above this code block ?

>  	set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
>  	set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
>  


Regards,

Hans


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

* Re: [PATCH v1 1/1] hp-wmi: Setting thermal profile fails with 0x06
  2022-09-09 18:01 ` Hans de Goede
@ 2022-09-12 16:36   ` Jorge Lopez
  0 siblings, 0 replies; 3+ messages in thread
From: Jorge Lopez @ 2022-09-12 16:36 UTC (permalink / raw)
  To: Hans de Goede; +Cc: balalic.enver, platform-driver-x86, linux-kernel, markgross

Hi Hans,

On Fri, Sep 9, 2022 at 1:01 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Jorge,
>
> On 9/6/22 19:02, Jorge Lopez wrote:
> > 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>
>
> Thank you for looking into this!
>
>
>
> >
> > ---
> > Based on the latest platform-drivers-x86.git/for-next
> > ---
> >  drivers/platform/x86/hp-wmi.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> > index bc7020e9df9e..f5c13df35af0 100644
> > --- a/drivers/platform/x86/hp-wmi.c
> > +++ b/drivers/platform/x86/hp-wmi.c
> > @@ -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)
> > @@ -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;
> >       }
> > @@ -1216,6 +1220,10 @@ 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;
> >       }
> > @@ -1266,6 +1274,7 @@ static int thermal_profile_setup(void)
> >       }
> >
> >       set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices);
> > +     set_bit(PLATFORM_PROFILE_QUIET, platform_profile_handler.choices);
>
> In the commit msg you say that quiet profile is only supported on the non Omen
> models, should this then not be inside the else branch of the:
>
> if (is_omen_thermal_profile()) { ... } else { ... }
>
> just above this code block ?
>
> >       set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices);
> >       set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices);
> >
You are correct.  I will submit a new patch shortly.

>
>
> Regards,
>
> Hans
>

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

end of thread, other threads:[~2022-09-12 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 17:02 [PATCH v1 1/1] hp-wmi: Setting thermal profile fails with 0x06 Jorge Lopez
2022-09-09 18:01 ` Hans de Goede
2022-09-12 16:36   ` Jorge Lopez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.