Skip to content

Commit f4dbc2b

Browse files
committed
Merge tag 'for-net-next-2023-10-23' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Luiz Augusto von Dentz says: ==================== bluetooth-next pull request for net-next: - Add 0bda:b85b for Fn-Link RTL8852BE - ISO: Many fixes for broadcast support - Mark bcm4378/bcm4387 as BROKEN_LE_CODED - Add support ITTIM PE50-M75C - Add RTW8852BE device 13d3:3570 - Add support for QCA2066 - Add support for Intel Misty Peak - 8087:0038 * tag 'for-net-next-2023-10-23' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next: Bluetooth: hci_sync: Fix Opcode prints in bt_dev_dbg/err Bluetooth: Fix double free in hci_conn_cleanup Bluetooth: btmtksdio: enable bluetooth wakeup in system suspend Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE Bluetooth: hci_bcm4377: Mark bcm4378/bcm4387 as BROKEN_LE_CODED Bluetooth: ISO: Copy BASE if service data matches EIR_BAA_SERVICE_UUID Bluetooth: Make handle of hci_conn be unique Bluetooth: btusb: Add date->evt_skb is NULL check Bluetooth: ISO: Fix bcast listener cleanup Bluetooth: msft: __hci_cmd_sync() doesn't return NULL Bluetooth: ISO: Match QoS adv handle with BIG handle Bluetooth: ISO: Allow binding a bcast listener to 0 bises Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables Bluetooth: qca: add support for QCA2066 Bluetooth: ISO: Set CIS bit only for devices with CIS support Bluetooth: Add support for Intel Misty Peak - 8087:0038 Bluetooth: Add support ITTIM PE50-M75C Bluetooth: ISO: Pass BIG encryption info through QoS Bluetooth: ISO: Fix BIS cleanup ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 4fb56e3 + 5308868 commit f4dbc2b

File tree

17 files changed

+375
-152
lines changed

17 files changed

+375
-152
lines changed

drivers/bluetooth/btmtksdio.c

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);
118118
#define BTMTKSDIO_FUNC_ENABLED 3
119119
#define BTMTKSDIO_PATCH_ENABLED 4
120120
#define BTMTKSDIO_HW_RESET_ACTIVE 5
121+
#define BTMTKSDIO_BT_WAKE_ENABLED 6
121122

122123
struct mtkbtsdio_hdr {
123124
__le16 len;
@@ -554,7 +555,7 @@ static void btmtksdio_txrx_work(struct work_struct *work)
554555
sdio_claim_host(bdev->func);
555556

556557
/* Disable interrupt */
557-
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, 0);
558+
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
558559

559560
txrx_timeout = jiffies + 5 * HZ;
560561

@@ -576,7 +577,7 @@ static void btmtksdio_txrx_work(struct work_struct *work)
576577
if ((int_status & FW_MAILBOX_INT) &&
577578
bdev->data->chipid == 0x7921) {
578579
sdio_writel(bdev->func, PH2DSM0R_DRIVER_OWN,
579-
MTK_REG_PH2DSM0R, 0);
580+
MTK_REG_PH2DSM0R, NULL);
580581
}
581582

582583
if (int_status & FW_OWN_BACK_INT)
@@ -608,7 +609,7 @@ static void btmtksdio_txrx_work(struct work_struct *work)
608609
} while (int_status || time_is_before_jiffies(txrx_timeout));
609610

610611
/* Enable interrupt */
611-
sdio_writel(bdev->func, C_INT_EN_SET, MTK_REG_CHLPCR, 0);
612+
sdio_writel(bdev->func, C_INT_EN_SET, MTK_REG_CHLPCR, NULL);
612613

613614
sdio_release_host(bdev->func);
614615

