Skip to content

Commit 53d1084

Browse files
committed
Merge: Bluetooth 6.13 rebase
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6625 JIRA: https://issues.redhat.com/browse/RHEL-74483 Omitted-fix: f2fbb90 ("net: tcp: remove call to obsolete crypto_ahash_alignmask()") Omitted-fix: 0a8e987 ("tcp: Fix SYN option room calculation for TCP-AO.") Signed-off-by: Bastien Nocera <bnocera@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: David Marlin <dmarlin@redhat.com> Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents b0fb1a9 + a916872 commit 53d1084

File tree

30 files changed

+899
-277
lines changed

30 files changed

+899
-277
lines changed

drivers/bluetooth/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ config BT_HCIBFUSB
336336

337337
config BT_HCIDTL1
338338
tristate "HCI DTL1 (PC Card) driver"
339-
depends on PCMCIA
339+
depends on PCMCIA && HAS_IOPORT
340340
help
341341
Bluetooth HCI DTL1 (PC Card) driver.
342342
This driver provides support for Bluetooth PCMCIA devices with
@@ -349,7 +349,7 @@ config BT_HCIDTL1
349349

350350
config BT_HCIBT3C
351351
tristate "HCI BT3C (PC Card) driver"
352-
depends on PCMCIA
352+
depends on PCMCIA && HAS_IOPORT
353353
select FW_LOADER
354354
help
355355
Bluetooth HCI BT3C (PC Card) driver.
@@ -363,7 +363,7 @@ config BT_HCIBT3C
363363

364364
config BT_HCIBLUECARD
365365
tristate "HCI BlueCard (PC Card) driver"
366-
depends on PCMCIA
366+
depends on PCMCIA && HAS_IOPORT
367367
help
368368
Bluetooth HCI BlueCard (PC Card) driver.
369369
This driver provides support for Bluetooth PCMCIA devices with

