Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 633cefe3 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'for-upstream' of...

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



Johan Hedberg says:

====================
pull request: bluetooth-next 2017-08-18

Here's one more bluetooth-next pull request for the 4.14 kernel:

 - Multiple fixes for Broadcom controllers
 - Fixes to the bluecard HCI driver
 - New USB ID for Realtek RTL8723BE controller
 - Fix static analyzer warning with kfree

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

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 401481e0 01d5e44a
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
Broadcom Bluetooth Chips
---------------------

This documents the binding structure and common properties for serial
attached Broadcom devices.

Serial attached Broadcom devices shall be a child node of the host UART
device the slave device is attached to.

Required properties:

 - compatible: should contain one of the following:
   * "brcm,bcm43438-bt"

Optional properties:

 - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
 - shutdown-gpios: GPIO specifier, used to enable the BT module
 - device-wakeup-gpios: GPIO specifier, used to wakeup the controller
 - host-wakeup-gpios: GPIO specifier, used to wakeup the host processor
 - clocks: clock specifier if external clock provided to the controller
 - clock-names: should be "extclk"


Example:

&uart2 {
       pinctrl-names = "default";
       pinctrl-0 = <&uart2_pins>;

       bluetooth {
               compatible = "brcm,bcm43438-bt";
               max-speed = <921600>;
       };
};
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ config BT_HCIUART_INTEL
config BT_HCIUART_BCM
	bool "Broadcom protocol support"
	depends on BT_HCIUART
	depends on BT_HCIUART_SERDEV
	select BT_HCIUART_H4
	select BT_BCM
	help
+27 −31
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ static void bluecard_detach(struct pcmcia_device *p_dev);

/* Hardware states */
#define CARD_READY             1
#define CARD_ACTIVITY	       2
#define CARD_HAS_PCCARD_ID     4
#define CARD_HAS_POWER_LED     5
#define CARD_HAS_ACTIVITY_LED  6
@@ -160,16 +161,14 @@ static void bluecard_activity_led_timeout(u_long arg)
	struct bluecard_info *info = (struct bluecard_info *)arg;
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
		return;
	if (test_bit(CARD_ACTIVITY, &(info->hw_state))) {
		/* leave LED in inactive state for HZ/10 for blink effect */
		clear_bit(CARD_ACTIVITY, &(info->hw_state));
		mod_timer(&(info->timer), jiffies + HZ / 10);
	}

	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
		/* Disable activity LED */
	/* Disable activity LED, enable power LED */
	outb(0x08 | 0x20, iobase + 0x30);
	} else {
		/* Disable power LED */
		outb(0x00, iobase + 0x30);
	}
}


@@ -177,22 +176,22 @@ static void bluecard_enable_activity_led(struct bluecard_info *info)
{
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (!test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
	/* don't disturb running blink timer */
	if (timer_pending(&(info->timer)))
		return;

	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
		/* Enable activity LED */
		outb(0x10 | 0x40, iobase + 0x30);
	set_bit(CARD_ACTIVITY, &(info->hw_state));

		/* Stop the LED after HZ/4 */
		mod_timer(&(info->timer), jiffies + HZ / 4);
	if (test_bit(CARD_HAS_ACTIVITY_LED, &(info->hw_state))) {
		/* Enable activity LED, keep power LED enabled */
		outb(0x18 | 0x60, iobase + 0x30);
	} else {
		/* Enable power LED */
		outb(0x08 | 0x20, iobase + 0x30);

		/* Stop the LED after HZ/2 */
		mod_timer(&(info->timer), jiffies + HZ / 2);
		/* Disable power LED */
		outb(0x00, iobase + 0x30);
	}

	/* Stop the LED after HZ/10 */
	mod_timer(&(info->timer), jiffies + HZ / 10);
}


@@ -625,16 +624,13 @@ static int bluecard_hci_flush(struct hci_dev *hdev)
static int bluecard_hci_open(struct hci_dev *hdev)
{
	struct bluecard_info *info = hci_get_drvdata(hdev);
	unsigned int iobase = info->p_dev->resource[0]->start;

	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
		bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);

	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
		unsigned int iobase = info->p_dev->resource[0]->start;

		/* Enable LED */
	/* Enable power LED */
	outb(0x08 | 0x20, iobase + 0x30);
	}

	return 0;
}
@@ -643,15 +639,15 @@ static int bluecard_hci_open(struct hci_dev *hdev)
static int bluecard_hci_close(struct hci_dev *hdev)
{
	struct bluecard_info *info = hci_get_drvdata(hdev);
	unsigned int iobase = info->p_dev->resource[0]->start;

	bluecard_hci_flush(hdev);

	if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
		unsigned int iobase = info->p_dev->resource[0]->start;
	/* Stop LED timer */
	del_timer_sync(&(info->timer));

		/* Disable LED */
	/* Disable power LED */
	outb(0x00, iobase + 0x30);
	}

	return 0;
}
+39 −30
Original line number Diff line number Diff line
@@ -287,6 +287,37 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
	return skb;
}

