Skip to content

Commit

Permalink
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/bluetooth/bluetooth-next

Johan Hedberg says:

====================
pull request: bluetooth-next 2015-09-18

Here's the first bluetooth-next pull request for the 4.4 kernel:

 - ieee802154 cleanups & fixes
 - debugfs support for the at86rf230 driver
 - Support for quirky (seemingly counterfeit) CSR Bluetooth controllers
 - Power management and device config improvements for Intel controllers
 - Fix for devices with incorrect advertising data length
 - Fix for closing HCI user channel socket

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

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 21, 2015
2 parents a1ef48e + 6818375 commit 5dcd246
Show file tree
Hide file tree
Showing 31 changed files with 1,605 additions and 552 deletions.
8 changes: 4 additions & 4 deletions Documentation/networking/ieee802154.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Introduction
The IEEE 802.15.4 working group focuses on standardization of bottom
two layers: Medium Access Control (MAC) and Physical (PHY). And there
are mainly two options available for upper layers:
- ZigBee - proprietary protocol from ZigBee Alliance
- 6LowPAN - IPv6 networking over low rate personal area networks
- ZigBee - proprietary protocol from the ZigBee Alliance
- 6LoWPAN - IPv6 networking over low rate personal area networks

The Linux-ZigBee project goal is to provide complete implementation
of IEEE 802.15.4 and 6LoWPAN protocols. IEEE 802.15.4 is a stack
The linux-wpan project goal is to provide a complete implementation
of the IEEE 802.15.4 and 6LoWPAN protocols. IEEE 802.15.4 is a stack
of protocols for organizing Low-Rate Wireless Personal Area Networks.

The stack is composed of three main parts:
Expand Down
12 changes: 8 additions & 4 deletions drivers/bluetooth/bt3c_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,8 @@ static int bt3c_load_firmware(struct bt3c_info *info,
{
char *ptr = (char *) firmware;
char b[9];
unsigned int iobase, size, addr, fcs, tmp;
unsigned int iobase, tmp;
unsigned long size, addr, fcs;
int i, err = 0;

iobase = info->p_dev->resource[0]->start;
Expand All @@ -478,15 +479,18 @@ static int bt3c_load_firmware(struct bt3c_info *info,

memset(b, 0, sizeof(b));
memcpy(b, ptr + 2, 2);
size = simple_strtoul(b, NULL, 16);
if (kstrtoul(b, 16, &size) < 0)
return -EINVAL;

memset(b, 0, sizeof(b));
memcpy(b, ptr + 4, 8);
addr = simple_strtoul(b, NULL, 16);
if (kstrtoul(b, 16, &addr) < 0)
return -EINVAL;

memset(b, 0, sizeof(b));
memcpy(b, ptr + (size * 2) + 2, 2);
fcs = simple_strtoul(b, NULL, 16);
if (kstrtoul(b, 16, &fcs) < 0)
return -EINVAL;

memset(b, 0, sizeof(b));
for (tmp = 0, i = 0; i < size; i++) {
Expand Down
46 changes: 46 additions & 0 deletions drivers/bluetooth/btintel.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include <linux/module.h>
#include <linux/firmware.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
Expand Down Expand Up @@ -169,6 +170,51 @@ int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
}
EXPORT_SYMBOL_GPL(btintel_secure_send);

int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name)
{
const struct firmware *fw;
struct sk_buff *skb;
const u8 *fw_ptr;
int err;

err = request_firmware_direct(&fw, ddc_name, &hdev->dev);
if (err < 0) {
bt_dev_err(hdev, "Failed to load Intel DDC file %s (%d)",
ddc_name, err);
return err;
}

bt_dev_info(hdev, "Found Intel DDC parameters: %s", ddc_name);

fw_ptr = fw->data;

/* DDC file contains one or more DDC structure which has
* Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2).
*/
while (fw->size > fw_ptr - fw->data) {
u8 cmd_plen = fw_ptr[0] + sizeof(u8);

skb = __hci_cmd_sync(hdev, 0xfc8b, cmd_plen, fw_ptr,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
bt_dev_err(hdev, "Failed to send Intel_Write_DDC (%ld)",
PTR_ERR(skb));
release_firmware(fw);
return PTR_ERR(skb);
}

fw_ptr += cmd_plen;
kfree_skb(skb);
}

release_firmware(fw);

bt_dev_info(hdev, "Applying Intel DDC parameters completed");

return 0;
}
EXPORT_SYMBOL_GPL(btintel_load_ddc_config);

MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Bluetooth support for Intel devices ver " VERSION);
MODULE_VERSION(VERSION);
Expand Down
10 changes: 9 additions & 1 deletion drivers/bluetooth/btintel.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code);
void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
const void *param);
int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);

