Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on: [pull_request]

jobs:
ci:
runs-on: ubuntu-latest
name: CI for Pull Request
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
path: src/src

- name: CI
uses: tedd-an/bzcafe@main
with:
task: ci
base_folder: src
space: kernel
github_token: ${{ secrets.GITHUB_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

43 changes: 43 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Sync

on:
schedule:
- cron: "*/30 * * * *"

jobs:
sync_repo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: master

- name: Sync Repo
uses: tedd-an/bzcafe@main
with:
task: sync
upstream_repo: 'https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git'
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup PR
uses: tedd-an/bzcafe@main
with:
task: cleanup
github_token: ${{ secrets.ACTION_TOKEN }}

sync_patchwork:
needs: sync_repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Sync Patchwork
uses: tedd-an/bzcafe@main
with:
task: patchwork
space: kernel
github_token: ${{ secrets.ACTION_TOKEN }}
email_token: ${{ secrets.EMAIL_TOKEN }}
patchwork_token: ${{ secrets.PATCHWORK_TOKEN }}
patchwork_user: ${{ secrets.PATCHWORK_USER }}

8 changes: 1 addition & 7 deletions drivers/bluetooth/btmtksdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,6 @@ static void btmtksdio_remove(struct sdio_func *func)
hci_free_dev(hdev);
}

#ifdef CONFIG_PM
static int btmtksdio_runtime_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
Expand Down Expand Up @@ -1542,18 +1541,13 @@ static const struct dev_pm_ops btmtksdio_pm_ops = {
RUNTIME_PM_OPS(btmtksdio_runtime_suspend, btmtksdio_runtime_resume, NULL)
};

#define BTMTKSDIO_PM_OPS (&btmtksdio_pm_ops)
#else /* CONFIG_PM */
#define BTMTKSDIO_PM_OPS NULL
#endif /* CONFIG_PM */

static struct sdio_driver btmtksdio_driver = {
.name = "btmtksdio",
.probe = btmtksdio_probe,
.remove = btmtksdio_remove,
.id_table = btmtksdio_table,
.drv = {
.pm = BTMTKSDIO_PM_OPS,
.pm = pm_ptr(&btmtksdio_pm_ops),
}
};

Expand Down
58 changes: 35 additions & 23 deletions drivers/bluetooth/btqca.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,

ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
/* For WCN6750, if mbn file is not present then check for
* tlv file.
*/
if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
config->fwname, ret);
config->type = TLV_TYPE_PATCH;
snprintf(config->fwname, sizeof(config->fwname),
"qca/msbtfw%02x.tlv", rom_ver);
bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
config->fwname, ret);
return ret;
}
}
/* If the board-specific file is missing, try loading the default
* one, unless that was attempted already.
*/
else if (config->type == TLV_TYPE_NVM &&
qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
if (config->type == TLV_TYPE_NVM &&
qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
Expand Down Expand Up @@ -847,8 +830,12 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
"qca/msbtfw%02x.mbn", rom_ver);
break;
case QCA_WCN6855:
/* Due to historical reasons, WCN685x chip has been using firmware
* without the "wcn" prefix. The mapping between the chip and its
* corresponding firmware has now been corrected.
*/
snprintf(config.fwname, sizeof(config.fwname),
"qca/hpbtfw%02x.tlv", rom_ver);
"qca/wcnhpbtfw%02x.tlv", rom_ver);
break;
case QCA_WCN7850:
snprintf(config.fwname, sizeof(config.fwname),
Expand All @@ -861,8 +848,26 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}

err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
/* For WCN6750, if mbn file is not present then check for
* tlv file.
*/
if (err < 0 && soc_type == QCA_WCN6750) {
bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
config.fwname, err);
config.type = TLV_TYPE_PATCH;
snprintf(config.fwname, sizeof(config.fwname),
"qca/msbtfw%02x.tlv", rom_ver);
bt_dev_info(hdev, "QCA Downloading %s", config.fwname);
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
} else if (err < 0 && !rampatch_name && soc_type == QCA_WCN6855) {
snprintf(config.fwname, sizeof(config.fwname),
"qca/hpbtfw%02x.tlv", rom_ver);
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
}

if (err < 0) {
bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
config.fwname, err);
return err;
}

Expand Down Expand Up @@ -923,7 +928,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
case QCA_WCN6855:
qca_read_fw_board_id(hdev, &boardid);
qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
"hpnv", soc_type, ver, rom_ver, boardid);
"wcnhpnv", soc_type, ver, rom_ver, boardid);
break;
case QCA_WCN7850:
qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
Expand All @@ -936,8 +941,15 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}

err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
if (err < 0 && !firmware_name && soc_type == QCA_WCN6855) {
qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
"hpnv", soc_type, ver, rom_ver, boardid);
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
}

if (err < 0) {
bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);
bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
config.fwname, err);
return err;
}

Expand Down
23 changes: 17 additions & 6 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ static const struct usb_device_id quirks_table[] = {
BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x13d3, 0x3622), .driver_info = BTUSB_MEDIATEK |
BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x0489, 0xe158), .driver_info = BTUSB_MEDIATEK |
BTUSB_WIDEBAND_SPEECH },

/* Additional MediaTek MT7921 Bluetooth devices */
{ USB_DEVICE(0x0489, 0xe0c8), .driver_info = BTUSB_MEDIATEK |
Expand Down Expand Up @@ -4052,7 +4054,7 @@ static int btusb_probe(struct usb_interface *intf,
return -ENODEV;
}

data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
data = kzalloc(sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

Expand All @@ -4075,8 +4077,10 @@ static int btusb_probe(struct usb_interface *intf,
}
}

if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep)
if (!data->intr_ep || !data->bulk_tx_ep || !data->bulk_rx_ep) {
kfree(data);
return -ENODEV;
}

if (id->driver_info & BTUSB_AMP) {
data->cmdreq_type = USB_TYPE_CLASS | 0x01;
Expand Down Expand Up @@ -4131,8 +4135,10 @@ static int btusb_probe(struct usb_interface *intf,
data->recv_acl = hci_recv_frame;

hdev = hci_alloc_dev_priv(priv_size);
if (!hdev)
if (!hdev) {
kfree(data);
return -ENOMEM;
}

hdev->bus = HCI_USB;
hci_set_drvdata(hdev, data);
Expand Down Expand Up @@ -4406,6 +4412,7 @@ static int btusb_probe(struct usb_interface *intf,
if (data->reset_gpio)
gpiod_put(data->reset_gpio);
hci_free_dev(hdev);
kfree(data);
return err;
}

Expand Down Expand Up @@ -4454,6 +4461,7 @@ static void btusb_disconnect(struct usb_interface *intf)
}

hci_free_dev(hdev);
kfree(data);
}

#ifdef CONFIG_PM
Expand All @@ -4463,10 +4471,13 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)

BT_DBG("intf %p", intf);

/* Don't auto-suspend if there are connections; external suspend calls
* shall never fail.
/* Don't auto-suspend if there are connections or HCI operations in
* progress; external suspend calls shall never fail.
*/
if (PMSG_IS_AUTO(message) && hci_conn_count(data->hdev))
if (PMSG_IS_AUTO(message) &&
(hci_conn_count(data->hdev) ||
test_bit(HCI_INQUIRY, &data->hdev->flags) ||
hci_dev_test_flag(data->hdev, HCI_LE_SCAN)))
return -EBUSY;

if (data->suspend_count++)
Expand Down
11 changes: 7 additions & 4 deletions drivers/bluetooth/hci_bcm4377.c
Original file line number Diff line number Diff line change
Expand Up @@ -2416,8 +2416,9 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id)
hdev);
}

static int bcm4377_suspend(struct pci_dev *pdev, pm_message_t state)
static int bcm4377_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct bcm4377_data *bcm4377 = pci_get_drvdata(pdev);
int ret;

Expand All @@ -2431,8 +2432,9 @@ static int bcm4377_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}