@@ -620,8 +621,14 @@ static void btmtksdio_interrupt(struct sdio_func *func)
620621
{
621622
struct btmtksdio_dev *bdev = sdio_get_drvdata(func);
622623

624+
if (test_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state)) {
625+
if (bdev->hdev->suspended)
626+
pm_wakeup_event(bdev->dev, 0);
627+
clear_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state);
628+
}
629+
623630
/* Disable interrupt */
624-
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, 0);
631+
sdio_writel(bdev->func, C_INT_EN_CLR, MTK_REG_CHLPCR, NULL);
625632

626633
schedule_work(&bdev->txrx_work);
627634
}
@@ -1454,6 +1461,23 @@ static int btmtksdio_runtime_suspend(struct device *dev)
14541461
return err;
14551462
}
14561463

1464+
static int btmtksdio_system_suspend(struct device *dev)
1465+
{
1466+
struct sdio_func *func = dev_to_sdio_func(dev);
1467+
struct btmtksdio_dev *bdev;
1468+
1469+
bdev = sdio_get_drvdata(func);
1470+
if (!bdev)
1471+
return 0;
1472+
1473+
if (!test_bit(BTMTKSDIO_FUNC_ENABLED, &bdev->tx_state))
1474+
return 0;
1475+
1476+
set_bit(BTMTKSDIO_BT_WAKE_ENABLED, &bdev->tx_state);
1477+
1478+
return btmtksdio_runtime_suspend(dev);
1479+
}
1480+
14571481
static int btmtksdio_runtime_resume(struct device *dev)
14581482
{
14591483
struct sdio_func *func = dev_to_sdio_func(dev);
@@ -1474,8 +1498,16 @@ static int btmtksdio_runtime_resume(struct device *dev)
14741498
return err;
14751499
}
14761500

1477-
static UNIVERSAL_DEV_PM_OPS(btmtksdio_pm_ops, btmtksdio_runtime_suspend,
1478-
btmtksdio_runtime_resume, NULL);
1501+
static int btmtksdio_system_resume(struct device *dev)
1502+
{
1503+
return btmtksdio_runtime_resume(dev);
1504+
}
1505+
1506+
static const struct dev_pm_ops btmtksdio_pm_ops = {
1507+
SYSTEM_SLEEP_PM_OPS(btmtksdio_system_suspend, btmtksdio_system_resume)
1508+
RUNTIME_PM_OPS(btmtksdio_runtime_suspend, btmtksdio_runtime_resume, NULL)
1509+
};
1510+
14791511
#define BTMTKSDIO_PM_OPS (&btmtksdio_pm_ops)
14801512
#else /* CONFIG_PM */
14811513
#define BTMTKSDIO_PM_OPS NULL

drivers/bluetooth/btqca.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,44 @@ static int qca_send_reset(struct hci_dev *hdev)
205205
return 0;
206206
}
207207

208+
static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid)
209+
{
210+
u8 cmd;
211+
struct sk_buff *skb;
212+
struct edl_event_hdr *edl;
213+
int err = 0;
214+
215+
cmd = EDL_GET_BID_REQ_CMD;
216+
skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN,
217+
&cmd, 0, HCI_INIT_TIMEOUT);
218+
if (IS_ERR(skb)) {
219+
err = PTR_ERR(skb);
220+
bt_dev_err(hdev, "Reading QCA board ID failed (%d)", err);
221+
return err;
222+
}
223+
224+
edl = skb_pull_data(skb, sizeof(*edl));
225+
if (!edl) {
226+
bt_dev_err(hdev, "QCA read board ID with no header");
227+
err = -EILSEQ;
228+
goto out;
229+
}
230+
231+
if (edl->cresp != EDL_CMD_REQ_RES_EVT ||
232+
edl->rtype != EDL_GET_BID_REQ_CMD) {
233+
bt_dev_err(hdev, "QCA Wrong packet: %d %d", edl->cresp, edl->rtype);
234+
err = -EIO;
235+
goto out;
236+
}
237+
238+
*bid = (edl->data[1] << 8) + edl->data[2];
239+
bt_dev_dbg(hdev, "%s: bid = %x", __func__, *bid);
240+
241+
out:
242+
kfree_skb(skb);
243+
return err;
244+
}
245+
208246
int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
209247
{
210248
struct sk_buff *skb;
@@ -574,6 +612,23 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr)
574612
}
575613
EXPORT_SYMBOL_GPL(qca_set_bdaddr_rome);
576614

