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-10-08

Here's another set of Bluetooth & 802.15.4 patches for the 4.4 kernel.

802.15.4:
 - Many improvements & fixes to the mrf24j40 driver
 - Fixes and cleanups to nl802154, mac802154 & ieee802154 code

Bluetooth:
 - New chipset support in btmrvl driver
 - Fixes & cleanups to btbcm, btmrvl, bpa10x & btintel drivers
 - Support for vendor specific diagnostic data through common API
 - Cleanups to the 6lowpan code
 - New events & message types for monitor channel

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 Oct 11, 2015
2 parents 8fae307 + f640ee9 commit 7bcfeea
Show file tree
Hide file tree
Showing 60 changed files with 4,079 additions and 1,201 deletions.
20 changes: 20 additions & 0 deletions Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* MRF24J40 IEEE 802.15.4 *

Required properties:
- compatible: should be "microchip,mrf24j40", "microchip,mrf24j40ma",
or "microchip,mrf24j40mc" depends on your transceiver
board
- spi-max-frequency: maximal bus speed, should be set something under or equal
10000000
- reg: the chipselect index
- interrupts: the interrupt generated by the device.

Example:

mrf24j40ma@0 {
compatible = "microchip,mrf24j40ma";
spi-max-frequency = <8500000>;
reg = <0>;
interrupts = <19 8>;
interrupt-parent = <&gpio3>;
};
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -6978,6 +6978,7 @@ M: Alan Ott <alan@signal11.us>
L: linux-wpan@vger.kernel.org
S: Maintained
F: drivers/net/ieee802154/mrf24j40.c
F: Documentation/devicetree/bindings/net/ieee802154/mrf24j40.txt

MSI LAPTOP SUPPORT
M: "Lee, Chun-Yi" <jlee@suse.com>
Expand Down
6 changes: 4 additions & 2 deletions drivers/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ menu "Bluetooth device drivers"

config BT_INTEL
tristate
select REGMAP

config BT_BCM
tristate
Expand Down Expand Up @@ -183,6 +184,7 @@ config BT_HCIBCM203X
config BT_HCIBPA10X
tristate "HCI BPA10x USB driver"
depends on USB
select BT_HCIUART_H4
help
Bluetooth HCI BPA10x USB driver.
This driver provides support for the Digianswer BPA 100/105 Bluetooth
Expand Down Expand Up @@ -275,7 +277,7 @@ config BT_MRVL
The core driver to support Marvell Bluetooth devices.

This driver is required if you want to support
Marvell Bluetooth devices, such as 8688/8787/8797/8887/8897.
Marvell Bluetooth devices, such as 8688/8787/8797/8887/8897/8997.

Say Y here to compile Marvell Bluetooth driver
into the kernel or say M to compile it as module.
Expand All @@ -289,7 +291,7 @@ config BT_MRVL_SDIO
The driver for Marvell Bluetooth chipsets with SDIO interface.

This driver is required if you want to use Marvell Bluetooth
devices with SDIO interface. Currently SD8688/SD8787/SD8797/SD8887/SD8897
devices with SDIO interface. Currently SD8688/SD8787/SD8797/SD8887/SD8897/SD8997
chipsets are supported.

Say Y here to compile support for Marvell BT-over-SDIO driver
Expand Down
11 changes: 0 additions & 11 deletions drivers/bluetooth/bfusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,12 @@ static int bfusb_open(struct hci_dev *hdev)

BT_DBG("hdev %p bfusb %p", hdev, data);

if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
return 0;

write_lock_irqsave(&data->lock, flags);

err = bfusb_rx_submit(data, NULL);
if (!err) {
for (i = 1; i < BFUSB_MAX_BULK_RX; i++)
bfusb_rx_submit(data, NULL);
} else {
clear_bit(HCI_RUNNING, &hdev->flags);
}

write_unlock_irqrestore(&data->lock, flags);
Expand All @@ -458,9 +453,6 @@ static int bfusb_close(struct hci_dev *hdev)

BT_DBG("hdev %p bfusb %p", hdev, data);

if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
return 0;

write_lock_irqsave(&data->lock, flags);
write_unlock_irqrestore(&data->lock, flags);

Expand All @@ -479,9 +471,6 @@ static int bfusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)

BT_DBG("hdev %p skb %p type %d len %d", hdev, skb, bt_cb(skb)->pkt_type, skb->len);

if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;

