aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/Kconfig3
-rw-r--r--drivers/bluetooth/Makefile1
-rw-r--r--drivers/bluetooth/btintel.c101
-rw-r--r--drivers/bluetooth/btintel.h41
4 files changed, 146 insertions, 0 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
index 93351b91bbb4..e4aff8ca7870 100644
--- a/drivers/bluetooth/Kconfig
+++ b/drivers/bluetooth/Kconfig
@@ -2,6 +2,9 @@
2menu "Bluetooth device drivers" 2menu "Bluetooth device drivers"
3 depends on BT 3 depends on BT
4 4
5config BT_INTEL
6 tristate
7
5config BT_BCM 8config BT_BCM
6 tristate 9 tristate
7 select FW_LOADER 10 select FW_LOADER
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 51c98546fa03..dd0d9c40b999 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_BT_HCIBTUART) += btuart_cs.o
15obj-$(CONFIG_BT_HCIBTUSB) += btusb.o 15obj-$(CONFIG_BT_HCIBTUSB) += btusb.o
16obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o 16obj-$(CONFIG_BT_HCIBTSDIO) += btsdio.o
17 17
18obj-$(CONFIG_BT_INTEL) += btintel.o
18obj-$(CONFIG_BT_ATH3K) += ath3k.o 19obj-$(CONFIG_BT_ATH3K) += ath3k.o
19obj-$(CONFIG_BT_MRVL) += btmrvl.o 20obj-$(CONFIG_BT_MRVL) += btmrvl.o
20obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o 21obj-$(CONFIG_BT_MRVL_SDIO) += btmrvl_sdio.o
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
new file mode 100644
index 000000000000..2d43d4279b00
--- /dev/null
+++ b/drivers/bluetooth/btintel.c
@@ -0,0 +1,101 @@
1/*
2 *
3 * Bluetooth support for Intel devices
4 *
5 * Copyright (C) 2015 Intel Corporation
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/module.h>
25
26#include <net/bluetooth/bluetooth.h>
27#include <net/bluetooth/hci_core.h>
28
29#include "btintel.h"
30
31#define VERSION "0.1"
32
33#define BDADDR_INTEL (&(bdaddr_t) {{0x00, 0x8b, 0x9e, 0x19, 0x03, 0x00}})
34
35int btintel_check_bdaddr(struct hci_dev *hdev)
36{
37 struct hci_rp_read_bd_addr *bda;
38 struct sk_buff *skb;
39
40 skb = __hci_cmd_sync(hdev, HCI_OP_READ_BD_ADDR, 0, NULL,
41 HCI_INIT_TIMEOUT);
42 if (IS_ERR(skb)) {
43 int err = PTR_ERR(skb);
44 BT_ERR("%s: Reading Intel device address failed (%d)",
45 hdev->name, err);
46 return err;
47 }
48
49 if (skb->len != sizeof(*bda)) {
50 BT_ERR("%s: Intel device address length mismatch", hdev->name);
51 kfree_skb(skb);
52 return -EIO;
53 }
54
55 bda = (struct hci_rp_read_bd_addr *)skb->data;
56 if (bda->status) {
57 BT_ERR("%s: Intel device address result failed (%02x)",
58 hdev->name, bda->status);
59 kfree_skb(skb);
60 return -bt_to_errno(bda->status);
61 }
62
63 /* For some Intel based controllers, the default Bluetooth device
64 * address 00:03:19:9E:8B:00 can be found. These controllers are
65 * fully operational, but have the danger of duplicate addresses
66 * and that in turn can cause problems with Bluetooth operation.
67 */
68 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) {
69 BT_ERR("%s: Found Intel default device address (%pMR)",
70 hdev->name, &bda->bdaddr);
71 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks);
72 }
73
74 kfree_skb(skb);
75
76 return 0;
77}
78EXPORT_SYMBOL_GPL(btintel_check_bdaddr);
79
80int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
81{
82 struct sk_buff *skb;
83 int err;
84
85 skb = __hci_cmd_sync(hdev, 0xfc31, 6, bdaddr, HCI_INIT_TIMEOUT);
86 if (IS_ERR(skb)) {
87 err = PTR_ERR(skb);
88 BT_ERR("%s: Changing Intel device address failed (%d)",
89 hdev->name, err);
90 return err;
91 }
92 kfree_skb(skb);
93
94 return 0;
95}
96EXPORT_SYMBOL_GPL(btintel_set_bdaddr);
97
98MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
99MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
100MODULE_VERSION(VERSION);
101MODULE_LICENSE("GPL");
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
new file mode 100644
index 000000000000..20be247d2ff6
--- /dev/null
+++ b/drivers/bluetooth/btintel.h
@@ -0,0 +1,41 @@
1/*
2 *
3 * Bluetooth support for Intel devices
4 *
5 * Copyright (C) 2015 Intel Corporation
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#if IS_ENABLED(CONFIG_BT_INTEL)
25
26int btintel_check_bdaddr(struct hci_dev *hdev);
27int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
28
29#else
30
31static inline int btintel_check_bdaddr(struct hci_dev *hdev)
32{
33 return -EOPNOTSUPP;
34}
35
36static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
37{
38 return -EOPNOTSUPP;
39}
40
41#endif