Skip to content

Commit 94d6671

Browse files
Matthias Kaehlckeholtmann
authored andcommitted
Bluetooth: hci_qca: Reduce delay after sending baudrate request for WCN3990
The current 300ms delay after a baudrate change is extremely long. For WCN3990 it is sufficient to wait 10ms after the baudrate change request has been sent over the wire. Signed-off-by: Matthias Kaehlcke <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 5364a0b commit 94d6671

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

drivers/bluetooth/hci_qca.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959

6060
#define IBS_WAKE_RETRANS_TIMEOUT_MS 100
6161
#define IBS_TX_IDLE_TIMEOUT_MS 2000
62-
#define BAUDRATE_SETTLE_TIMEOUT_MS 300
63-
#define POWER_PULSE_TRANS_TIMEOUT_MS 100
62+
#define CMD_TRANS_TIMEOUT_MS 100
6463

6564
/* susclk rate */
6665
#define SUSCLK_RATE_32KHZ 32768
@@ -964,6 +963,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
964963
{
965964
struct hci_uart *hu = hci_get_drvdata(hdev);
966965
struct qca_data *qca = hu->priv;
966+
struct qca_serdev *qcadev;
967967
struct sk_buff *skb;
968968
u8 cmd[] = { 0x01, 0x48, 0xFC, 0x01, 0x00 };
969969

@@ -985,11 +985,21 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
985985
skb_queue_tail(&qca->txq, skb);
986986
hci_uart_tx_wakeup(hu);
987987

988-
/* wait 300ms to change new baudrate on controller side
989-
* controller will come back after they receive this HCI command
990-
* then host can communicate with new baudrate to controller
991-
*/
992-
msleep(BAUDRATE_SETTLE_TIMEOUT_MS);
988+
qcadev = serdev_device_get_drvdata(hu->serdev);
989+
990+
/* Wait for the baudrate change request to be sent */
991+
992+
while (!skb_queue_empty(&qca->txq))
993+
usleep_range(100, 200);
994+
995+
serdev_device_wait_until_sent(hu->serdev,
996+
msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS));
997+
998+
/* Give the controller time to process the request */
999+
if (qcadev->btsoc_type == QCA_WCN3990)
1000+
msleep(10);
1001+
else
1002+
msleep(300);
9931003

9941004
return 0;
9951005
}
@@ -1005,7 +1015,7 @@ static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed)
10051015
static int qca_send_power_pulse(struct hci_uart *hu, bool on)
10061016
{
10071017
int ret;
1008-
int timeout = msecs_to_jiffies(POWER_PULSE_TRANS_TIMEOUT_MS);
1018+
int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS);
10091019
u8 cmd = on ? QCA_WCN3990_POWERON_PULSE : QCA_WCN3990_POWEROFF_PULSE;
10101020

10111021
/* These power pulses are single byte command which are sent

0 commit comments

Comments
 (0)