switch (bt_cb(skb)->pkt_type) {
case HCI_COMMAND_PKT:
hdev->stat.cmd_tx++;
Expand Down
8 changes: 1 addition & 7 deletions drivers/bluetooth/bluecard_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ static void bluecard_receive(struct bluecard_info *info,
for (i = 0; i < len; i++) {

/* Allocate packet */
if (info->rx_skb == NULL) {
if (!info->rx_skb) {
info->rx_state = RECV_WAIT_PACKET_TYPE;
info->rx_count = 0;
info->rx_skb = bt_skb_alloc(HCI_MAX_FRAME_SIZE, GFP_ATOMIC);
Expand Down Expand Up @@ -628,9 +628,6 @@ static int bluecard_hci_open(struct hci_dev *hdev)
if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state)))
bluecard_hci_set_baud_rate(hdev, DEFAULT_BAUD_RATE);

if (test_and_set_bit(HCI_RUNNING, &(hdev->flags)))
return 0;

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

Expand All @@ -646,9 +643,6 @@ static int bluecard_hci_close(struct hci_dev *hdev)
{
struct bluecard_info *info = hci_get_drvdata(hdev);

if (!test_and_clear_bit(HCI_RUNNING, &(hdev->flags)))
return 0;

bluecard_hci_flush(hdev);

if (test_bit(CARD_HAS_PCCARD_ID, &(info->hw_state))) {
Expand Down
186 changes: 66 additions & 120 deletions drivers/bluetooth/bpa10x.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>

#define VERSION "0.10"
#include "hci_uart.h"

#define VERSION "0.11"

static const struct usb_device_id bpa10x_table[] = {
/* Tektronix BPA 100/105 (Digianswer) */
Expand All @@ -56,112 +58,6 @@ struct bpa10x_data {
struct sk_buff *rx_skb[2];
};

#define HCI_VENDOR_HDR_SIZE 5

struct hci_vendor_hdr {
__u8 type;
__le16 snum;
__le16 dlen;
} __packed;

static int bpa10x_recv(struct hci_dev *hdev, int queue, void *buf, int count)
{
struct bpa10x_data *data = hci_get_drvdata(hdev);

BT_DBG("%s queue %d buffer %p count %d", hdev->name,
queue, buf, count);

if (queue < 0 || queue > 1)
return -EILSEQ;

hdev->stat.byte_rx += count;

while (count) {
struct sk_buff *skb = data->rx_skb[queue];
struct { __u8 type; int expect; } *scb;
int type, len = 0;

if (!skb) {
/* Start of the frame */

type = *((__u8 *) buf);
count--; buf++;

switch (type) {
case HCI_EVENT_PKT:
if (count >= HCI_EVENT_HDR_SIZE) {
struct hci_event_hdr *h = buf;
len = HCI_EVENT_HDR_SIZE + h->plen;
} else
return -EILSEQ;
break;

case HCI_ACLDATA_PKT:
if (count >= HCI_ACL_HDR_SIZE) {
struct hci_acl_hdr *h = buf;
len = HCI_ACL_HDR_SIZE +
__le16_to_cpu(h->dlen);
} else
return -EILSEQ;
break;

case HCI_SCODATA_PKT:
if (count >= HCI_SCO_HDR_SIZE) {
struct hci_sco_hdr *h = buf;
len = HCI_SCO_HDR_SIZE + h->dlen;
} else
return -EILSEQ;
break;

case HCI_VENDOR_PKT:
if (count >= HCI_VENDOR_HDR_SIZE) {
struct hci_vendor_hdr *h = buf;
len = HCI_VENDOR_HDR_SIZE +
__le16_to_cpu(h->dlen);
} else
return -EILSEQ;
break;
}

skb = bt_skb_alloc(len, GFP_ATOMIC);
if (!skb) {
BT_ERR("%s no memory for packet", hdev->name);
return -ENOMEM;
}

data->rx_skb[queue] = skb;

scb = (void *) skb->cb;
scb->type = type;
scb->expect = len;
} else {
/* Continuation */

scb = (void *) skb->cb;
len = scb->expect;
}

len = min(len, count);

memcpy(skb_put(skb, len), buf, len);

scb->expect -= len;

if (scb->expect == 0) {
/* Complete frame */

data->rx_skb[queue] = NULL;

bt_cb(skb)->pkt_type = scb->type;
hci_recv_frame(hdev, skb);
}

count -= len; buf += len;
}

return 0;
}

static void bpa10x_tx_complete(struct urb *urb)
{
struct sk_buff *skb = urb->context;
Expand All @@ -184,6 +80,22 @@ static void bpa10x_tx_complete(struct urb *urb)
kfree_skb(skb);
}

#define HCI_VENDOR_HDR_SIZE 5

#define HCI_RECV_VENDOR \
.type = HCI_VENDOR_PKT, \
.hlen = HCI_VENDOR_HDR_SIZE, \
.loff = 3, \
.lsize = 2, \
.maxlen = HCI_MAX_FRAME_SIZE

static const struct h4_recv_pkt bpa10x_recv_pkts[] = {
{ H4_RECV_ACL, .recv = hci_recv_frame },
{ H4_RECV_SCO, .recv = hci_recv_frame },
{ H4_RECV_EVENT, .recv = hci_recv_frame },
{ HCI_RECV_VENDOR, .recv = hci_recv_diag },
};

static void bpa10x_rx_complete(struct urb *urb)
{
struct hci_dev *hdev = urb->context;
Expand All @@ -197,11 +109,17 @@ static void bpa10x_rx_complete(struct urb *urb)
return;

if (urb->status == 0) {
if (bpa10x_recv(hdev, usb_pipebulk(urb->pipe),
bool idx = usb_pipebulk(urb->pipe);

data->rx_skb[idx] = h4_recv_buf(hdev, data->rx_skb[idx],
urb->transfer_buffer,
urb->actual_length) < 0) {
urb->actual_length,
bpa10x_recv_pkts,
ARRAY_SIZE(bpa10x_recv_pkts));
if (IS_ERR(data->rx_skb[idx])) {
BT_ERR("%s corrupted event packet", hdev->name);
hdev->stat.err_rx++;
data->rx_skb[idx] = NULL;
}
}

Expand Down Expand Up @@ -304,9 +222,6 @@ static int bpa10x_open(struct hci_dev *hdev)

BT_DBG("%s", hdev->name);

if (test_and_set_bit(HCI_RUNNING, &hdev->flags))
return 0;

err = bpa10x_submit_intr_urb(hdev);
if (err < 0)
goto error;
Expand All @@ -320,8 +235,6 @@ static int bpa10x_open(struct hci_dev *hdev)
error:
usb_kill_anchored_urbs(&data->rx_anchor);

clear_bit(HCI_RUNNING, &hdev->flags);

return err;
}

Expand All @@ -331,9 +244,6 @@ static int bpa10x_close(struct hci_dev *hdev)

BT_DBG("%s", hdev->name);

if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
return 0;

usb_kill_anchored_urbs(&data->rx_anchor);

return 0;
Expand All @@ -350,6 +260,24 @@ static int bpa10x_flush(struct hci_dev *hdev)
return 0;
}

static int bpa10x_setup(struct hci_dev *hdev)
{
const u8 req[] = { 0x07 };
struct sk_buff *skb;

BT_DBG("%s", hdev->name);

/* Read revision string */
skb = __hci_cmd_sync(hdev, 0xfc0e, sizeof(req), req, HCI_INIT_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);

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

kfree_skb(skb);
return 0;
}

static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
struct bpa10x_data *data = hci_get_drvdata(hdev);
Expand All @@ -360,9 +288,6 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)

BT_DBG("%s", hdev->name);

if (!test_bit(HCI_RUNNING, &hdev->flags))
return -EBUSY;

skb->dev = (void *) hdev;

urb = usb_alloc_urb(0, GFP_ATOMIC);
Expand Down Expand Up @@ -431,6 +356,25 @@ static int bpa10x_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return 0;
}

static int bpa10x_set_diag(struct hci_dev *hdev, bool enable)
{
const u8 req[] = { 0x00, enable };
struct sk_buff *skb;

BT_DBG("%s", hdev->name);

if (!test_bit(HCI_RUNNING, &hdev->flags))
return -ENETDOWN;

/* Enable sniffer operation */
skb = __hci_cmd_sync(hdev, 0xfc0e, sizeof(req), req, HCI_INIT_TIMEOUT);
if (IS_ERR(skb))
return PTR_ERR(skb);

kfree_skb(skb);
return 0;
}

static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct bpa10x_data *data;
Expand Down Expand Up @@ -465,7 +409,9 @@ static int bpa10x_probe(struct usb_interface *intf, const struct usb_device_id *
hdev->open = bpa10x_open;
hdev->close = bpa10x_close;
hdev->flush = bpa10x_flush;
hdev->setup = bpa10x_setup;
hdev->send = bpa10x_send_frame;
hdev->set_diag = bpa10x_set_diag;

set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);

Expand Down
Loading

0 comments on commit 7bcfeea

Please sign in to comment.