X86 platform drivers
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	lsanche@lyndeno.ca, hdegoede@redhat.com,
	ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, Patil.Reddy@amd.com,
	Yijun Shen <Yijun.Shen@Dell.com>
Subject: Re: [PATCH] platform/x86/dell: Set USTT mode according to BIOS after reboot
Date: Mon, 15 Sep 2025 14:00:08 -0500	[thread overview]
Message-ID: <9c25dc53-aff7-4ecb-b3cd-9ed9ed8cac23@kernel.org> (raw)
In-Reply-To: <20250915094154.2765361-1-Shyam-sundar.S-k@amd.com>

On 9/15/25 4:41 AM, Shyam Sundar S K wrote:
> After a reboot, if the user changes the thermal setting in the BIOS, the
> BIOS applies this change. However, the current `dell-pc` driver does not
> recognize the updated USTT value, resulting in inconsistent thermal
> profiles between Windows and Linux.
> 
> To ensure alignment with Windows behavior, the proposed change involves
> reading the current USTT setting during driver initialization and updating
> the dell-pc USTT profile accordingly whenever a change is detected.

No need to refer to "this change" or "proposed change" in a commit message.

> 
> Cc: Yijun Shen <Yijun.Shen@Dell.com>
> Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>   drivers/platform/x86/dell/dell-pc.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c
> index 48cc7511905a..22248cfe21c5 100644
> --- a/drivers/platform/x86/dell/dell-pc.c
> +++ b/drivers/platform/x86/dell/dell-pc.c
> @@ -228,6 +228,8 @@ static int thermal_platform_profile_get(struct device *dev,
>   
>   static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices)
>   {
> +	int current_mode;
> +
>   	if (supported_modes & DELL_QUIET)
>   		__set_bit(PLATFORM_PROFILE_QUIET, choices);
>   	if (supported_modes & DELL_COOL_BOTTOM)
> @@ -237,6 +239,28 @@ static int thermal_platform_profile_probe(void *drvdata, unsigned long *choices)
>   	if (supported_modes & DELL_PERFORMANCE)
>   		__set_bit(PLATFORM_PROFILE_PERFORMANCE, choices);
>   
> +	/* Read current thermal mode from the BIOS and set the mode explicitly */

It's got to do with extra ACPI actions that happen "by the act" of 
setting a profile, right?

I think it's worth explaining in more detail in the comment /why/ this 
helps so it doesn't get removed some day in the future as part of an 
optimization.

> +	current_mode = thermal_get_mode();
> +	if (current_mode < 0)
> +		return current_mode;
> +
> +	switch (current_mode) {
> +	case DELL_BALANCED:
> +		thermal_set_mode(DELL_BALANCED);
> +		break;
> +	case DELL_PERFORMANCE:
> +		thermal_set_mode(DELL_PERFORMANCE);
> +		break;
> +	case DELL_COOL_BOTTOM:
> +		thermal_set_mode(DELL_COOL_BOTTOM);
> +		break;
> +	case DELL_QUIET:
> +		thermal_set_mode(DELL_QUIET);
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +

Why even have the switch/case?  If thermal_get_mode() returns an invalid 
value you already will return current_mode.

IE I'd think it's as simple as:

/*
  * Make sure that ACPI is in sync with the profile set by USTT.
  */
current_mode = thermal_get_mode();
if (current_mode < 0)
	return current_mode;
thermal_set_mode(current_mode);

>   	return 0;
>   }
>   


  parent reply	other threads:[~2025-09-15 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  9:41 [PATCH] platform/x86/dell: Set USTT mode according to BIOS after reboot Shyam Sundar S K
2025-09-15 18:54 ` Lyndon Sanche
2025-09-16  9:58   ` Shyam Sundar S K
2025-09-15 19:00 ` Mario Limonciello [this message]
2025-09-16  9:59   ` Shyam Sundar S K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c25dc53-aff7-4ecb-b3cd-9ed9ed8cac23@kernel.org \
    --to=superm1@kernel.org \
    --cc=Patil.Reddy@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=Yijun.Shen@Dell.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lsanche@lyndeno.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox