public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Werner Sembach <wse@tuxedocomputers.com>
Cc: W_Armin@gmx.de, Hans de Goede <hansg@kernel.org>,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 6/6] platform/x86/uniwill: Set cTGP support based on EC for TUXEDO IBP Gen7 MK1
Date: Tue, 18 Nov 2025 12:43:02 +0200 (EET)	[thread overview]
Message-ID: <2872e563-8973-d501-764c-920c18afd58d@linux.intel.com> (raw)
In-Reply-To: <20251117132530.32460-7-wse@tuxedocomputers.com>

On Mon, 17 Nov 2025, Werner Sembach wrote:

> The TUXEDO InfinityBook 14 Gen7 shares a boardname between the variant with
> and without an NVIDIA GPU.
> 
> Dynamically read which variant is present from EC to determine cTGP
> support.
> 
> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> ---
>  drivers/platform/x86/uniwill/uniwill-acpi.c | 22 ++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
> index 15a94c256f728..f6b24d2c28b89 100644
> --- a/drivers/platform/x86/uniwill/uniwill-acpi.c
> +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
> @@ -88,6 +88,9 @@
>  
>  #define EC_ADDR_GPU_TEMP		0x044F
>  
> +#define EC_ADDR_SYSTEM_ID		0x0456
> +#define HAS_GPU				BIT(7)
> +
>  #define EC_ADDR_MAIN_FAN_RPM_1		0x0464
>  
>  #define EC_ADDR_MAIN_FAN_RPM_2		0x0465
> @@ -1406,6 +1409,23 @@ static int uniwill_ec_init(struct uniwill_data *data)
>  	return devm_add_action_or_reset(data->dev, uniwill_disable_manual_control, data);
>  }
>  
> +static int quirk_ibp_gen7_ctgp_supported(const struct dmi_system_id *d)
> +{
> +	struct uniwill_data *data = container_of(d, struct uniwill_data, id);
> +	unsigned int value;
> +	int ret;
> +
> +	ret = regmap_read(data->regmap, EC_ADDR_SYSTEM_ID, &value);
> +	if (ret < 0)
> +		return ret;
> +	if (value & HAS_GPU) {
> +		data->id.driver_data =
> +			(void *)((unsigned long)data->id.driver_data |
> +				 UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL);

Hi,

Mutating .driver_data like this is a no go. Please store information that 
isn't bound to the match properly, not with hacks like this.

There seems to be already struct uniwill_data where you can add things 
properly. If you want to use .driver_data as mutatable feature flags, you 
need to make a copy of it into a properly named variable (e.g. 
data->features). Then you can do
	data->features |= UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL;
here.

> +	}
> +	return 0;
> +}
> +
>  static const struct dmi_system_id uniwill_dmi_table[] = {
>  	{
>  		.ident = "XMG FUSION 15",
> @@ -1462,12 +1482,12 @@ static const struct dmi_system_id uniwill_dmi_table[] = {
>  		.driver_data = (void *)(UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL),
>  	},
>  	{
> +		.callback = quirk_ibp_gen7_ctgp_supported,
>  		.ident = "TUXEDO InfinityBook Pro 14/16 Gen7 Intel",
>  		.matches = {
>  			DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"),
>  			DMI_EXACT_MATCH(DMI_BOARD_NAME, "PHxARX1_PHxAQF1"),
>  		},
> -		.driver_data = (void *)(UNIWILL_FEATURE_NVIDIA_CTGP_CONTROL),

Please always order your series so you don't need to correct things you've 
just added.

-- 
 i.


  reply	other threads:[~2025-11-18 10:43 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 13:23 [PATCH 0/6] Start of Upstream Support for TUXEDO NB02 devices Werner Sembach
2025-11-17 13:23 ` [PATCH 1/6] platform/x86/uniwill: Add TUXEDO devices Werner Sembach
2025-11-18 11:03   ` Armin Wolf
2025-11-17 13:23 ` [PATCH 2/6] platform/x86/uniwill: Handle more WMI events required for " Werner Sembach
2025-11-18 11:08   ` Armin Wolf
2025-11-18 12:45     ` Werner Sembach
2025-11-18 13:12       ` Armin Wolf
2025-11-18 13:29         ` Werner Sembach
2025-11-18 13:48           ` Armin Wolf
2025-11-18 14:27             ` Werner Sembach
2025-11-18 14:41               ` Armin Wolf
2025-11-18 15:05                 ` Werner Sembach
2025-11-20  0:53                   ` Armin Wolf
2025-11-20 10:42                     ` Werner Sembach
2025-11-20 13:40                       ` Armin Wolf
2025-11-20 22:06                         ` Werner Sembach
2025-11-22 23:54                           ` Armin Wolf
2025-11-24 17:43                             ` Werner Sembach
2025-11-24 18:40                     ` Werner Sembach
2025-11-25  0:50                       ` Armin Wolf
2025-11-25 14:05                         ` Werner Sembach
2025-11-17 13:24 ` [PATCH 3/6] platform/x86/uniwill: Implement cTGP setting Werner Sembach
2025-11-18 11:12   ` Armin Wolf
2025-11-18 12:58     ` Werner Sembach
2025-11-18 13:29       ` Armin Wolf
2025-11-19 15:34         ` Werner Sembach
2025-11-20  1:16           ` Armin Wolf
2025-11-20 10:47             ` Werner Sembach
2025-11-17 13:24 ` [PATCH 4/6] platform/x86/uniwill: Make uniwill_dmi_table accessible in probe Werner Sembach
2025-11-18 11:16   ` Armin Wolf
2025-11-18 13:01     ` Werner Sembach
2025-11-18 13:35       ` Armin Wolf
2025-11-18 13:40         ` Werner Sembach
2025-11-17 13:24 ` [PATCH 5/6] platform/x86/uniwill: Run callbacks of uniwill_dmi_table Werner Sembach
2025-11-17 13:24 ` [PATCH 6/6] platform/x86/uniwill: Set cTGP support based on EC for TUXEDO IBP Gen7 MK1 Werner Sembach
2025-11-18 10:43   ` Ilpo Järvinen [this message]
2025-11-18 13:05     ` Werner Sembach
2025-11-18 11:31 ` [PATCH 0/6] Start of Upstream Support for TUXEDO NB02 devices Armin Wolf
2025-11-18 13:17   ` Werner Sembach
2025-11-18 13:42     ` Armin Wolf
2025-11-18 14:24       ` Werner Sembach
2025-11-18 13:42   ` Werner Sembach
2025-11-18 13:43     ` Armin Wolf

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=2872e563-8973-d501-764c-920c18afd58d@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=wse@tuxedocomputers.com \
    /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