]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.1.3/platform-x86-thinkpad_acpi-disable-bluetooth-for-some-machines.patch
drop queue-4.4/mm-vmstat-make-quiet_vmstat-lighter.patch
[thirdparty/kernel/stable-queue.git] / releases / 5.1.3 / platform-x86-thinkpad_acpi-disable-bluetooth-for-some-machines.patch
1 From f7db839fccf087664e5587966220821289b6a9cb Mon Sep 17 00:00:00 2001
2 From: Jiaxun Yang <jiaxun.yang@flygoat.com>
3 Date: Thu, 7 Mar 2019 17:37:16 +0800
4 Subject: platform/x86: thinkpad_acpi: Disable Bluetooth for some machines
5
6 From: Jiaxun Yang <jiaxun.yang@flygoat.com>
7
8 commit f7db839fccf087664e5587966220821289b6a9cb upstream.
9
10 Some AMD based ThinkPads have a firmware bug that calling
11 "GBDC" will cause Bluetooth on Intel wireless cards blocked.
12
13 Probe these models by DMI match and disable Bluetooth subdriver
14 if specified Intel wireless card exist.
15
16 Cc: stable <stable@vger.kernel.org> # 4.14+
17 Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
18 Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 drivers/platform/x86/thinkpad_acpi.c | 72 ++++++++++++++++++++++++++++++++++-
23 1 file changed, 70 insertions(+), 2 deletions(-)
24
25 --- a/drivers/platform/x86/thinkpad_acpi.c
26 +++ b/drivers/platform/x86/thinkpad_acpi.c
27 @@ -79,7 +79,7 @@
28 #include <linux/jiffies.h>
29 #include <linux/workqueue.h>
30 #include <linux/acpi.h>
31 -#include <linux/pci_ids.h>
32 +#include <linux/pci.h>
33 #include <linux/power_supply.h>
34 #include <sound/core.h>
35 #include <sound/control.h>
36 @@ -4501,6 +4501,74 @@ static void bluetooth_exit(void)
37 bluetooth_shutdown();
38 }
39
40 +static const struct dmi_system_id bt_fwbug_list[] __initconst = {
41 + {
42 + .ident = "ThinkPad E485",
43 + .matches = {
44 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
45 + DMI_MATCH(DMI_BOARD_NAME, "20KU"),
46 + },
47 + },
48 + {
49 + .ident = "ThinkPad E585",
50 + .matches = {
51 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
52 + DMI_MATCH(DMI_BOARD_NAME, "20KV"),
53 + },
54 + },
55 + {
56 + .ident = "ThinkPad A285 - 20MW",
57 + .matches = {
58 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
59 + DMI_MATCH(DMI_BOARD_NAME, "20MW"),
60 + },
61 + },
62 + {
63 + .ident = "ThinkPad A285 - 20MX",
64 + .matches = {
65 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
66 + DMI_MATCH(DMI_BOARD_NAME, "20MX"),
67 + },
68 + },
69 + {
70 + .ident = "ThinkPad A485 - 20MU",
71 + .matches = {
72 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
73 + DMI_MATCH(DMI_BOARD_NAME, "20MU"),
74 + },
75 + },
76 + {
77 + .ident = "ThinkPad A485 - 20MV",
78 + .matches = {
79 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
80 + DMI_MATCH(DMI_BOARD_NAME, "20MV"),
81 + },
82 + },
83 + {}
84 +};
85 +
86 +static const struct pci_device_id fwbug_cards_ids[] __initconst = {
87 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24F3) },
88 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x24FD) },
89 + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2526) },
90 + {}
91 +};
92 +
93 +
94 +static int __init have_bt_fwbug(void)
95 +{
96 + /*
97 + * Some AMD based ThinkPads have a firmware bug that calling
98 + * "GBDC" will cause bluetooth on Intel wireless cards blocked
99 + */
100 + if (dmi_check_system(bt_fwbug_list) && pci_dev_present(fwbug_cards_ids)) {
101 + vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,
102 + FW_BUG "disable bluetooth subdriver for Intel cards\n");
103 + return 1;
104 + } else
105 + return 0;
106 +}
107 +
108 static int __init bluetooth_init(struct ibm_init_struct *iibm)
109 {
110 int res;
111 @@ -4513,7 +4581,7 @@ static int __init bluetooth_init(struct
112
113 /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
114 G4x, R30, R31, R40e, R50e, T20-22, X20-21 */
115 - tp_features.bluetooth = hkey_handle &&
116 + tp_features.bluetooth = !have_bt_fwbug() && hkey_handle &&
117 acpi_evalf(hkey_handle, &status, "GBDC", "qd");
118
119 vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_RFKILL,