615+
static void qca_generate_hsp_nvm_name(char *fwname, size_t max_size,
616+
struct qca_btsoc_version ver, u8 rom_ver, u16 bid)
617+
{
618+
const char *variant;
619+
620+
/* hsp gf chip */
621+
if ((le32_to_cpu(ver.soc_id) & QCA_HSP_GF_SOC_MASK) == QCA_HSP_GF_SOC_ID)
622+
variant = "g";
623+
else
624+
variant = "";
625+
626+
if (bid == 0x0)
627+
snprintf(fwname, max_size, "qca/hpnv%02x%s.bin", rom_ver, variant);
628+
else
629+
snprintf(fwname, max_size, "qca/hpnv%02x%s.%x", rom_ver, variant, bid);
630+
}
631+
577632
int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
578633
enum qca_btsoc_type soc_type, struct qca_btsoc_version ver,
579634
const char *firmware_name)
@@ -582,6 +637,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
582637
int err;
583638
u8 rom_ver = 0;
584639
u32 soc_ver;
640+
u16 boardid = 0;
585641

586642
bt_dev_dbg(hdev, "QCA setup on UART");
587643

@@ -615,6 +671,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
615671
snprintf(config.fwname, sizeof(config.fwname),
616672
"qca/apbtfw%02x.tlv", rom_ver);
617673
break;
674+
case QCA_QCA2066:
675+
snprintf(config.fwname, sizeof(config.fwname),
676+
"qca/hpbtfw%02x.tlv", rom_ver);
677+
break;
618678
case QCA_QCA6390:
619679
snprintf(config.fwname, sizeof(config.fwname),
620680
"qca/htbtfw%02x.tlv", rom_ver);
@@ -649,6 +709,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
649709
/* Give the controller some time to get ready to receive the NVM */
650710
msleep(10);
651711

