aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-04-06 03:52:12 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-04-07 12:48:21 -0400
commit4185a0f5d0431bf91ea1ec202fdf12e6e3b73c46 (patch)
tree1bfae670a935a3f1633b04b87133c9405d724e47
parent48f0ed1bb68589db5d6566bd3cd28ec675feaf2f (diff)
Bluetooth: btusb: Use generic Intel support for address support
The Bluetooth address handling for Intel devices is provided by a generic module now. Start using that module instead of relying it being included in the driver. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--drivers/bluetooth/Kconfig1
-rw-r--r--drivers/bluetooth/btusb.c79
2 files changed, 10 insertions, 70 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index e4aff8ca7870..b50fe3361659 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -12,6 +12,7 @@ config BT_BCM
12config BT_HCIBTUSB 12config BT_HCIBTUSB
13 tristate "HCI USB driver" 13 tristate "HCI USB driver"
14 depends on USB 14 depends on USB
15 select BT_INTEL
15 help 16 help
16 Bluetooth HCI USB driver. 17 Bluetooth HCI USB driver.
17 This driver is required if you want to use Bluetooth devices with 18 This driver is required if you want to use Bluetooth devices with
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8dae3daf821d..5798aec44824 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -28,6 +28,7 @@
28#include <net/bluetooth/bluetooth.h> 28#include <net/bluetooth/bluetooth.h>
29#include <net/bluetooth/hci_core.h> 29#include <net/bluetooth/hci_core.h>
30 30
31#include "btintel.h"
31#include "btbcm.h" 32#include "btbcm.h"
32 33
33#define VERSION "0.8" 34#define VERSION "0.8"
@@ -1533,51 +1534,6 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev,
1533 return 0; 1534 return 0;
1534} 1535}
1535 1536
1536#define BDADDR_INTEL (&(bdaddr_t) {{0x00, 0x8b, 0x9e, 0x19, 0x03, 0x00}})
1537
1538static int btusb_check_bdaddr_intel(struct hci_dev *hdev)
1539{
1540 struct sk_buff *skb;
1541 struct hci_rp_read_bd_addr *rp;
1542
1543 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
1544 HCI_INIT_TIMEOUT);
1545 if (IS_ERR(skb)) {
1546 BT_ERR("%s reading Intel device address failed (%ld)",
1547 hdev->name, PTR_ERR(skb));
1548 return PTR_ERR(skb);
1549 }
1550
1551 if (skb->len != sizeof(*rp)) {
1552 BT_ERR("%s Intel device address length mismatch", hdev->name);
1553 kfree_skb(skb);
1554 return -EIO;
1555 }
1556
1557 rp = (struct hci_rp_read_bd_addr *)skb->data;
1558 if (rp->status) {
1559 BT_ERR("%s Intel device address result failed (%02x)",
1560 hdev->name, rp->status);
1561 kfree_skb(skb);
1562 return -bt_to_errno(rp->status);
1563 }
1564
1565 /* For some Intel based controllers, the default Bluetooth device
1566 * address 00:03:19:9E:8B:00 can be found. These controllers are
1567 * fully operational, but have the danger of duplicate addresses
1568 * and that in turn can cause problems with Bluetooth operation.
1569 */
1570 if (!bacmp(&rp->bdaddr, BDADDR_INTEL)) {
1571 BT_ERR("%s found Intel default device address (%pMR)",
1572 hdev->name, &rp->bdaddr);
1573 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
1574 }
1575
1576 kfree_skb(skb);
1577
1578 return 0;
1579}
1580
1581static int btusb_setup_intel(struct hci_dev *hdev) 1537static int btusb_setup_intel(struct hci_dev *hdev)
1582{ 1538{
1583 struct sk_buff *skb; 1539 struct sk_buff *skb;
@@ -1650,7 +1606,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
1650 BT_INFO("%s: Intel device is already patched. patch num: %02x", 1606 BT_INFO("%s: Intel device is already patched. patch num: %02x",
1651 hdev->name, ver->fw_patch_num); 1607 hdev->name, ver->fw_patch_num);
1652 kfree_skb(skb); 1608 kfree_skb(skb);
1653 btusb_check_bdaddr_intel(hdev); 1609 btintel_check_bdaddr(hdev);
1654 return 0; 1610 return 0;
1655 } 1611 }
1656 1612
@@ -1663,7 +1619,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
1663 fw = btusb_setup_intel_get_fw(hdev, ver); 1619 fw = btusb_setup_intel_get_fw(hdev, ver);
1664 if (!fw) { 1620 if (!fw) {
1665 kfree_skb(skb); 1621 kfree_skb(skb);
1666 btusb_check_bdaddr_intel(hdev); 1622 btintel_check_bdaddr(hdev);
1667 return 0; 1623 return 0;
1668 } 1624 }
1669 fw_ptr = fw->data; 1625 fw_ptr = fw->data;
@@ -1744,7 +1700,7 @@ static int btusb_setup_intel(struct hci_dev *hdev)
1744 BT_INFO("%s: Intel Bluetooth firmware patch completed and activated", 1700 BT_INFO("%s: Intel Bluetooth firmware patch completed and activated",
1745 hdev->name); 1701 hdev->name);
1746 1702
1747 btusb_check_bdaddr_intel(hdev); 1703 btintel_check_bdaddr(hdev);
1748 return 0; 1704 return 0;
1749 1705
1750exit_mfg_disable: 1706exit_mfg_disable:
@@ -1760,7 +1716,7 @@ exit_mfg_disable:
1760 1716
1761 BT_INFO("%s: Intel Bluetooth firmware patch completed", hdev->name); 1717 BT_INFO("%s: Intel Bluetooth firmware patch completed", hdev->name);
1762 1718
1763 btusb_check_bdaddr_intel(hdev); 1719 btintel_check_bdaddr(hdev);
1764 return 0; 1720 return 0;
1765 1721
1766exit_mfg_deactivate: 1722exit_mfg_deactivate:
@@ -1781,7 +1737,7 @@ exit_mfg_deactivate:
1781 BT_INFO("%s: Intel Bluetooth firmware patch completed and deactivated", 1737 BT_INFO("%s: Intel Bluetooth firmware patch completed and deactivated",
1782 hdev->name); 1738 hdev->name);
1783 1739
1784 btusb_check_bdaddr_intel(hdev); 1740 btintel_check_bdaddr(hdev);
1785 return 0; 1741 return 0;
1786} 1742}
1787 1743
@@ -2057,7 +2013,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
2057 if (ver->fw_variant == 0x23) { 2013 if (ver->fw_variant == 0x23) {
2058 kfree_skb(skb); 2014 kfree_skb(skb);
2059 clear_bit(BTUSB_BOOTLOADER, &data->flags); 2015 clear_bit(BTUSB_BOOTLOADER, &data->flags);
2060 btusb_check_bdaddr_intel(hdev); 2016 btintel_check_bdaddr(hdev);
2061 return 0; 2017 return 0;
2062 } 2018 }
2063 2019
@@ -2341,23 +2297,6 @@ static void btusb_hw_error_intel(struct hci_dev *hdev, u8 code)
2341 kfree_skb(skb); 2297 kfree_skb(skb);
2342} 2298}
2343 2299
2344static int btusb_set_bdaddr_intel(struct hci_dev *hdev, const bdaddr_t *bdaddr)
2345{
2346 struct sk_buff *skb;
2347 long ret;
2348
2349 skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT);
2350 if (IS_ERR(skb)) {
2351 ret = PTR_ERR(skb);
2352 BT_ERR("%s: changing Intel device address failed (%ld)",
2353 hdev->name, ret);
2354 return ret;
2355 }
2356 kfree_skb(skb);
2357
2358 return 0;
2359}
2360
2361static int btusb_shutdown_intel(struct hci_dev *hdev) 2300static int btusb_shutdown_intel(struct hci_dev *hdev)
2362{ 2301{
2363 struct sk_buff *skb; 2302 struct sk_buff *skb;
@@ -2808,7 +2747,7 @@ static int btusb_probe(struct usb_interface *intf,
2808 if (id->driver_info & BTUSB_INTEL) { 2747 if (id->driver_info & BTUSB_INTEL) {
2809 hdev->setup = btusb_setup_intel; 2748 hdev->setup = btusb_setup_intel;
2810 hdev->shutdown = btusb_shutdown_intel; 2749 hdev->shutdown = btusb_shutdown_intel;
2811 hdev->set_bdaddr = btusb_set_bdaddr_intel; 2750 hdev->set_bdaddr = btintel_set_bdaddr;
2812 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); 2751 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
2813 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); 2752 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
2814 } 2753 }
@@ -2817,7 +2756,7 @@ static int btusb_probe(struct usb_interface *intf,
2817 hdev->send = btusb_send_frame_intel; 2756 hdev->send = btusb_send_frame_intel;
2818 hdev->setup = btusb_setup_intel_new; 2757 hdev->setup = btusb_setup_intel_new;
2819 hdev->hw_error = btusb_hw_error_intel; 2758 hdev->hw_error = btusb_hw_error_intel;
2820 hdev->set_bdaddr = btusb_set_bdaddr_intel; 2759 hdev->set_bdaddr = btintel_set_bdaddr;
2821 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); 2760 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
2822 } 2761 }
2823 2762