Skip to content

Commit

Permalink
Bluetooth: hci_qca: Add device_may_wakeup support
Browse files Browse the repository at this point in the history
Based on device may wakeup status, Bluez stack will enable/disable
passive scanning with whitelist in BT controller while suspending.
As interrupt from BT SoC is handled by UART driver,we need to use
device handle of UART driver to get the status of device may wakeup

Signed-off-by: Venkata Lakshmi Narayana Gubba <gubbaven@codeaurora.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Venkata Lakshmi Narayana Gubba authored and Marcel Holtmann committed Mar 11, 2021
1 parent 6d19628 commit c1a7416
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/bluetooth/hci_qca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,20 @@ static void qca_cmd_timeout(struct hci_dev *hdev)
mutex_unlock(&qca->hci_memdump_lock);
}

static bool qca_prevent_wake(struct hci_dev *hdev)
{
struct hci_uart *hu = hci_get_drvdata(hdev);
bool wakeup;

/* UART driver handles the interrupt from BT SoC.So we need to use
* device handle of UART driver to get the status of device may wakeup.
*/
wakeup = device_may_wakeup(hu->serdev->ctrl->dev.parent);
bt_dev_dbg(hu->hdev, "wakeup status : %d", wakeup);

return !wakeup;
}

static int qca_wcn3990_init(struct hci_uart *hu)
{
struct qca_serdev *qcadev;
Expand Down Expand Up @@ -1721,6 +1735,7 @@ static int qca_setup(struct hci_uart *hu)
qca_debugfs_init(hdev);
hu->hdev->hw_error = qca_hw_error;
hu->hdev->cmd_timeout = qca_cmd_timeout;
hu->hdev->prevent_wake = qca_prevent_wake;
} else if (ret == -ENOENT) {
/* No patch/nvm-config found, run with original fw/config */
set_bit(QCA_ROM_FW, &qca->flags);
Expand Down

0 comments on commit c1a7416

Please sign in to comment.