Skip to content

Commit c4c57b9

Browse files
committed
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says: ==================== pull request: bluetooth-next 2020-01-26 Here's (probably) the last bluetooth-next pull request for the 5.6 kernel. - Initial pieces of Bluetooth 5.2 Isochronous Channels support - mgmt: Various cleanups and a new Set Blocked Keys command - btusb: Added support for 04ca:3021 QCA_ROME device - hci_qca: Multiple fixes & cleanups - hci_bcm: Fixes & improved device tree support - Fixed attempts to create duplicate debugfs entries Please let me know if there are any issues pulling. Thanks. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5a44c71 + 11eb85e commit c4c57b9

File tree

25 files changed

+1019
-204
lines changed

25 files changed

+1019
-204
lines changed

Documentation/devicetree/bindings/net/broadcom-bluetooth.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Required properties:
1111

1212
- compatible: should contain one of the following:
1313
* "brcm,bcm20702a1"
14+
* "brcm,bcm4329-bt"
1415
* "brcm,bcm4330-bt"
1516
* "brcm,bcm43438-bt"
1617
* "brcm,bcm4345c5"
@@ -22,7 +23,9 @@ Optional properties:
2223
- max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
2324
- shutdown-gpios: GPIO specifier, used to enable the BT module
2425
- device-wakeup-gpios: GPIO specifier, used to wakeup the controller
25-
- host-wakeup-gpios: GPIO specifier, used to wakeup the host processor
26+
- host-wakeup-gpios: GPIO specifier, used to wakeup the host processor.
27+
deprecated, replaced by interrupts and
28+
"host-wakeup" interrupt-names
2629
- clocks: 1 or 2 clocks as defined in clock-names below, in that order
2730
- clock-names: names for clock inputs, matching the clocks given
2831
- "extclk": deprecated, replaced by "txco"
@@ -36,7 +39,8 @@ Optional properties:
3639
- pcm-frame-type: short, long
3740
- pcm-sync-mode: slave, master
3841
- pcm-clock-mode: slave, master
39-
42+
- interrupts: must be one, used to wakeup the host processor
43+
- interrupt-names: must be "host-wakeup"
4044

4145
Example:
4246

drivers/bluetooth/btbcm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
3636
HCI_INIT_TIMEOUT);
3737
if (IS_ERR(skb)) {
3838
int err = PTR_ERR(skb);
39+
3940
bt_dev_err(hdev, "BCM: Reading device address failed (%d)", err);
4041
return err;
4142
}
@@ -223,6 +224,7 @@ static int btbcm_reset(struct hci_dev *hdev)
223224
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
224225
if (IS_ERR(skb)) {
225226
int err = PTR_ERR(skb);
227+
226228
bt_dev_err(hdev, "BCM: Reset failed (%d)", err);
227229
return err;
228230
}

drivers/bluetooth/btbcm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
7878
return -EOPNOTSUPP;
7979
}
8080

81-
int btbcm_read_pcm_int_params(struct hci_dev *hdev,
81+
static inline int btbcm_read_pcm_int_params(struct hci_dev *hdev,
8282
struct bcm_set_pcm_int_params *params)
8383
{
8484
return -EOPNOTSUPP;
8585
}
8686

87-
int btbcm_write_pcm_int_params(struct hci_dev *hdev,
87+
static inline int btbcm_write_pcm_int_params(struct hci_dev *hdev,
8888
const struct bcm_set_pcm_int_params *params)
8989
{
9090
return -EOPNOTSUPP;

drivers/bluetooth/btrtl.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,11 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
370370
* the end.
371371
*/
372372
len = patch_length;
373-
buf = kmemdup(btrtl_dev->fw_data + patch_offset, patch_length,
374-
GFP_KERNEL);
373+
buf = kvmalloc(patch_length, GFP_KERNEL);
375374
if (!buf)
376375
return -ENOMEM;
377376

377+
memcpy(buf, btrtl_dev->fw_data + patch_offset, patch_length - 4);
378378
memcpy(buf + patch_length - 4, &epatch_info->fw_version, 4);
379379

380380
*_buf = buf;
@@ -460,8 +460,10 @@ static int rtl_load_file(struct hci_dev *hdev, const char *name, u8 **buff)
460460
if (ret < 0)
461461
return ret;
462462
ret = fw->size;
463-
*buff = kmemdup(fw->data, ret, GFP_KERNEL);
464-
if (!*buff)
463+
*buff = kvmalloc(fw->size, GFP_KERNEL);
464+
if (*buff)
465+
memcpy(*buff, fw->data, ret);
466+
else
465467
ret = -ENOMEM;
466468

467469
release_firmware(fw);
@@ -499,14 +501,14 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
499501
goto out;
500502

501503
if (btrtl_dev->cfg_len > 0) {
502-
tbuff = kzalloc(ret + btrtl_dev->cfg_len, GFP_KERNEL);
504+
tbuff = kvzalloc(ret + btrtl_dev->cfg_len, GFP_KERNEL);
503505
if (!tbuff) {
504506
ret = -ENOMEM;
505507
goto out;
506508
}
507509

508510
memcpy(tbuff, fw_data, ret);
509-
kfree(fw_data);
511+
kvfree(fw_data);
510512

511513
memcpy(tbuff + ret, btrtl_dev->cfg_data, btrtl_dev->cfg_len);
512514
ret += btrtl_dev->cfg_len;
@@ -519,14 +521,14 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
519521
ret = rtl_download_firmware(hdev, fw_data, ret);
520522

521523
out:
522-
kfree(fw_data);
524+
kvfree(fw_data);
523525
return ret;
524526
}
525527

526528
void btrtl_free(struct btrtl_device_info *btrtl_dev)
527529
{
528-
kfree(btrtl_dev->fw_data);
529-
kfree(btrtl_dev->cfg_data);
530+
kvfree(btrtl_dev->fw_data);
531+
kvfree(btrtl_dev->cfg_data);
530532
kfree(btrtl_dev);
531533
}
532534
EXPORT_SYMBOL_GPL(btrtl_free);

drivers/bluetooth/btsdio.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,20 @@ static int btsdio_rx_packet(struct btsdio_data *data)
145145

146146
data->hdev->stat.byte_rx += len;
147147

148-
hci_skb_pkt_type(skb) = hdr[3];
149-
150-
err = hci_recv_frame(data->hdev, skb);
151-
if (err < 0)
152-
return err;
148+
switch (hdr[3]) {
149+
case HCI_EVENT_PKT:
150+
case HCI_ACLDATA_PKT:
151+
case HCI_SCODATA_PKT:
152+
case HCI_ISODATA_PKT:
153+
hci_skb_pkt_type(skb) = hdr[3];
154+
err = hci_recv_frame(data->hdev, skb);
155+
if (err < 0)
156+
return err;
157+
break;
158+
default:
159+
kfree_skb(skb);
160+
return -EINVAL;
161+
}
153162

154163
sdio_writeb(data->func, 0x00, REG_PC_RRT, NULL);
155164

drivers/bluetooth/btusb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ static const struct usb_device_id blacklist_table[] = {
266266
{ USB_DEVICE(0x04ca, 0x3015), .driver_info = BTUSB_QCA_ROME },
267267
{ USB_DEVICE(0x04ca, 0x3016), .driver_info = BTUSB_QCA_ROME },
268268
{ USB_DEVICE(0x04ca, 0x301a), .driver_info = BTUSB_QCA_ROME },
269+
{ USB_DEVICE(0x04ca, 0x3021), .driver_info = BTUSB_QCA_ROME },
269270
{ USB_DEVICE(0x13d3, 0x3491), .driver_info = BTUSB_QCA_ROME },
270271
{ USB_DEVICE(0x13d3, 0x3496), .driver_info = BTUSB_QCA_ROME },
271272
{ USB_DEVICE(0x13d3, 0x3501), .driver_info = BTUSB_QCA_ROME },

drivers/bluetooth/hci_bcm.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/module.h>
1414
#include <linux/acpi.h>
1515
#include <linux/of.h>
16+
#include <linux/of_irq.h>
1617
#include <linux/property.h>
1718
#include <linux/platform_data/x86/apple.h>
1819
#include <linux/platform_device.h>
@@ -53,6 +54,7 @@
5354
*/
5455
struct bcm_device_data {
5556
bool no_early_set_baudrate;
57+
bool drive_rts_on_open;
5658
};
5759

5860
/**
@@ -122,6 +124,7 @@ struct bcm_device {
122124
bool is_suspended;
123125
#endif
124126
bool no_early_set_baudrate;
127+
bool drive_rts_on_open;
125128
u8 pcm_int_params[5];
126129
};
127130

@@ -456,7 +459,9 @@ static int bcm_open(struct hci_uart *hu)
456459

457460
out:
458461
if (bcm->dev) {
459-
hci_uart_set_flow_control(hu, true);
462+
if (bcm->dev->drive_rts_on_open)
463+
hci_uart_set_flow_control(hu, true);
464+
460465
hu->init_speed = bcm->dev->init_speed;
461466

462467
/* If oper_speed is set, ldisc/serdev will set the baudrate
@@ -466,7 +471,10 @@ static int bcm_open(struct hci_uart *hu)
466471
hu->oper_speed = bcm->dev->oper_speed;
467472

468473
err = bcm_gpio_set_power(bcm->dev, true);
469-
hci_uart_set_flow_control(hu, false);
474+
475+
if (bcm->dev->drive_rts_on_open)
476+
hci_uart_set_flow_control(hu, false);
477+
470478
if (err)
471479
goto err_unset_hu;
472480
}
@@ -1144,6 +1152,8 @@ static int bcm_of_probe(struct bcm_device *bdev)
11441152
device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
11451153
device_property_read_u8_array(bdev->dev, "brcm,bt-pcm-int-params",
11461154
bdev->pcm_int_params, 5);
1155+
bdev->irq = of_irq_get_byname(bdev->dev->of_node, "host-wakeup");
1156+
11471157
return 0;
11481158
}
11491159

@@ -1447,8 +1457,10 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
14471457
dev_err(&serdev->dev, "Failed to power down\n");
14481458

14491459
data = device_get_match_data(bcmdev->dev);
1450-
if (data)
1460+
if (data) {
14511461
bcmdev->no_early_set_baudrate = data->no_early_set_baudrate;
1462+
bcmdev->drive_rts_on_open = data->drive_rts_on_open;
1463+
}
14521464

14531465
return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto);
14541466
}
@@ -1465,11 +1477,16 @@ static struct bcm_device_data bcm4354_device_data = {
14651477
.no_early_set_baudrate = true,
14661478
};
14671479

1480+
static struct bcm_device_data bcm43438_device_data = {
1481+
.drive_rts_on_open = true,
1482+
};
1483+
14681484
static const struct of_device_id bcm_bluetooth_of_match[] = {
14691485
{ .compatible = "brcm,bcm20702a1" },
1486+
{ .compatible = "brcm,bcm4329-bt" },
14701487
{ .compatible = "brcm,bcm4345c5" },
14711488
{ .compatible = "brcm,bcm4330-bt" },
1472-
{ .compatible = "brcm,bcm43438-bt" },
1489+
{ .compatible = "brcm,bcm43438-bt", .data = &bcm43438_device_data },
14731490
{ .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data },
14741491
{ .compatible = "brcm,bcm4335a0" },
14751492
{ },

drivers/bluetooth/hci_h4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ static const struct h4_recv_pkt h4_recv_pkts[] = {
103103
{ H4_RECV_ACL, .recv = hci_recv_frame },
104104
{ H4_RECV_SCO, .recv = hci_recv_frame },
105105
{ H4_RECV_EVENT, .recv = hci_recv_frame },
106+
{ H4_RECV_ISO, .recv = hci_recv_frame },
106107
};
107108

108109
/* Recv data */

drivers/bluetooth/hci_h5.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ static void h5_complete_rx_pkt(struct hci_uart *hu)
385385
case HCI_EVENT_PKT:
386386
case HCI_ACLDATA_PKT:
387387
case HCI_SCODATA_PKT:
388+
case HCI_ISODATA_PKT:
388389
hci_skb_pkt_type(h5->rx_skb) = H5_HDR_PKT_TYPE(hdr);
389390

390391
/* Remove Three-wire header */
@@ -594,6 +595,7 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
594595
break;
595596

596597
case HCI_SCODATA_PKT:
598+
case HCI_ISODATA_PKT:
597599
skb_queue_tail(&h5->unrel, skb);
598600
break;
599601

@@ -636,6 +638,7 @@ static bool valid_packet_type(u8 type)
636638
case HCI_ACLDATA_PKT:
637639
case HCI_COMMAND_PKT:
638640
case HCI_SCODATA_PKT:
641+
case HCI_ISODATA_PKT:
639642
case HCI_3WIRE_LINK_PKT:
640643
case HCI_3WIRE_ACK_PKT:
641644
return true;

0 commit comments

Comments
 (0)