Skip to content

Commit 81fd6e8

Browse files
Antheas KapenekakisKyleGospo
authored andcommitted
[FROM-ML] platform/x86: msi-wmi-platform: Add quirk system
MSI uses the WMI interface as a passthrough for writes to the EC and uses a board name match and a quirk table from userspace on Windows. Therefore, there is no auto-detection functionality and we have to fallback to a quirk table. Introduce it here, prior to starting to add features to it. Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
1 parent 33b3809 commit 81fd6e8

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

drivers/platform/x86/msi-wmi-platform.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ enum msi_wmi_platform_method {
8080
MSI_PLATFORM_GET_WMI = 0x1d,
8181
};
8282

83+
struct msi_wmi_platform_quirk {
84+
};
85+
8386
struct msi_wmi_platform_data {
8487
struct wmi_device *wdev;
88+
struct msi_wmi_platform_quirk *quirks;
8589
struct mutex wmi_lock; /* Necessary when calling WMI methods */
8690
};
8791

@@ -125,6 +129,39 @@ static const char * const msi_wmi_platform_debugfs_names[] = {
125129
"get_wmi"
126130
};
127131

132+
static struct msi_wmi_platform_quirk quirk_default = {};
133+
static struct msi_wmi_platform_quirk quirk_gen1 = {
134+
};
135+
static struct msi_wmi_platform_quirk quirk_gen2 = {
136+
};
137+
138+
static const struct dmi_system_id msi_quirks[] = {
139+
{
140+
.ident = "MSI Claw (gen 1)",
141+
.matches = {
142+
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
143+
DMI_MATCH(DMI_BOARD_NAME, "MS-1T41"),
144+
},
145+
.driver_data = &quirk_gen1,
146+
},
147+
{
148+
.ident = "MSI Claw AI+ 7",
149+
.matches = {
150+
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
151+
DMI_MATCH(DMI_BOARD_NAME, "MS-1T42"),
152+
},
153+
.driver_data = &quirk_gen2,
154+
},
155+
{
156+
.ident = "MSI Claw AI+ 8",
157+
.matches = {
158+
DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International Co., Ltd."),
159+
DMI_MATCH(DMI_BOARD_NAME, "MS-1T52"),
160+
},
161+
.driver_data = &quirk_gen2,
162+
},
163+
};
164+
128165
static int msi_wmi_platform_parse_buffer(union acpi_object *obj, u8 *output, size_t length)
129166
{
130167
if (obj->type != ACPI_TYPE_BUFFER)
@@ -414,6 +451,7 @@ static int msi_wmi_platform_init(struct msi_wmi_platform_data *data)
414451
static int msi_wmi_platform_probe(struct wmi_device *wdev, const void *context)
415452
{
416453
struct msi_wmi_platform_data *data;
454+
const struct dmi_system_id *dmi_id;
417455
int ret;
418456

419457
data = devm_kzalloc(&wdev->dev, sizeof(*data), GFP_KERNEL);
@@ -423,6 +461,12 @@ static int msi_wmi_platform_probe(struct wmi_device *wdev, const void *context)
423461
data->wdev = wdev;
424462
dev_set_drvdata(&wdev->dev, data);
425463

464+
dmi_id = dmi_first_match(msi_quirks);
465+
if (dmi_id)
466+
data->quirks = dmi_id->driver_data;
467+
else
468+
data->quirks = &quirk_default;
469+
426470
ret = devm_mutex_init(&wdev->dev, &data->wmi_lock);
427471
if (ret < 0)
428472
return ret;

0 commit comments

Comments
 (0)