瀏覽代碼

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth

Johan Hedberg says:

====================
pull request: bluetooth 2018-02-26

Here are a two Bluetooth driver fixes for the 4.16 kernel.

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller 7 年之前
父節點
當前提交
68b116a28f
共有 2 個文件被更改,包括 23 次插入9 次删除
  1. 19 6
      drivers/bluetooth/btusb.c
  2. 4 3
      drivers/bluetooth/hci_bcm.c

+ 19 - 6
drivers/bluetooth/btusb.c

@@ -21,6 +21,7 @@
  *
  *
  */
  */
 
 
+#include <linux/dmi.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/usb.h>
 #include <linux/usb.h>
 #include <linux/usb/quirks.h>
 #include <linux/usb/quirks.h>
@@ -379,6 +380,21 @@ static const struct usb_device_id blacklist_table[] = {
 	{ }	/* Terminating entry */
 	{ }	/* Terminating entry */
 };
 };
 
 
+/* The Bluetooth USB module build into some devices needs to be reset on resume,
+ * this is a problem with the platform (likely shutting off all power) not with
+ * the module itself. So we use a DMI list to match known broken platforms.
+ */
+static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
+	{
+		/* Lenovo Yoga 920 (QCA Rome device 0cf3:e300) */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 920"),
+		},
+	},
+	{}
+};
+
 #define BTUSB_MAX_ISOC_FRAMES	10
 #define BTUSB_MAX_ISOC_FRAMES	10
 
 
 #define BTUSB_INTR_RUNNING	0
 #define BTUSB_INTR_RUNNING	0
@@ -2945,6 +2961,9 @@ static int btusb_probe(struct usb_interface *intf,
 	hdev->send   = btusb_send_frame;
 	hdev->send   = btusb_send_frame;
 	hdev->notify = btusb_notify;
 	hdev->notify = btusb_notify;
 
 
+	if (dmi_check_system(btusb_needs_reset_resume_table))
+		interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
+
 #ifdef CONFIG_PM
 #ifdef CONFIG_PM
 	err = btusb_config_oob_wake(hdev);
 	err = btusb_config_oob_wake(hdev);
 	if (err)
 	if (err)
@@ -3031,12 +3050,6 @@ static int btusb_probe(struct usb_interface *intf,
 	if (id->driver_info & BTUSB_QCA_ROME) {
 	if (id->driver_info & BTUSB_QCA_ROME) {
 		data->setup_on_usb = btusb_setup_qca;
 		data->setup_on_usb = btusb_setup_qca;
 		hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
 		hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
-
-		/* QCA Rome devices lose their updated firmware over suspend,
-		 * but the USB hub doesn't notice any status change.
-		 * explicitly request a device reset on resume.
-		 */
-		interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
 	}
 	}
 
 
 #ifdef CONFIG_BT_HCIBTUSB_RTL
 #ifdef CONFIG_BT_HCIBTUSB_RTL

+ 4 - 3
drivers/bluetooth/hci_bcm.c

@@ -922,12 +922,13 @@ static int bcm_get_resources(struct bcm_device *dev)
 
 
 	dev->clk = devm_clk_get(dev->dev, NULL);
 	dev->clk = devm_clk_get(dev->dev, NULL);
 
 
-	dev->device_wakeup = devm_gpiod_get(dev->dev, "device-wakeup",
-					    GPIOD_OUT_LOW);
+	dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup",
+						     GPIOD_OUT_LOW);
 	if (IS_ERR(dev->device_wakeup))
 	if (IS_ERR(dev->device_wakeup))
 		return PTR_ERR(dev->device_wakeup);
 		return PTR_ERR(dev->device_wakeup);
 
 
-	dev->shutdown = devm_gpiod_get(dev->dev, "shutdown", GPIOD_OUT_LOW);
+	dev->shutdown = devm_gpiod_get_optional(dev->dev, "shutdown",
+						GPIOD_OUT_LOW);
 	if (IS_ERR(dev->shutdown))
 	if (IS_ERR(dev->shutdown))
 		return PTR_ERR(dev->shutdown);
 		return PTR_ERR(dev->shutdown);