712+
if (soc_type == QCA_QCA2066)
713+
qca_read_fw_board_id(hdev, &boardid);
714+
652715
/* Download NVM configuration */
653716
config.type = TLV_TYPE_NVM;
654717
if (firmware_name) {
@@ -671,6 +734,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
671734
snprintf(config.fwname, sizeof(config.fwname),
672735
"qca/apnv%02x.bin", rom_ver);
673736
break;
737+
case QCA_QCA2066:
738+
qca_generate_hsp_nvm_name(config.fwname,
739+
sizeof(config.fwname), ver, rom_ver, boardid);
740+
break;
674741
case QCA_QCA6390:
675742
snprintf(config.fwname, sizeof(config.fwname),
676743
"qca/htnv%02x.bin", rom_ver);
@@ -702,6 +769,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
702769

703770
switch (soc_type) {
704771
case QCA_WCN3991:
772+
case QCA_QCA2066:
705773
case QCA_QCA6390:
706774
case QCA_WCN6750:
707775
case QCA_WCN6855:

drivers/bluetooth/btqca.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define EDL_PATCH_VER_REQ_CMD (0x19)
1313
#define EDL_PATCH_TLV_REQ_CMD (0x1E)
1414
#define EDL_GET_BUILD_INFO_CMD (0x20)
15+
#define EDL_GET_BID_REQ_CMD (0x23)
1516
#define EDL_NVM_ACCESS_SET_REQ_CMD (0x01)
1617
#define EDL_PATCH_CONFIG_CMD (0x28)
1718
#define MAX_SIZE_PER_TLV_SEGMENT (243)
@@ -47,7 +48,8 @@
4748
((le32_to_cpu(soc_id) << 16) | (le16_to_cpu(rom_ver)))
4849

4950
#define QCA_FW_BUILD_VER_LEN 255
50-
51+
#define QCA_HSP_GF_SOC_ID 0x1200
52+
#define QCA_HSP_GF_SOC_MASK 0x0000ff00
5153

5254
enum qca_baudrate {
5355
QCA_BAUDRATE_115200 = 0,
@@ -146,6 +148,7 @@ enum qca_btsoc_type {
146148
QCA_WCN3990,
147149
QCA_WCN3998,
148150
QCA_WCN3991,
151+
QCA_QCA2066,
149152
QCA_QCA6390,
150153
QCA_WCN6750,
151154
QCA_WCN6855,

drivers/bluetooth/btusb.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ static const struct usb_device_id quirks_table[] = {
477477
{ USB_DEVICE(0x8087, 0x0033), .driver_info = BTUSB_INTEL_COMBINED },
478478
{ USB_DEVICE(0x8087, 0x0035), .driver_info = BTUSB_INTEL_COMBINED },
479479
{ USB_DEVICE(0x8087, 0x0036), .driver_info = BTUSB_INTEL_COMBINED },
480+
{ USB_DEVICE(0x8087, 0x0038), .driver_info = BTUSB_INTEL_COMBINED },
480481
{ USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
481482
{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL_COMBINED |
482483
BTUSB_INTEL_NO_WBS_SUPPORT |
@@ -543,6 +544,10 @@ static const struct usb_device_id quirks_table[] = {
543544
BTUSB_WIDEBAND_SPEECH },
544545
{ USB_DEVICE(0x0bda, 0x887b), .driver_info = BTUSB_REALTEK |
545546
BTUSB_WIDEBAND_SPEECH },
547+
{ USB_DEVICE(0x0bda, 0xb85b), .driver_info = BTUSB_REALTEK |
548+
BTUSB_WIDEBAND_SPEECH },
549+
{ USB_DEVICE(0x13d3, 0x3570), .driver_info = BTUSB_REALTEK |
550+
BTUSB_WIDEBAND_SPEECH },
546551
{ USB_DEVICE(0x13d3, 0x3571), .driver_info = BTUSB_REALTEK |
547552
BTUSB_WIDEBAND_SPEECH },
548553

@@ -644,6 +649,9 @@ static const struct usb_device_id quirks_table[] = {
644649
{ USB_DEVICE(0x04ca, 0x3804), .driver_info = BTUSB_MEDIATEK |
645650
BTUSB_WIDEBAND_SPEECH |
646651
BTUSB_VALID_LE_STATES },
652+
{ USB_DEVICE(0x35f5, 0x7922), .driver_info = BTUSB_MEDIATEK |
653+
BTUSB_WIDEBAND_SPEECH |
654+
BTUSB_VALID_LE_STATES },
647655

648656
/* Additional Realtek 8723AE Bluetooth devices */
649657
{ USB_DEVICE(0x0930, 0x021d), .driver_info = BTUSB_REALTEK },
@@ -2818,6 +2826,9 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
28182826
goto err_free_wc;
28192827
}
28202828

2829+
if (data->evt_skb == NULL)
2830+
goto err_free_wc;
2831+
28212832
/* Parse and handle the return WMT event */
28222833
wmt_evt = (struct btmtk_hci_wmt_evt *)data->evt_skb->data;
28232834
if (wmt_evt->whdr.op != hdr->op) {

drivers/bluetooth/hci_bcm4377.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ struct bcm4377_hw {
512512
unsigned long disable_aspm : 1;
513513
unsigned long broken_ext_scan : 1;
514514
unsigned long broken_mws_transport_config : 1;
515+
unsigned long broken_le_coded : 1;
515516

516517
int (*send_calibration)(struct bcm4377_data *bcm4377);
517518
int (*send_ptb)(struct bcm4377_data *bcm4377,
@@ -2372,6 +2373,8 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id)
23722373
set_bit(HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, &hdev->quirks);
23732374
if (bcm4377->hw->broken_ext_scan)
23742375
set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
2376+
if (bcm4377->hw->broken_le_coded)
2377+
set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
23752378

23762379
pci_set_drvdata(pdev, bcm4377);
23772380
hci_set_drvdata(hdev, bcm4377);
@@ -2461,6 +2464,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {
24612464
.bar0_core2_window2 = 0x18107000,
24622465
.has_bar0_core2_window2 = true,
24632466
.broken_mws_transport_config = true,
2467+
.broken_le_coded = true,
24642468
.send_calibration = bcm4378_send_calibration,
24652469
.send_ptb = bcm4378_send_ptb,
24662470
},
@@ -2474,6 +2478,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {
24742478
.has_bar0_core2_window2 = true,
24752479
.clear_pciecfg_subsystem_ctrl_bit19 = true,
24762480
.broken_mws_transport_config = true,
2481+
.broken_le_coded = true,
24772482
.send_calibration = bcm4387_send_calibration,
24782483
.send_ptb = bcm4378_send_ptb,
24792484
},

drivers/bluetooth/hci_qca.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,10 @@ static int qca_setup(struct hci_uart *hu)
18411841
set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
18421842

18431843
switch (soc_type) {
1844+
case QCA_QCA2066:
1845+
soc_name = "qca2066";
1846+
break;
1847+
18441848
case QCA_WCN3988:
18451849
case QCA_WCN3990:
18461850
case QCA_WCN3991:
@@ -2032,6 +2036,11 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = {
20322036
.num_vregs = 4,
20332037
};
20342038

2039+
static const struct qca_device_data qca_soc_data_qca2066 __maybe_unused = {
2040+
.soc_type = QCA_QCA2066,
2041+
.num_vregs = 0,
2042+
};
2043+
20352044
static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused = {
20362045
.soc_type = QCA_QCA6390,
20372046
.num_vregs = 0,
@@ -2559,6 +2568,7 @@ static SIMPLE_DEV_PM_OPS(qca_pm_ops, qca_suspend, qca_resume);
25592568

25602569
#ifdef CONFIG_OF
25612570
static const struct of_device_id qca_bluetooth_of_match[] = {
2571+
{ .compatible = "qcom,qca2066-bt", .data = &qca_soc_data_qca2066},
25622572
{ .compatible = "qcom,qca6174-bt" },
25632573
{ .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390},
25642574
{ .compatible = "qcom,qca9377-bt" },
@@ -2576,6 +2586,7 @@ MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match);
25762586

25772587
#ifdef CONFIG_ACPI
25782588
static const struct acpi_device_id qca_bluetooth_acpi_match[] = {
2589+
{ "QCOM2066", (kernel_ulong_t)&qca_soc_data_qca2066 },
25792590
{ "QCOM6390", (kernel_ulong_t)&qca_soc_data_qca6390 },
25802591
{ "DLA16390", (kernel_ulong_t)&qca_soc_data_qca6390 },
25812592
{ "DLB16390", (kernel_ulong_t)&qca_soc_data_qca6390 },

include/net/bluetooth/hci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
BlueZ - Bluetooth protocol stack for Linux
33
Copyright (C) 2000-2001 Qualcomm Incorporated
4+
Copyright 2023 NXP
45
56
Written 2000,2001 by Maxim Krasnyansky <[email protected]>
67
@@ -673,6 +674,8 @@ enum {
673674
#define HCI_TX_POWER_INVALID 127
674675
#define HCI_RSSI_INVALID 127
675676

677+
#define HCI_SYNC_HANDLE_INVALID 0xffff
678+
676679
#define HCI_ROLE_MASTER 0x00
677680
#define HCI_ROLE_SLAVE 0x01
678681

0 commit comments

Comments
 (0)