[PATCH 4/6] platform/x86: msi-wmi-platform: Clean up devices

From: Derek J. Clark

Date: Mon Aug 03 2026 - 18:20:46 EST


The current driver has multiple minor mistakes. Fix them all in one
cleanup patch.

- Device names are inconsistent/incorrect for the quirk table
- Per the Windows DLL, PL2 must always be at least 1W higher than
PL1. Give PL1 and PL2 different minimum values.
- Copy buffer before write to ensure payload is sent instead of stale
data

Signed-off-by: Derek J. Clark <derekjohn.clark@xxxxxxxxx>
---
drivers/platform/x86/msi-wmi-platform.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/msi-wmi-platform.c b/drivers/platform/x86/msi-wmi-platform.c
index fdc2f6f4ca7e..35cd35fc6446 100644
--- a/drivers/platform/x86/msi-wmi-platform.c
+++ b/drivers/platform/x86/msi-wmi-platform.c
@@ -124,8 +124,9 @@ struct msi_wmi_platform_quirk {
bool charge_threshold; /* Charge threshold is supported */
bool dual_fans; /* For devices with two hwmon fans */
bool restore_curves; /* Restore factory curves on unload */
- int pl_min; /* Minimum PLx value */
+ int pl1_min; /* Minimum PL1 value */
int pl1_max; /* Maximum PL1 value */
+ int pl2_min; /* Minimum PL2 value */
int pl2_max; /* Maximum PL2 value */
};

@@ -229,8 +230,9 @@ static struct msi_wmi_platform_quirk quirk_gen1 = {
.charge_threshold = true,
.dual_fans = true,
.restore_curves = true,
- .pl_min = 8,
+ .pl1_min = 8,
.pl1_max = 43,
+ .pl2_min = 9,
.pl2_max = 45
};
static struct msi_wmi_platform_quirk quirk_gen2 = {
@@ -238,14 +240,15 @@ static struct msi_wmi_platform_quirk quirk_gen2 = {
.charge_threshold = true,
.dual_fans = true,
.restore_curves = true,
- .pl_min = 8,
+ .pl1_min = 8,
.pl1_max = 30,
+ .pl2_min = 9,
.pl2_max = 37
};

static const struct dmi_system_id msi_quirks[] = {
{
- .ident = "MSI Claw (gen 1)",
+ .ident = "MSI Claw A1M",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
DMI_MATCH(DMI_BOARD_NAME, "MS-1T41"),
@@ -253,7 +256,7 @@ static const struct dmi_system_id msi_quirks[] = {
.driver_data = &quirk_gen1,
},
{
- .ident = "MSI Claw AI+ 7",
+ .ident = "MSI Claw 7 AI+ A2VM",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
DMI_MATCH(DMI_BOARD_NAME, "MS-1T42"),
@@ -261,7 +264,7 @@ static const struct dmi_system_id msi_quirks[] = {
.driver_data = &quirk_gen2,
},
{
- .ident = "MSI Claw AI+ 8",
+ .ident = "MSI Claw 8 AI+ A2VM",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
DMI_MATCH(DMI_BOARD_NAME, "MS-1T52"),
@@ -1131,7 +1134,7 @@ static int msi_wmi_fw_attrs_init(struct msi_wmi_platform_data *data)

if (data->quirks->pl1_max) {
err = msi_fw_attr_init(data, MSI_ATTR_PPT_PL1_SPL,
- &fw_attr_type_int, data->quirks->pl_min,
+ &fw_attr_type_int, data->quirks->pl1_min,
data->quirks->pl1_max, &data_get_value,
&data_set_value);
if (err)
@@ -1140,7 +1143,7 @@ static int msi_wmi_fw_attrs_init(struct msi_wmi_platform_data *data)

if (data->quirks->pl2_max) {
err = msi_fw_attr_init(data, MSI_ATTR_PPT_PL2_SPPT,
- &fw_attr_type_int, data->quirks->pl_min,
+ &fw_attr_type_int, data->quirks->pl2_min,
data->quirks->pl2_max, &data_get_value,
&data_set_value);
if (err)
@@ -1259,6 +1262,7 @@ static ssize_t msi_wmi_platform_debugfs_write(struct file *fp, const char __user
return ret;

down_write(&data->buffer_lock);
+ memcpy(data->buffer, payload, data->length);
ret = msi_wmi_platform_query(data->data, data->method, data->buffer,
data->length);
up_write(&data->buffer_lock);
@@ -1266,10 +1270,6 @@ static ssize_t msi_wmi_platform_debugfs_write(struct file *fp, const char __user
if (ret < 0)
return ret;

- down_write(&data->buffer_lock);
- memcpy(data->buffer, payload, data->length);
- up_write(&data->buffer_lock);
-
return length;
}

--
2.55.0