Commit c25d7f32 authored by Mario Limonciello's avatar Mario Limonciello Committed by Hans de Goede

platform/x86: thinkpad_acpi: Convert btusb DMI list to quirks

DMI matching in thinkpad_acpi happens local to a function meaning
quirks can only match that function.

Future changes to thinkpad_acpi may need to quirk other code, so
change this to use a quirk infrastructure.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Tested-by: default avatarMark Pearson <markpearson@lenvo.com>
Link: https://lore.kernel.org/r/20220429030501.1909-2-mario.limonciello@amd.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent eb2fd9b4
...@@ -309,6 +309,15 @@ struct ibm_init_struct { ...@@ -309,6 +309,15 @@ struct ibm_init_struct {
struct ibm_struct *data; struct ibm_struct *data;
}; };
/* DMI Quirks */
struct quirk_entry {
bool btusb_bug;
};
static struct quirk_entry quirk_btusb_bug = {
.btusb_bug = true,
};
static struct { static struct {
u32 bluetooth:1; u32 bluetooth:1;
u32 hotkey:1; u32 hotkey:1;
...@@ -338,6 +347,7 @@ static struct { ...@@ -338,6 +347,7 @@ static struct {
u32 hotkey_poll_active:1; u32 hotkey_poll_active:1;
u32 has_adaptive_kbd:1; u32 has_adaptive_kbd:1;
u32 kbd_lang:1; u32 kbd_lang:1;
struct quirk_entry *quirks;
} tp_features; } tp_features;
static struct { static struct {
...@@ -4359,9 +4369,10 @@ static void bluetooth_exit(void) ...@@ -4359,9 +4369,10 @@ static void bluetooth_exit(void)
bluetooth_shutdown(); bluetooth_shutdown();
} }
static const struct dmi_system_id bt_fwbug_list[] __initconst = { static const struct dmi_system_id fwbug_list[] __initconst = {
{ {
.ident = "ThinkPad E485", .ident = "ThinkPad E485",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20KU"), DMI_MATCH(DMI_BOARD_NAME, "20KU"),
...@@ -4369,6 +4380,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { ...@@ -4369,6 +4380,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = {
}, },
{ {
.ident = "ThinkPad E585", .ident = "ThinkPad E585",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20KV"), DMI_MATCH(DMI_BOARD_NAME, "20KV"),
...@@ -4376,6 +4388,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { ...@@ -4376,6 +4388,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = {
}, },
{ {
.ident = "ThinkPad A285 - 20MW", .ident = "ThinkPad A285 - 20MW",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MW"), DMI_MATCH(DMI_BOARD_NAME, "20MW"),
...@@ -4383,6 +4396,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { ...@@ -4383,6 +4396,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = {
}, },
{ {
.ident = "ThinkPad A285 - 20MX", .ident = "ThinkPad A285 - 20MX",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MX"), DMI_MATCH(DMI_BOARD_NAME, "20MX"),
...@@ -4390,6 +4404,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { ...@@ -4390,6 +4404,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = {
}, },
{ {
.ident = "ThinkPad A485 - 20MU", .ident = "ThinkPad A485 - 20MU",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MU"), DMI_MATCH(DMI_BOARD_NAME, "20MU"),
...@@ -4397,6 +4412,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = { ...@@ -4397,6 +4412,7 @@ static const struct dmi_system_id bt_fwbug_list[] __initconst = {
}, },
{ {
.ident = "ThinkPad A485 - 20MV", .ident = "ThinkPad A485 - 20MV",
.driver_data = &quirk_btusb_bug,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_BOARD_NAME, "20MV"), DMI_MATCH(DMI_BOARD_NAME, "20MV"),
...@@ -4419,7 +4435,8 @@ static int __init have_bt_fwbug(void) ...@@ -4419,7 +4435,8 @@ static int __init have_bt_fwbug(void)
* Some AMD based ThinkPads have a firmware bug that calling * Some AMD based ThinkPads have a firmware bug that calling
* "GBDC" will cause bluetooth on Intel wireless cards blocked * "GBDC" will cause bluetooth on Intel wireless cards blocked
*/ */
if (dmi_check_system(bt_fwbug_list) && pci_dev_present(fwbug_cards_ids)) { if (tp_features.quirks && tp_features.quirks->btusb_bug &&
pci_dev_present(fwbug_cards_ids)) {
vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL, vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
FW_BUG "disable bluetooth subdriver for Intel cards\n"); FW_BUG "disable bluetooth subdriver for Intel cards\n");
return 1; return 1;
...@@ -11496,6 +11513,7 @@ static void thinkpad_acpi_module_exit(void) ...@@ -11496,6 +11513,7 @@ static void thinkpad_acpi_module_exit(void)
static int __init thinkpad_acpi_module_init(void) static int __init thinkpad_acpi_module_init(void)
{ {
const struct dmi_system_id *dmi_id;
int ret, i; int ret, i;
tpacpi_lifecycle = TPACPI_LIFE_INIT; tpacpi_lifecycle = TPACPI_LIFE_INIT;
...@@ -11535,6 +11553,10 @@ static int __init thinkpad_acpi_module_init(void) ...@@ -11535,6 +11553,10 @@ static int __init thinkpad_acpi_module_init(void)
return -ENODEV; return -ENODEV;
} }
dmi_id = dmi_first_match(fwbug_list);
if (dmi_id)
tp_features.quirks = dmi_id->driver_data;
/* Device initialization */ /* Device initialization */
tpacpi_pdev = platform_device_register_simple(TPACPI_DRVR_NAME, -1, tpacpi_pdev = platform_device_register_simple(TPACPI_DRVR_NAME, -1,
NULL, 0); NULL, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment