diff mbox series

[v10,4/5] alienware-wmi: added force module parameters

Message ID 20241029135354.5937-2-kuurtb@gmail.com (mailing list archive)
State Changes Requested, archived
Headers show
Series Dell AWCC platform_profile support | expand

Commit Message

Kurt Borja Oct. 29, 2024, 1:53 p.m. UTC
Added force_platform_profile and force_gmode unsafe module parameters,
allowing users to force `thermal` and `gmode` quirks respectively.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
v10:
 - Introduced
---
 drivers/platform/x86/dell/alienware-wmi.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Armin Wolf Oct. 29, 2024, 11:13 p.m. UTC | #1
Am 29.10.24 um 14:53 schrieb Kurt Borja:

> Added force_platform_profile and force_gmode unsafe module parameters,
> allowing users to force `thermal` and `gmode` quirks respectively.
>
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> v10:
>   - Introduced
> ---
>   drivers/platform/x86/dell/alienware-wmi.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> index 1d62c2ce7..91f0e09d0 100644
> --- a/drivers/platform/x86/dell/alienware-wmi.c
> +++ b/drivers/platform/x86/dell/alienware-wmi.c
> @@ -42,6 +42,14 @@ MODULE_LICENSE("GPL");
>   MODULE_ALIAS("wmi:" LEGACY_CONTROL_GUID);
>   MODULE_ALIAS("wmi:" WMAX_CONTROL_GUID);
>
> +static bool force_platform_profile;
> +module_param_unsafe(force_platform_profile, bool, 0);
> +MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal profiles without checking if WMI thermal backend is available");
> +
> +static bool force_gmode;
> +module_param_unsafe(force_gmode, bool, 0);
> +MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is selected");
> +
>   enum INTERFACE_FLAGS {
>   	LEGACY,
>   	WMAX,
> @@ -1075,6 +1083,16 @@ static int __init alienware_wmi_init(void)
>   	if (quirks == NULL)
>   		quirks = &quirk_unknown;
>
> +	if (force_platform_profile)
> +		quirks->thermal = true;
> +
> +	if (force_gmode) {
> +		if (quirks->thermal)
> +			quirks->gmode = true;
> +		else
> +			pr_warn("alienware-wmi: force_gmode requieres platform profile support");

Please drop the "alienware-wmi:" prefix, it should get added automatically.

With that being fixed:

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> +	}
> +
>   	ret = platform_driver_register(&platform_driver);
>   	if (ret)
>   		goto fail_platform_driver;
Kurt Borja Oct. 30, 2024, 12:03 a.m. UTC | #2
On Wed, Oct 30, 2024 at 12:13:45AM +0100, Armin Wolf wrote:
> Am 29.10.24 um 14:53 schrieb Kurt Borja:
> 
> > Added force_platform_profile and force_gmode unsafe module parameters,
> > allowing users to force `thermal` and `gmode` quirks respectively.
> > 
> > Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> > ---
> > v10:
> >   - Introduced
> > ---
> >   drivers/platform/x86/dell/alienware-wmi.c | 18 ++++++++++++++++++
> >   1 file changed, 18 insertions(+)
> > 
> > diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
> > index 1d62c2ce7..91f0e09d0 100644
> > --- a/drivers/platform/x86/dell/alienware-wmi.c
> > +++ b/drivers/platform/x86/dell/alienware-wmi.c
> > @@ -42,6 +42,14 @@ MODULE_LICENSE("GPL");
> >   MODULE_ALIAS("wmi:" LEGACY_CONTROL_GUID);
> >   MODULE_ALIAS("wmi:" WMAX_CONTROL_GUID);
> > 
> > +static bool force_platform_profile;
> > +module_param_unsafe(force_platform_profile, bool, 0);
> > +MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal profiles without checking if WMI thermal backend is available");
> > +
> > +static bool force_gmode;
> > +module_param_unsafe(force_gmode, bool, 0);
> > +MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is selected");
> > +
> >   enum INTERFACE_FLAGS {
> >   	LEGACY,
> >   	WMAX,
> > @@ -1075,6 +1083,16 @@ static int __init alienware_wmi_init(void)
> >   	if (quirks == NULL)
> >   		quirks = &quirk_unknown;
> > 
> > +	if (force_platform_profile)
> > +		quirks->thermal = true;
> > +
> > +	if (force_gmode) {
> > +		if (quirks->thermal)
> > +			quirks->gmode = true;
> > +		else
> > +			pr_warn("alienware-wmi: force_gmode requieres platform profile support");
> 
> Please drop the "alienware-wmi:" prefix, it should get added automatically.

Right away.

> 
> With that being fixed:
> 
> Reviewed-by: Armin Wolf <W_Armin@gmx.de>

Thank you for your review!

Kurt

> 
> > +	}
> > +
> >   	ret = platform_driver_register(&platform_driver);
> >   	if (ret)
> >   		goto fail_platform_driver;
diff mbox series

Patch

diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index 1d62c2ce7..91f0e09d0 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -42,6 +42,14 @@  MODULE_LICENSE("GPL");
 MODULE_ALIAS("wmi:" LEGACY_CONTROL_GUID);
 MODULE_ALIAS("wmi:" WMAX_CONTROL_GUID);
 
+static bool force_platform_profile;
+module_param_unsafe(force_platform_profile, bool, 0);
+MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal profiles without checking if WMI thermal backend is available");
+
+static bool force_gmode;
+module_param_unsafe(force_gmode, bool, 0);
+MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is selected");
+
 enum INTERFACE_FLAGS {
 	LEGACY,
 	WMAX,
@@ -1075,6 +1083,16 @@  static int __init alienware_wmi_init(void)
 	if (quirks == NULL)
 		quirks = &quirk_unknown;
 
+	if (force_platform_profile)
+		quirks->thermal = true;
+
+	if (force_gmode) {
+		if (quirks->thermal)
+			quirks->gmode = true;
+		else
+			pr_warn("alienware-wmi: force_gmode requieres platform profile support");
+	}
+
 	ret = platform_driver_register(&platform_driver);
 	if (ret)
 		goto fail_platform_driver;