Commit 943da25d95c7e8fd8c39dbf09e030f5da46f5d85

Authored by Marcel Holtmann
1 parent b914a250e7

Bluetooth: Add controller types for BR/EDR and 802.11 AMP

With the Bluetooth 3.0 specification and the introduction of alternate
MAC/PHY (AMP) support, it is required to differentiate between primary
BR/EDR controllers and 802.11 AMP controllers. So introduce a special
type inside HCI device for differentiation.

For now all AMP controllers will be treated as raw devices until an
AMP manager has been implemented.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

Showing 4 changed files with 30 additions and 1 deletions Side-by-side Diff

include/net/bluetooth/hci.h
... ... @@ -52,6 +52,10 @@
52 52 #define HCI_PCI 5
53 53 #define HCI_SDIO 6
54 54  
  55 +/* HCI controller types */
  56 +#define HCI_BREDR 0x00
  57 +#define HCI_80211 0x01
  58 +
55 59 /* HCI device quirks */
56 60 enum {
57 61 HCI_QUIRK_NO_RESET,
include/net/bluetooth/hci_core.h
... ... @@ -71,6 +71,7 @@
71 71 unsigned long flags;
72 72 __u16 id;
73 73 __u8 bus;
  74 + __u8 dev_type;
74 75 bdaddr_t bdaddr;
75 76 __u8 dev_name[248];
76 77 __u8 dev_class[3];
net/bluetooth/hci_core.c
... ... @@ -491,6 +491,10 @@
491 491 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
492 492 set_bit(HCI_RAW, &hdev->flags);
493 493  
  494 + /* Treat all non BR/EDR controllers as raw devices for now */
  495 + if (hdev->dev_type != HCI_BREDR)
  496 + set_bit(HCI_RAW, &hdev->flags);
  497 +
494 498 if (hdev->open(hdev)) {
495 499 ret = -EIO;
496 500 goto done;
... ... @@ -797,7 +801,7 @@
797 801  
798 802 strcpy(di.name, hdev->name);
799 803 di.bdaddr = hdev->bdaddr;
800   - di.type = hdev->bus;
  804 + di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
801 805 di.flags = hdev->flags;
802 806 di.pkt_type = hdev->pkt_type;
803 807 di.acl_mtu = hdev->acl_mtu;
net/bluetooth/hci_sysfs.c
... ... @@ -192,12 +192,30 @@
192 192 }
193 193 }
194 194  
  195 +static inline char *host_typetostr(int type)
  196 +{
  197 + switch (type) {
  198 + case HCI_BREDR:
  199 + return "BR/EDR";
  200 + case HCI_80211:
  201 + return "802.11";
  202 + default:
  203 + return "UNKNOWN";
  204 + }
  205 +}
  206 +
195 207 static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf)
196 208 {
197 209 struct hci_dev *hdev = dev_get_drvdata(dev);
198 210 return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
199 211 }
200 212  
  213 +static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
  214 +{
  215 + struct hci_dev *hdev = dev_get_drvdata(dev);
  216 + return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
  217 +}
  218 +
201 219 static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
202 220 {
203 221 struct hci_dev *hdev = dev_get_drvdata(dev);
... ... @@ -334,6 +352,7 @@
334 352 }
335 353  
336 354 static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL);
  355 +static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
337 356 static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
338 357 static DEVICE_ATTR(class, S_IRUGO, show_class, NULL);
339 358 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
... ... @@ -351,6 +370,7 @@
351 370  
352 371 static struct attribute *bt_host_attrs[] = {
353 372 &dev_attr_bus.attr,
  373 + &dev_attr_type.attr,
354 374 &dev_attr_name.attr,
355 375 &dev_attr_class.attr,
356 376 &dev_attr_address.attr,