xref: /linux/drivers/platform/x86/amd/pmf/pmf-quirks.c (revision a3a02a52bcfcbcc4a637d4b68bf1bc391c9fad02)
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, "GA403UV"),
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 };
42 
43 void amd_pmf_quirks_init(struct amd_pmf_dev *dev)
44 {
45 	const struct dmi_system_id *dmi_id;
46 	struct quirk_entry *quirks;
47 
48 	dmi_id = dmi_first_match(fwbug_list);
49 	if (!dmi_id)
50 		return;
51 
52 	quirks = dmi_id->driver_data;
53 	if (quirks->supported_func) {
54 		dev->supported_func = quirks->supported_func;
55 		pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n",
56 			dmi_id->ident);
57 	}
58 }
59