linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kurt Borja <kuurtb@gmail.com>
To: platform-driver-x86@vger.kernel.org
Cc: ilpo.jarvinen@linux.intel.com, mario.limonciello@amd.com,
	w_armin@gmx.de, hdegoede@redhat.com,
	linux-kernel@vger.kernel.org, Dell.Client.Kernel@dell.com,
	Kurt Borja <kuurtb@gmail.com>
Subject: [PATCH 13/20] alienware-wmi: Split DMI table
Date: Sat, 21 Dec 2024 00:59:10 -0500	[thread overview]
Message-ID: <20241221055917.10555-14-kuurtb@gmail.com> (raw)
In-Reply-To: <20241221055917.10555-1-kuurtb@gmail.com>

Split thermal features into a new DMI table to support upcoming file
split.

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

diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c
index 0a0b72dc61ea..8ea08f5f8810 100644
--- a/drivers/platform/x86/dell/alienware-wmi.c
+++ b/drivers/platform/x86/dell/alienware-wmi.c
@@ -118,8 +118,6 @@ struct quirk_entry {
 	u8 hdmi_mux;
 	u8 amplifier;
 	u8 deepslp;
-	bool thermal;
-	bool gmode;
 };
 
 static struct quirk_entry *quirks;
@@ -130,8 +128,6 @@ static struct quirk_entry quirk_inspiron5675 = {
 	.hdmi_mux = 0,
 	.amplifier = 0,
 	.deepslp = 0,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_unknown = {
@@ -139,8 +135,6 @@ static struct quirk_entry quirk_unknown = {
 	.hdmi_mux = 0,
 	.amplifier = 0,
 	.deepslp = 0,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_x51_r1_r2 = {
@@ -148,8 +142,6 @@ static struct quirk_entry quirk_x51_r1_r2 = {
 	.hdmi_mux = 0,
 	.amplifier = 0,
 	.deepslp = 0,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_x51_r3 = {
@@ -157,8 +149,6 @@ static struct quirk_entry quirk_x51_r3 = {
 	.hdmi_mux = 0,
 	.amplifier = 1,
 	.deepslp = 0,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_asm100 = {
@@ -166,8 +156,6 @@ static struct quirk_entry quirk_asm100 = {
 	.hdmi_mux = 1,
 	.amplifier = 0,
 	.deepslp = 0,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_asm200 = {
@@ -175,8 +163,6 @@ static struct quirk_entry quirk_asm200 = {
 	.hdmi_mux = 1,
 	.amplifier = 0,
 	.deepslp = 1,
-	.thermal = false,
-	.gmode = false,
 };
 
 static struct quirk_entry quirk_asm201 = {
@@ -184,26 +170,6 @@ static struct quirk_entry quirk_asm201 = {
 	.hdmi_mux = 1,
 	.amplifier = 1,
 	.deepslp = 1,
-	.thermal = false,
-	.gmode = false,
-};
-
-static struct quirk_entry quirk_g_series = {
-	.num_zones = 2,
-	.hdmi_mux = 0,
-	.amplifier = 0,
-	.deepslp = 0,
-	.thermal = true,
-	.gmode = true,
-};
-
-static struct quirk_entry quirk_x_series = {
-	.num_zones = 2,
-	.hdmi_mux = 0,
-	.amplifier = 0,
-	.deepslp = 0,
-	.thermal = true,
-	.gmode = false,
 };
 
 static int __init dmi_matched(const struct dmi_system_id *dmi)
@@ -242,133 +208,140 @@ static const struct dmi_system_id alienware_quirks[] __initconst = {
 	},
 	{
 		.callback = dmi_matched,
-		.ident = "Alienware m17 R5",
+		.ident = "Alienware X51 R1",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
 		},
-		.driver_data = &quirk_x_series,
+		.driver_data = &quirk_x51_r1_r2,
 	},
 	{
 		.callback = dmi_matched,
-		.ident = "Alienware m18 R2",
+		.ident = "Alienware X51 R2",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
 		},
-		.driver_data = &quirk_x_series,
+		.driver_data = &quirk_x51_r1_r2,
 	},
 	{
 		.callback = dmi_matched,
-		.ident = "Alienware x15 R1",
+		.ident = "Alienware X51 R3",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
 		},
-		.driver_data = &quirk_x_series,
+		.driver_data = &quirk_x51_r3,
 	},
 	{
 		.callback = dmi_matched,
-		.ident = "Alienware x17 R2",
+		.ident = "Dell Inc. Inspiron 5675",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"),
+		},
+		.driver_data = &quirk_inspiron5675,
+	},
+	{}
+};
+
+struct awcc_features {
+	bool gmode;
+};
+
+static struct awcc_features g_series_features = {
+	.gmode = true,
+};
+
+static struct awcc_features x_series_features = {
+	.gmode = false,
+};
+
+static const struct dmi_system_id awcc_dmi_table[] __initconst = {
+	{
+		.ident = "Alienware m17 R5",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"),
 		},
-		.driver_data = &quirk_x_series,
+		.driver_data = &x_series_features,
 	},
 	{
-		.callback = dmi_matched,
-		.ident = "Alienware X51 R1",
+		.ident = "Alienware m18 R2",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"),
 		},
-		.driver_data = &quirk_x51_r1_r2,
+		.driver_data = &x_series_features,
 	},
 	{
-		.callback = dmi_matched,
-		.ident = "Alienware X51 R2",
+		.ident = "Alienware x15 R1",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"),
 		},
-		.driver_data = &quirk_x51_r1_r2,
+		.driver_data = &x_series_features,
 	},
 	{
-		.callback = dmi_matched,
-		.ident = "Alienware X51 R3",
+		.ident = "Alienware x17 R2",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Alienware"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"),
 		},
-		.driver_data = &quirk_x51_r3,
+		.driver_data = &x_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G15 5510",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"),
 		},
-		.driver_data = &quirk_g_series,
+		.driver_data = &g_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G15 5511",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"),
 		},
