xref: /linux/drivers/platform/x86/amd/pmf/pmf-quirks.c (revision 55d0969c451159cff86949b38c39171cab962069)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * AMD Platform Management Framework Driver Quirks
4  *
5  * Copyright (c) 2024, Advanced Micro Devices, Inc.
6  * All Rights Reserved.
7  *
8  * Author: Mario Limonciello <mario.limonciello@amd.com>
9  */
10 
11 #include <linux/dmi.h>
12 
13 #include "pmf.h"
14 
15 struct quirk_entry {
16 	u32 supported_func;
17 };
18 
19 static struct quirk_entry quirk_no_sps_bug = {
20 	.supported_func = 0x4003,
21 };
22 
23 static const struct dmi_system_id fwbug_list[] = {
24 	{
25 		.ident = "ROG Zephyrus G14",
26 		.matches = {
27 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
28 			DMI_MATCH(DMI_PRODUCT_NAME, "GA403U"),
29 		},
30 		.driver_data = &quirk_no_sps_bug,
31 	},
32 	{
33 		.ident = "ROG Ally X",
34 		.matches = {
35 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
36 			DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"),
37 		},
38 		.driver_data = &quirk_no_sps_bug,
39 	},
40 	{
41 		.ident = "ASUS TUF Gaming A14",
42 		.matches = {
43 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
44 			DMI_MATCH(DMI_PRODUCT_NAME, "FA401W"),
45 		},
46 		.driver_data = &quirk_no_sps_bug,
47 	},
48 	{}
49 };
50 
51 void amd_pmf_quirks_init(struct amd_pmf_dev *dev)
52 {
53 	const struct dmi_system_id *dmi_id;
54 	struct quirk_entry *quirks;
55 
56 	dmi_id = dmi_first_match(fwbug_list);
57 	if (!dmi_id)
58 		return;
59 
60 	quirks = dmi_id->driver_data;
61 	if (quirks->supported_func) {
62 		dev->supported_func = quirks->supported_func;
63 		pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n",
64 			dmi_id->ident);
65 	}
66 }
67