static int btbcm_read_info(struct hci_dev *hdev)
{
	struct sk_buff *skb;

	/* Read Verbose Config Version Info */
	skb = btbcm_read_verbose_config(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
	kfree_skb(skb);

	/* Read Controller Features */
	skb = btbcm_read_controller_features(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
	kfree_skb(skb);

	/* Read Local Name */
	skb = btbcm_read_local_name(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));
	kfree_skb(skb);

	return 0;
}

static const struct {
	u16 subver;
	const char *name;
@@ -322,13 +353,10 @@ int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len)
	subver = le16_to_cpu(ver->lmp_subver);
	kfree_skb(skb);

	/* Read Verbose Config Version Info */
	skb = btbcm_read_verbose_config(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
	kfree_skb(skb);
	/* Read controller information */
	err = btbcm_read_info(hdev);
	if (err)
		return err;

	switch ((rev & 0xf000) >> 12) {
	case 0:
@@ -431,29 +459,10 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
	subver = le16_to_cpu(ver->lmp_subver);
	kfree_skb(skb);

	/* Read Verbose Config Version Info */
	skb = btbcm_read_verbose_config(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: BCM: chip id %u", hdev->name, skb->data[1]);
	kfree_skb(skb);

	/* Read Controller Features */
	skb = btbcm_read_controller_features(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: BCM: features 0x%2.2x", hdev->name, skb->data[1]);
	kfree_skb(skb);

	/* Read Local Name */
	skb = btbcm_read_local_name(hdev);
	if (IS_ERR(skb))
		return PTR_ERR(skb);

	BT_INFO("%s: %s", hdev->name, (char *)(skb->data + 1));
	kfree_skb(skb);
	/* Read controller information */
	err = btbcm_read_info(hdev);
	if (err)
		return err;

	switch ((rev & 0xf000) >> 12) {
	case 0:
+24 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ static struct usb_driver btusb_driver;
#define BTUSB_BCM2045		0x40000
#define BTUSB_IFNUM_2		0x80000
#define BTUSB_CW6622		0x100000
#define BTUSB_BCM_NO_PRODID	0x200000

static const struct usb_device_id btusb_table[] = {
	/* Generic Bluetooth USB device */
@@ -170,6 +171,10 @@ static const struct usb_device_id btusb_table[] = {
	{ USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01),
	  .driver_info = BTUSB_BCM_PATCHRAM },

	/* Broadcom devices with missing product id */
	{ USB_DEVICE_AND_INTERFACE_INFO(0x0000, 0x0000, 0xff, 0x01, 0x01),
	  .driver_info = BTUSB_BCM_PATCHRAM | BTUSB_BCM_NO_PRODID },

	/* Intel Bluetooth USB Bootloader (RAM module) */
	{ USB_DEVICE(0x8087, 0x0a5a),
	  .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
@@ -359,6 +364,7 @@ static const struct usb_device_id blacklist_table[] = {
	{ USB_DEVICE(0x13d3, 0x3410), .driver_info = BTUSB_REALTEK },
	{ USB_DEVICE(0x13d3, 0x3416), .driver_info = BTUSB_REALTEK },
	{ USB_DEVICE(0x13d3, 0x3459), .driver_info = BTUSB_REALTEK },
	{ USB_DEVICE(0x13d3, 0x3494), .driver_info = BTUSB_REALTEK },

	/* Additional Realtek 8821AE Bluetooth devices */
	{ USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
@@ -1082,6 +1088,10 @@ static int btusb_open(struct hci_dev *hdev)
	}

	data->intf->needs_remote_wakeup = 1;
	/* device specific wakeup source enabled and required for USB
	 * remote wakeup while host is suspended
	 */
	device_wakeup_enable(&data->udev->dev);

	if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
		goto done;
@@ -1145,6 +1155,7 @@ static int btusb_close(struct hci_dev *hdev)
		goto failed;

	data->intf->needs_remote_wakeup = 0;
	device_wakeup_disable(&data->udev->dev);
	usb_autopm_put_interface(data->intf);

failed:
@@ -2898,6 +2909,19 @@ static int btusb_probe(struct usb_interface *intf,
	if (id->driver_info == BTUSB_IGNORE)
		return -ENODEV;

	if (id->driver_info & BTUSB_BCM_NO_PRODID) {
		struct usb_device *udev = interface_to_usbdev(intf);

		/* For the broken Broadcom devices that show 0000:0000
		 * as USB vendor and product information, check that the
		 * manufacturer string identifies them as Broadcom based
		 * devices.
		 */
		if (!udev->manufacturer ||
		    strcmp(udev->manufacturer, "Broadcom Corp"))
			return -ENODEV;
	}

	if (id->driver_info & BTUSB_ATH3012) {
		struct usb_device *udev = interface_to_usbdev(intf);

Loading