-		.driver_data = &quirk_g_series,
+		.driver_data = &g_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G15 5515",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"),
 		},
-		.driver_data = &quirk_g_series,
+		.driver_data = &g_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G3 3500",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"),
 		},
-		.driver_data = &quirk_g_series,
+		.driver_data = &g_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G3 3590",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"),
 		},
-		.driver_data = &quirk_g_series,
+		.driver_data = &g_series_features,
 	},
 	{
-		.callback = dmi_matched,
 		.ident = "Dell Inc. G5 5500",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"),
 		},
-		.driver_data = &quirk_g_series,
-	},
-	{
-		.callback = dmi_matched,
-		.ident = "Dell Inc. Inspiron 5675",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"),
-		},
-		.driver_data = &quirk_inspiron5675,
+		.driver_data = &g_series_features,
 	},
-	{}
 };
 
+struct awcc_features *awcc;
+
 struct color_platform {
 	u8 blue;
 	u8 green;
@@ -1009,7 +982,7 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
 
 	priv = container_of(pprof, struct awcc_priv, pp_handler);
 
-	if (quirks->gmode) {
+	if (awcc->gmode) {
 		u32 gmode_status;
 		int ret;
 
@@ -1077,7 +1050,7 @@ static int create_thermal_profile(struct wmi_device *wdev)
 	if (bitmap_empty(priv->pp_handler.choices, PLATFORM_PROFILE_LAST))
 		return -ENODEV;
 
-	if (quirks->gmode) {
+	if (awcc->gmode) {
 		priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] =
 			WMAX_THERMAL_MODE_GMODE;
 
@@ -1328,7 +1301,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
 	};
 	int ret = 0;
 
-	if (quirks->thermal)
+	if (awcc)
 		ret = alienware_awcc_setup(wdev);
 	else
 		ret = alienware_alienfx_setup(&pdata);
@@ -1338,7 +1311,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context)
 
 static void wmax_wmi_remove(struct wmi_device *wdev)
 {
-	if (quirks->thermal)
+	if (awcc)
 		alienware_awcc_exit(wdev);
 	else
 		alienware_alienfx_exit(wdev);
@@ -1362,6 +1335,18 @@ static struct wmi_driver alienware_wmax_wmi_driver = {
 
 static int __init alienware_wmax_wmi_init(void)
 {
+	const struct dmi_system_id *id;
+
+	id = dmi_first_match(awcc_dmi_table);
+	if (id)
+		awcc = id->driver_data;
+
+	if (force_platform_profile)
+		awcc = &x_series_features;
+
+	if (force_gmode)
+		awcc = &g_series_features;
+
 	return wmi_driver_register(&alienware_wmax_wmi_driver);
 }
 
@@ -1378,16 +1363,6 @@ 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("force_gmode requires platform profile support\n");
-	}
-
 	if (wmi_has_guid(WMAX_CONTROL_GUID)) {
 		interface = WMAX;
 		ret = alienware_wmax_wmi_init();
-- 
2.47.1


  parent reply	other threads:[~2024-12-21  6:00 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-21  5:58 [PATCH 00/20] alienware-wmi driver rework Kurt Borja
2024-12-21  5:58 ` [PATCH 01/20] alienware-wmi: Remove unnecessary check at module exit Kurt Borja
2024-12-27  0:32   ` Armin Wolf
2024-12-21  5:58 ` [PATCH 02/20] alienware-wmi: Move Lighting Control State Kurt Borja
2024-12-27  0:35   ` Armin Wolf
2024-12-27  4:32     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 03/20] alienware-wmi: Modify parse_rgb() signature Kurt Borja
2024-12-27  0:36   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 04/20] alienware-wmi: Improve hdmi_mux, amplifier and deepslp group creation Kurt Borja
2024-12-27  0:44   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 05/20] alienware-wmi: Improve rgb-zones " Kurt Borja
2024-12-27  1:04   ` Armin Wolf
2024-12-27  4:37     ` Kurt Borja
2024-12-29  0:17       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 06/20] alienware_wmi: Clean variable declaration in thermal methods Kurt Borja
2024-12-27  1:06   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 07/20] alienware-wmi: Add a state container for LED control feature Kurt Borja
2024-12-27  1:32   ` Armin Wolf
2024-12-27  4:39     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 08/20] alienware-wmi: Add WMI Drivers Kurt Borja
2024-12-27  3:21   ` Armin Wolf
2024-12-27  4:44     ` Kurt Borja
2024-12-27  4:48       ` Kurt Borja
2024-12-29  0:26       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 09/20] alienware-wmi: Add a state container for thermal control methods Kurt Borja
2024-12-27  3:26   ` Armin Wolf
2024-12-27  4:50     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 10/20] alienware-wmi: Refactor LED " Kurt Borja
2024-12-27  3:41   ` Armin Wolf
2024-12-27  4:52     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 11/20] alienware-wmi: Refactor hdmi, amplifier, deepslp methods Kurt Borja
2024-12-27  3:43   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 12/20] alienware-wmi: Refactor thermal control methods Kurt Borja
2024-12-27  3:45   ` Armin Wolf
2024-12-21  5:59 ` Kurt Borja [this message]
2024-12-27  3:55   ` [PATCH 13/20] alienware-wmi: Split DMI table Armin Wolf
2024-12-27  4:55     ` Kurt Borja
2024-12-29  0:30       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 14/20] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Kurt Borja
2024-12-27  3:56   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 15/20] platform/x86: Rename alienware-wmi.c Kurt Borja
2024-12-27  3:57   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 16/20] platform/x86: Add alienware-wmi.h Kurt Borja
2024-12-27  4:02   ` Armin Wolf
2024-12-27  4:56     ` Kurt Borja
2024-12-21  5:59 ` [PATCH 17/20] platform-x86: Split the alienware-wmi driver Kurt Borja
2024-12-27  4:04   ` Armin Wolf
2024-12-21  5:59 ` [PATCH 18/20] platform/x86: dell: Modify Makefile alignment Kurt Borja
2024-12-27  4:05   ` Armin Wolf
2024-12-27  4:57     ` Kurt Borja
2024-12-29  0:31       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 19/20] platform/x86: Update alienware-wmi config entries Kurt Borja
2024-12-27  4:08   ` Armin Wolf
2024-12-27  4:59     ` Kurt Borja
2024-12-29  0:32       ` Armin Wolf
2024-12-21  5:59 ` [PATCH 20/20] alienware-wmi: Update header and module information Kurt Borja
2024-12-27  4:08   ` Armin Wolf
2024-12-27  5:01     ` Kurt Borja
2024-12-22 23:06 ` [PATCH 00/20] alienware-wmi driver rework Armin Wolf
2024-12-25 20:25   ` Armin Wolf
2024-12-25 20:36     ` Kurt Borja

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=20241221055917.10555-14-kuurtb@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=w_armin@gmx.de \
    /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;
as well as URLs for NNTP newsgroup(s).