drivers/bluetooth/btintel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ static int btintel_download_firmware_payload(struct hci_dev *hdev,
10401040
* as needed.
10411041
*
10421042
* Send set of commands with 4 byte alignment from the
1043-
* firmware data buffer as a single Data fragement.
1043+
* firmware data buffer as a single Data fragment.
10441044
*/
10451045
if (!(frag_len % 4)) {
10461046
err = btintel_secure_send(hdev, 0x01, frag_len, fw_ptr);
@@ -2908,7 +2908,7 @@ void btintel_set_msft_opcode(struct hci_dev *hdev, u8 hw_variant)
29082908
case 0x12: /* ThP */
29092909
case 0x13: /* HrP */
29102910
case 0x14: /* CcP */
2911-
/* All Intel new genration controllers support the Microsoft vendor
2911+
/* All Intel new generation controllers support the Microsoft vendor
29122912
* extension are using 0xFC1E for VsMsftOpCode.
29132913
*/
29142914
case 0x17:

drivers/bluetooth/btintel_pcie.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -968,13 +968,9 @@ static int btintel_pcie_config_pcie(struct pci_dev *pdev,
968968
return err;
969969
}
970970

971-
err = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
972-
if (err)
973-
return err;
974-
975-
data->base_addr = pcim_iomap_table(pdev)[0];
976-
if (!data->base_addr)
977-
return -ENODEV;
971+
data->base_addr = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
972+
if (IS_ERR(data->base_addr))
973+
return PTR_ERR(data->base_addr);
978974

979975
err = btintel_pcie_setup_irq(data);
980976
if (err)

drivers/bluetooth/btmtk.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ int btmtk_setup_firmware(struct hci_dev *hdev, const char *fwname,
324324
wmt_params.data = NULL;
325325
wmt_params.status = NULL;
326326

327-
/* Activate funciton the firmware providing to */
327+
/* Activate function the firmware providing to */
328328
err = wmt_cmd_sync(hdev, &wmt_params);
329329
if (err < 0) {
330330
bt_dev_err(hdev, "Failed to send wmt rst (%d)", err);
@@ -1472,10 +1472,15 @@ EXPORT_SYMBOL_GPL(btmtk_usb_setup);
14721472

14731473
int btmtk_usb_shutdown(struct hci_dev *hdev)
14741474
{
1475+
struct btmtk_data *data = hci_get_priv(hdev);
14751476
struct btmtk_hci_wmt_params wmt_params;
14761477
u8 param = 0;
14771478
int err;
14781479

1480+
err = usb_autopm_get_interface(data->intf);
1481+
if (err < 0)
1482+
return err;
1483+
14791484
/* Disable the device */
14801485
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
14811486
wmt_params.flag = 0;
@@ -1486,9 +1491,11 @@ int btmtk_usb_shutdown(struct hci_dev *hdev)
14861491
err = btmtk_usb_hci_wmt_sync(hdev, &wmt_params);
14871492
if (err < 0) {
14881493
bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
1494+
usb_autopm_put_interface(data->intf);
14891495
return err;
14901496
}
14911497

1498+
usb_autopm_put_interface(data->intf);
14921499
return 0;
14931500
}
14941501
EXPORT_SYMBOL_GPL(btmtk_usb_shutdown);

drivers/bluetooth/btmtksdio.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ static int btmtksdio_open(struct hci_dev *hdev)
681681
if (err < 0)
682682
goto err_release_irq;
683683

684-
/* Explitly set write-1-clear method */
684+
/* Explicitly set write-1-clear method */
685685
val = sdio_readl(bdev->func, MTK_REG_CHCR, &err);
686686
if (err < 0)
687687
goto err_release_irq;
@@ -1333,6 +1333,8 @@ static int btmtksdio_probe(struct sdio_func *func,
13331333
{
13341334
struct btmtksdio_dev *bdev;
13351335
struct hci_dev *hdev;
1336+
struct device_node *old_node;
1337+
bool restore_node;
13361338
int err;
13371339

13381340
bdev = devm_kzalloc(&func->dev, sizeof(*bdev), GFP_KERNEL);
@@ -1401,7 +1403,7 @@ static int btmtksdio_probe(struct sdio_func *func,
14011403
if (pm_runtime_enabled(bdev->dev))
14021404
pm_runtime_disable(bdev->dev);
14031405

1404-
/* As explaination in drivers/mmc/core/sdio_bus.c tells us:
1406+
/* As explanation in drivers/mmc/core/sdio_bus.c tells us:
14051407
* Unbound SDIO functions are always suspended.
14061408
* During probe, the function is set active and the usage count
14071409
* is incremented. If the driver supports runtime PM,
@@ -1416,13 +1418,24 @@ static int btmtksdio_probe(struct sdio_func *func,
14161418
if (err)
14171419
bt_dev_err(hdev, "failed to initialize device wakeup");
14181420

1419-
bdev->dev->of_node = of_find_compatible_node(NULL, NULL,
1420-
"mediatek,mt7921s-bluetooth");
1421+
restore_node = false;
1422+
if (!of_device_is_compatible(bdev->dev->of_node, "mediatek,mt7921s-bluetooth")) {
1423+
restore_node = true;
1424+
old_node = bdev->dev->of_node;
1425+
bdev->dev->of_node = of_find_compatible_node(NULL, NULL,
1426+
"mediatek,mt7921s-bluetooth");
1427+
}
1428+
14211429
bdev->reset = devm_gpiod_get_optional(bdev->dev, "reset",
14221430
GPIOD_OUT_LOW);
14231431
if (IS_ERR(bdev->reset))
14241432
err = PTR_ERR(bdev->reset);
14251433

1434+
if (restore_node) {
1435+
of_node_put(bdev->dev->of_node);
1436+
bdev->dev->of_node = old_node;
1437+
}
1438+
14261439
return err;
14271440
}
14281441

drivers/bluetooth/btmtkuart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ mtk_stp_split(struct btmtkuart_dev *bdev, const unsigned char *data, int count,
327327
if (count <= 0)
328328
return NULL;
329329

330-
/* Tranlate to how much the size of data H4 can handle so far */
330+
/* Translate to how much the size of data H4 can handle so far */
331331
*sz_h4 = min_t(int, count, bdev->stp_dlen);
332332

333333
/* Update the remaining size of STP packet */

drivers/bluetooth/btnxpuart.c

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/crc8.h>
1717
#include <linux/crc32.h>
1818
#include <linux/string_helpers.h>
19+
#include <linux/gpio/consumer.h>
1920

2021
#include <net/bluetooth/bluetooth.h>
2122
#include <net/bluetooth/hci_core.h>
@@ -34,16 +35,17 @@
3435
/* NXP HW err codes */
3536
#define BTNXPUART_IR_HW_ERR 0xb0
3637

37-
#define FIRMWARE_W8987 "uart8987_bt_v0.bin"
38+
#define FIRMWARE_W8987 "uart8987_bt.bin"
3839
#define FIRMWARE_W8987_OLD "uartuart8987_bt.bin"
3940
#define FIRMWARE_W8997 "uart8997_bt_v4.bin"
4041
#define FIRMWARE_W8997_OLD "uartuart8997_bt_v4.bin"
4142
#define FIRMWARE_W9098 "uart9098_bt_v1.bin"
4243
#define FIRMWARE_W9098_OLD "uartuart9098_bt_v1.bin"
43-
#define FIRMWARE_IW416 "uartiw416_bt_v0.bin"
44+
#define FIRMWARE_IW416 "uartiw416_bt.bin"
45+
#define FIRMWARE_IW416_OLD "uartiw416_bt_v0.bin"
4446
#define FIRMWARE_IW612 "uartspi_n61x_v1.bin.se"
45-
#define FIRMWARE_IW615 "uartspi_iw610_v0.bin"
46-
#define FIRMWARE_SECURE_IW615 "uartspi_iw610_v0.bin.se"
47+
#define FIRMWARE_IW610 "uartspi_iw610.bin"
48+
#define FIRMWARE_SECURE_IW610 "uartspi_iw610.bin.se"
4749
#define FIRMWARE_IW624 "uartiw624_bt.bin"
4850
#define FIRMWARE_SECURE_IW624 "uartiw624_bt.bin.se"
4951
#define FIRMWARE_AW693 "uartaw693_bt.bin"
@@ -59,8 +61,8 @@
5961
#define CHIP_ID_IW624c 0x8001
6062
#define CHIP_ID_AW693a0 0x8200
6163
#define CHIP_ID_AW693a1 0x8201
62-
#define CHIP_ID_IW615a0 0x8800
63-
#define CHIP_ID_IW615a1 0x8801
64+
#define CHIP_ID_IW610a0 0x8800
65+
#define CHIP_ID_IW610a1 0x8801
6466

6567
#define FW_SECURE_MASK 0xc0
6668
#define FW_OPEN 0x00
@@ -81,6 +83,7 @@
8183
#define WAKEUP_METHOD_BREAK 1
8284
#define WAKEUP_METHOD_EXT_BREAK 2
8385
#define WAKEUP_METHOD_RTS 3
86+
#define WAKEUP_METHOD_GPIO 4
8487
#define WAKEUP_METHOD_INVALID 0xff
8588

8689
/* power save mode status */
@@ -134,6 +137,7 @@ struct ps_data {
134137
bool driver_sent_cmd;
135138
u16 h2c_ps_interval;
136139
u16 c2h_ps_interval;
140+
struct gpio_desc *h2c_ps_gpio;
137141
struct hci_dev *hdev;
138142
struct work_struct work;
139143
struct timer_list ps_timer;
@@ -364,14 +368,22 @@ static void ps_control(struct hci_dev *hdev, u8 ps_state)
364368
{
365369
struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
366370
struct ps_data *psdata = &nxpdev->psdata;
367-
int status;
371+
int status = 0;
368372

369373
if (psdata->ps_state == ps_state ||
370374
!test_bit(BTNXPUART_SERDEV_OPEN, &nxpdev->tx_state))
371375
return;
372376

373377
mutex_lock(&psdata->ps_lock);
374378
switch (psdata->cur_h2c_wakeupmode) {
379+
case WAKEUP_METHOD_GPIO:
380+
if (ps_state == PS_STATE_AWAKE)
381+
gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 0);
382+
else
383+
gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 1);
384+
bt_dev_dbg(hdev, "Set h2c_ps_gpio: %s",
385+
str_high_low(ps_state == PS_STATE_SLEEP));
386+
break;
375387
case WAKEUP_METHOD_DTR:
376388
if (ps_state == PS_STATE_AWAKE)
377389
status = serdev_device_set_tiocm(nxpdev->serdev, TIOCM_DTR, 0);
@@ -421,15 +433,29 @@ static void ps_timeout_func(struct timer_list *t)
421433
}
422434
}
423435

424-
static void ps_setup(struct hci_dev *hdev)
436+
static int ps_setup(struct hci_dev *hdev)
425437
{
426438
struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
439+
struct serdev_device *serdev = nxpdev->serdev;
427440
struct ps_data *psdata = &nxpdev->psdata;
428441

442+
psdata->h2c_ps_gpio = devm_gpiod_get_optional(&serdev->dev, "device-wakeup",
443+
GPIOD_OUT_LOW);
444+
if (IS_ERR(psdata->h2c_ps_gpio)) {
445+
bt_dev_err(hdev, "Error fetching device-wakeup-gpios: %ld",
446+
PTR_ERR(psdata->h2c_ps_gpio));
447+
return PTR_ERR(psdata->h2c_ps_gpio);
448+
}
449+
450+
if (!psdata->h2c_ps_gpio)
451+
psdata->h2c_wakeup_gpio = 0xff;
452+
429453
psdata->hdev = hdev;
430454
INIT_WORK(&psdata->work, ps_work_func);
431455
mutex_init(&psdata->ps_lock);
432456
timer_setup(&psdata->ps_timer, ps_timeout_func, 0);
457+
458+
return 0;
433459
}
434460

435461
static bool ps_wakeup(struct btnxpuart_dev *nxpdev)
@@ -515,6 +541,9 @@ static int send_wakeup_method_cmd(struct hci_dev *hdev, void *data)
515541
pcmd.c2h_wakeupmode = psdata->c2h_wakeupmode;
516542
pcmd.c2h_wakeup_gpio = psdata->c2h_wakeup_gpio;
517543
switch (psdata->h2c_wakeupmode) {
544+
case WAKEUP_METHOD_GPIO:
545+
pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_GPIO;
546+
break;
518547
case WAKEUP_METHOD_DTR:
519548
pcmd.h2c_wakeupmode = BT_CTRL_WAKEUP_METHOD_DSR;
520549
break;
@@ -549,6 +578,7 @@ static void ps_init(struct hci_dev *hdev)
549578
{
550579
struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev);
551580
struct ps_data *psdata = &nxpdev->psdata;
581+
u8 default_h2c_wakeup_mode = DEFAULT_H2C_WAKEUP_MODE;
552582

553583
serdev_device_set_tiocm(nxpdev->serdev, 0, TIOCM_RTS);
554584
usleep_range(5000, 10000);
@@ -560,8 +590,17 @@ static void ps_init(struct hci_dev *hdev)
560590
psdata->c2h_wakeup_gpio = 0xff;
561591

562592
psdata->cur_h2c_wakeupmode = WAKEUP_METHOD_INVALID;
593+
if (psdata->h2c_ps_gpio)
594+
default_h2c_wakeup_mode = WAKEUP_METHOD_GPIO;
595+
563596
psdata->h2c_ps_interval = PS_DEFAULT_TIMEOUT_PERIOD_MS;
564-
switch (DEFAULT_H2C_WAKEUP_MODE) {
597+
598+
switch (default_h2c_wakeup_mode) {
599+
case WAKEUP_METHOD_GPIO:
600+
psdata->h2c_wakeupmode = WAKEUP_METHOD_GPIO;
601+
gpiod_set_value_cansleep(psdata->h2c_ps_gpio, 0);
602+
usleep_range(5000, 10000);
603+
break;
565604
case WAKEUP_METHOD_DTR:
566605
psdata->h2c_wakeupmode = WAKEUP_METHOD_DTR;
567606
serdev_device_set_tiocm(nxpdev->serdev, 0, TIOCM_DTR);
@@ -946,12 +985,12 @@ static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid,
946985
else
947986
bt_dev_err(hdev, "Illegal loader version %02x", loader_ver);
948987
break;
949-
case CHIP_ID_IW615a0:
950-
case CHIP_ID_IW615a1:
988+
case CHIP_ID_IW610a0:
989+
case CHIP_ID_IW610a1:
951990
if ((loader_ver & FW_SECURE_MASK) == FW_OPEN)
952-
fw_name = FIRMWARE_IW615;
991+
fw_name = FIRMWARE_IW610;
953992
else if ((loader_ver & FW_SECURE_MASK) != FW_AUTH_ILLEGAL)
954-
fw_name = FIRMWARE_SECURE_IW615;
993+
fw_name = FIRMWARE_SECURE_IW610;
955994
else
956995
bt_dev_err(hdev, "Illegal loader version %02x", loader_ver);
957996
break;
@@ -971,6 +1010,9 @@ static char *nxp_get_old_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid,
9711010
case CHIP_ID_W9098:
9721011
fw_name_old = FIRMWARE_W9098_OLD;
9731012
break;
1013+
case CHIP_ID_IW416:
1014+
fw_name_old = FIRMWARE_IW416_OLD;
1015+
break;
9741016
}
9751017
return fw_name_old;
9761018
}
@@ -1275,6 +1317,9 @@ static int nxp_enqueue(struct hci_dev *hdev, struct sk_buff *skb)
12751317
psdata->c2h_wakeup_gpio = wakeup_parm.c2h_wakeup_gpio;
12761318
psdata->h2c_wakeup_gpio = wakeup_parm.h2c_wakeup_gpio;
12771319
switch (wakeup_parm.h2c_wakeupmode) {
1320+
case BT_CTRL_WAKEUP_METHOD_GPIO:
1321+
psdata->h2c_wakeupmode = WAKEUP_METHOD_GPIO;
1322+
break;
12781323
case BT_CTRL_WAKEUP_METHOD_DSR:
12791324
psdata->h2c_wakeupmode = WAKEUP_METHOD_DTR;
12801325
break;
@@ -1341,7 +1386,7 @@ static void btnxpuart_tx_work(struct work_struct *work)
13411386
skb_pull(skb, len);
13421387
if (skb->len > 0) {
13431388
skb_queue_head(&nxpdev->txq, skb);
1344-
break;
1389+
continue;
13451390
}
13461391

13471392
switch (hci_skb_pkt_type(skb)) {
@@ -1505,13 +1550,17 @@ static int nxp_serdev_probe(struct serdev_device *serdev)
15051550

15061551
if (hci_register_dev(hdev) < 0) {
15071552
dev_err(&serdev->dev, "Can't register HCI device\n");
1508-
hci_free_dev(hdev);
1509-
return -ENODEV;
1553+
goto probe_fail;
15101554
}
15111555

1512-
ps_setup(hdev);
1556+
if (ps_setup(hdev))
1557+
goto probe_fail;
15131558

15141559
return 0;
1560+
1561+
probe_fail:
1562+
hci_free_dev(hdev);
1563+
return -ENODEV;
15151564
}
15161565

15171566
static void nxp_serdev_remove(struct serdev_device *serdev)

drivers/bluetooth/btrtl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ int btrtl_shutdown_realtek(struct hci_dev *hdev)
13731373
/* According to the vendor driver, BT must be reset on close to avoid
13741374
* firmware crash.
13751375
*/
1376-
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
1376+
skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_CMD_TIMEOUT);
13771377
if (IS_ERR(skb)) {
13781378
ret = PTR_ERR(skb);
13791379
bt_dev_err(hdev, "HCI reset during shutdown failed");

0 commit comments

Comments
 (0)