Skip to content

Commit 5559904

Browse files
rjliao-qcaholtmann
authored andcommitted
Bluetooth: hci_qca: Add QCA Rome power off support to the qca_power_shutdown()
Current qca_power_shutdown() only supports wcn399x, this patch adds Rome power off support to it. For Rome it just needs to pull down the bt_en GPIO to power off it. This patch also replaces all the power off operation in qca_close() with the unified qca_power_shutdown() call. Signed-off-by: Rocky Liao <[email protected]> Reviewed-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent f25a96c commit 5559904

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

drivers/bluetooth/hci_qca.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,6 @@ static int qca_flush(struct hci_uart *hu)
663663
/* Close protocol */
664664
static int qca_close(struct hci_uart *hu)
665665
{
666-
struct qca_serdev *qcadev;
667666
struct qca_data *qca = hu->priv;
668667

669668
BT_DBG("hu %p qca close", hu);
@@ -679,14 +678,7 @@ static int qca_close(struct hci_uart *hu)
679678
destroy_workqueue(qca->workqueue);
680679
qca->hu = NULL;
681680

682-
if (hu->serdev) {
683-
qcadev = serdev_device_get_drvdata(hu->serdev);
684-
if (qca_is_wcn399x(qcadev->btsoc_type))
685-
qca_power_shutdown(hu);
686-
else
687-
gpiod_set_value_cansleep(qcadev->bt_en, 0);
688-
689-
}
681+
qca_power_shutdown(hu);
690682

691683
kfree_skb(qca->rx_skb);
692684

@@ -1685,6 +1677,7 @@ static void qca_power_shutdown(struct hci_uart *hu)
16851677
struct qca_serdev *qcadev;
16861678
struct qca_data *qca = hu->priv;
16871679
unsigned long flags;
1680+
enum qca_btsoc_type soc_type = qca_soc_type(hu);
16881681

16891682
qcadev = serdev_device_get_drvdata(hu->serdev);
16901683

@@ -1697,11 +1690,22 @@ static void qca_power_shutdown(struct hci_uart *hu)
16971690
qca_flush(hu);
16981691
spin_unlock_irqrestore(&qca->hci_ibs_lock, flags);
16991692

1700-
host_set_baudrate(hu, 2400);
1701-
qca_send_power_pulse(hu, false);
1702-
qca_regulator_disable(qcadev);
17031693
hu->hdev->hw_error = NULL;
17041694
hu->hdev->cmd_timeout = NULL;
1695+
1696+
/* Non-serdev device usually is powered by external power
1697+
* and don't need additional action in driver for power down
1698+
*/
1699+
if (!hu->serdev)
1700+
return;
1701+
1702+
if (qca_is_wcn399x(soc_type)) {
1703+
host_set_baudrate(hu, 2400);
1704+
qca_send_power_pulse(hu, false);
1705+
qca_regulator_disable(qcadev);
1706+
} else {
1707+
gpiod_set_value_cansleep(qcadev->bt_en, 0);
1708+
}
17051709
}
17061710

17071711
static int qca_power_off(struct hci_dev *hdev)

0 commit comments

Comments
 (0)