static int bcm4377_resume(struct pci_dev *pdev)
static int bcm4377_resume(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct bcm4377_data *bcm4377 = pci_get_drvdata(pdev);

iowrite32(BCM4377_BAR0_SLEEP_CONTROL_UNQUIESCE,
Expand All @@ -2441,6 +2443,8 @@ static int bcm4377_resume(struct pci_dev *pdev)
return hci_resume_dev(bcm4377->hdev);
}

static DEFINE_SIMPLE_DEV_PM_OPS(bcm4377_ops, bcm4377_suspend, bcm4377_resume);

static const struct dmi_system_id bcm4377_dmi_board_table[] = {
{
.matches = {
Expand Down Expand Up @@ -2541,8 +2545,7 @@ static struct pci_driver bcm4377_pci_driver = {
.name = "hci_bcm4377",
.id_table = bcm4377_devid_table,
.probe = bcm4377_probe,
.suspend = bcm4377_suspend,
.resume = bcm4377_resume,
.driver.pm = &bcm4377_ops,
};
module_pci_driver(bcm4377_pci_driver);

Expand Down
33 changes: 33 additions & 0 deletions drivers/bluetooth/hci_qca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,39 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)
skb_queue_purge(&qca->rx_memdump_q);
}

/*
* If the BT chip's bt_en pin is connected to a 3.3V power supply via
* hardware and always stays high, driver cannot control the bt_en pin.
* As a result, during SSR (SubSystem Restart), QCA_SSR_TRIGGERED and
* QCA_IBS_DISABLED flags cannot be cleared, which leads to a reset
* command timeout.
* Add an msleep delay to ensure controller completes the SSR process.
*
* Host will not download the firmware after SSR, controller to remain
* in the IBS_WAKE state, and the host needs to synchronize with it
*
* Since the bluetooth chip has been reset, clear the memdump state.
*/
if (!hci_test_quirk(hu->hdev, HCI_QUIRK_NON_PERSISTENT_SETUP)) {
/*
* When the SSR (SubSystem Restart) duration exceeds 2 seconds,
* it triggers host tx_idle_delay, which sets host TX state
* to sleep. Reset tx_idle_timer after SSR to prevent
* host enter TX IBS_Sleep mode.
*/
mod_timer(&qca->tx_idle_timer, jiffies +
msecs_to_jiffies(qca->tx_idle_delay));

/* Controller reset completion time is 50ms */
msleep(50);

clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
clear_bit(QCA_IBS_DISABLED, &qca->flags);

qca->tx_ibs_state = HCI_IBS_TX_AWAKE;
qca->memdump_state = QCA_MEMDUMP_IDLE;
}

clear_bit(QCA_HW_ERROR_EVENT, &qca->flags);
}

Expand Down
39 changes: 24 additions & 15 deletions include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,30 @@ struct bt_voice {
#define BT_RCVMTU 13
#define BT_PHY 14

#define BT_PHY_BR_1M_1SLOT 0x00000001
#define BT_PHY_BR_1M_3SLOT 0x00000002
#define BT_PHY_BR_1M_5SLOT 0x00000004
#define BT_PHY_EDR_2M_1SLOT 0x00000008
#define BT_PHY_EDR_2M_3SLOT 0x00000010
#define BT_PHY_EDR_2M_5SLOT 0x00000020
#define BT_PHY_EDR_3M_1SLOT 0x00000040
#define BT_PHY_EDR_3M_3SLOT 0x00000080
#define BT_PHY_EDR_3M_5SLOT 0x00000100
#define BT_PHY_LE_1M_TX 0x00000200
#define BT_PHY_LE_1M_RX 0x00000400
#define BT_PHY_LE_2M_TX 0x00000800
#define BT_PHY_LE_2M_RX 0x00001000
#define BT_PHY_LE_CODED_TX 0x00002000
#define BT_PHY_LE_CODED_RX 0x00004000
#define BT_PHY_BR_1M_1SLOT BIT(0)
#define BT_PHY_BR_1M_3SLOT BIT(1)
#define BT_PHY_BR_1M_5SLOT BIT(2)
#define BT_PHY_EDR_2M_1SLOT BIT(3)
#define BT_PHY_EDR_2M_3SLOT BIT(4)
#define BT_PHY_EDR_2M_5SLOT BIT(5)
#define BT_PHY_EDR_3M_1SLOT BIT(6)
#define BT_PHY_EDR_3M_3SLOT BIT(7)
#define BT_PHY_EDR_3M_5SLOT BIT(8)
#define BT_PHY_LE_1M_TX BIT(9)
#define BT_PHY_LE_1M_RX BIT(10)
#define BT_PHY_LE_2M_TX BIT(11)
#define BT_PHY_LE_2M_RX BIT(12)
#define BT_PHY_LE_CODED_TX BIT(13)
#define BT_PHY_LE_CODED_RX BIT(14)

#define BT_PHY_BREDR_MASK (BT_PHY_BR_1M_1SLOT | BT_PHY_BR_1M_3SLOT | \
BT_PHY_BR_1M_5SLOT | BT_PHY_EDR_2M_1SLOT | \
BT_PHY_EDR_2M_3SLOT | BT_PHY_EDR_2M_5SLOT | \
BT_PHY_EDR_3M_1SLOT | BT_PHY_EDR_3M_3SLOT | \
BT_PHY_EDR_3M_5SLOT)
#define BT_PHY_LE_MASK (BT_PHY_LE_1M_TX | BT_PHY_LE_1M_RX | \
BT_PHY_LE_2M_TX | BT_PHY_LE_2M_RX | \
BT_PHY_LE_CODED_TX | BT_PHY_LE_CODED_RX)

#define BT_MODE 15

Expand Down
Loading