#else

Expand All @@ -95,7 +96,8 @@ static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
{
}

static void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver)
static inline void btintel_version_info(struct hci_dev *hdev,
struct intel_version *ver)
{
}

Expand All @@ -105,4 +107,10 @@ static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
return -EOPNOTSUPP;
}

static inline int btintel_load_ddc_config(struct hci_dev *hdev,
const char *ddc_name)
{
return -EOPNOTSUPP;
}

#endif
14 changes: 0 additions & 14 deletions drivers/bluetooth/btmrvl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,6 @@ static int btmrvl_tx_pkt(struct btmrvl_private *priv, struct sk_buff *skb)
return -EINVAL;
}

if (skb_headroom(skb) < BTM_HEADER_LEN) {
struct sk_buff *tmp = skb;

skb = skb_realloc_headroom(skb, BTM_HEADER_LEN);
if (!skb) {
BT_ERR("Tx Error: realloc_headroom failed %d",
BTM_HEADER_LEN);
skb = tmp;
return -EINVAL;
}

kfree_skb(tmp);
}

skb_push(skb, BTM_HEADER_LEN);

/* header type: byte[3]
Expand Down
51 changes: 19 additions & 32 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,20 @@ static void btusb_work(struct work_struct *work)
clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
usb_kill_anchored_urbs(&data->isoc_anchor);

/* When isochronous alternate setting needs to be
* changed, because SCO connection has been added
* or removed, a packet fragment may be left in the
* reassembling state. This could lead to wrongly
* assembled fragments.
*
* Clear outstanding fragment when selecting a new
* alternate setting.
*/
spin_lock(&data->rxlock);
kfree_skb(data->sco_skb);
data->sco_skb = NULL;
spin_unlock(&data->rxlock);

if (__set_isoc_interface(hdev, new_alts) < 0)
return;
}
Expand Down Expand Up @@ -1348,7 +1362,9 @@ static int btusb_setup_csr(struct hci_dev *hdev)

rp = (struct hci_rp_read_local_version *)skb->data;

if (le16_to_cpu(rp->manufacturer) != 10) {
/* Detect controllers which aren't real CSR ones. */
if (le16_to_cpu(rp->manufacturer) != 10 ||
le16_to_cpu(rp->lmp_subver) == 0x0c5c) {
/* Clear the reset quirk since this is not an actual
* early Bluetooth 1.1 device from CSR.
*/
Expand Down Expand Up @@ -2217,36 +2233,7 @@ static int btusb_setup_intel_new(struct hci_dev *hdev)
* The device can work without DDC parameters, so even if it fails
* to load the file, no need to fail the setup.
*/
err = request_firmware_direct(&fw, fwname, &hdev->dev);
if (err < 0)
return 0;

BT_INFO("%s: Found Intel DDC parameters: %s", hdev->name, fwname);

fw_ptr = fw->data;

/* DDC file contains one or more DDC structure which has
* Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2).
*/
while (fw->size > fw_ptr - fw->data) {
u8 cmd_plen = fw_ptr[0] + sizeof(u8);

skb = __hci_cmd_sync(hdev, 0xfc8b, cmd_plen, fw_ptr,
HCI_INIT_TIMEOUT);
if (IS_ERR(skb)) {
BT_ERR("%s: Failed to send Intel_Write_DDC (%ld)",
hdev->name, PTR_ERR(skb));
release_firmware(fw);
return PTR_ERR(skb);
}

fw_ptr += cmd_plen;
kfree_skb(skb);
}

release_firmware(fw);

BT_INFO("%s: Applying Intel DDC parameters completed", hdev->name);
btintel_load_ddc_config(hdev, fwname);

return 0;
}
Expand Down Expand Up @@ -2782,7 +2769,7 @@ static int btusb_probe(struct usb_interface *intf,
set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);

/* Fake CSR devices with broken commands */
if (bcdDevice <= 0x100)
if (bcdDevice <= 0x100 || bcdDevice == 0x134)
hdev->setup = btusb_setup_csr;

set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
Expand Down
Loading

0 comments on commit 5dcd246

Please sign in to comment.