diff options
author | Matthias Kaehlcke <mka@chromium.org> | 2019-02-27 18:52:23 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2019-03-02 11:39:28 -0500 |
commit | 94d66714739242d5f6f7410bf044239e33226073 (patch) | |
tree | 7882ae3848e3b0f3934669f7801454e29fd192b6 /drivers/bluetooth | |
parent | 5364a0b4f4be0b429836426c4a43f2a9ff9597b2 (diff) |
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 <mka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/hci_qca.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 82f6cec4f71e..237aea34b69f 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c | |||
@@ -59,8 +59,7 @@ | |||
59 | 59 | ||
60 | #define IBS_WAKE_RETRANS_TIMEOUT_MS 100 | 60 | #define IBS_WAKE_RETRANS_TIMEOUT_MS 100 |
61 | #define IBS_TX_IDLE_TIMEOUT_MS 2000 | 61 | #define IBS_TX_IDLE_TIMEOUT_MS 2000 |
62 | #define BAUDRATE_SETTLE_TIMEOUT_MS 300 | 62 | #define CMD_TRANS_TIMEOUT_MS 100 |
63 | #define POWER_PULSE_TRANS_TIMEOUT_MS 100 | ||
64 | 63 | ||
65 | /* susclk rate */ | 64 | /* susclk rate */ |
66 | #define SUSCLK_RATE_32KHZ 32768 | 65 | #define SUSCLK_RATE_32KHZ 32768 |
@@ -964,6 +963,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) | |||
964 | { | 963 | { |
965 | struct hci_uart *hu = hci_get_drvdata(hdev); | 964 | struct hci_uart *hu = hci_get_drvdata(hdev); |
966 | struct qca_data *qca = hu->priv; | 965 | struct qca_data *qca = hu->priv; |
966 | struct qca_serdev *qcadev; | ||
967 | struct sk_buff *skb; | 967 | struct sk_buff *skb; |
968 | u8 cmd[] = { 0x01, 0x48, 0xFC, 0x01, 0x00 }; | 968 | u8 cmd[] = { 0x01, 0x48, 0xFC, 0x01, 0x00 }; |
969 | 969 | ||
@@ -985,11 +985,21 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate) | |||
985 | skb_queue_tail(&qca->txq, skb); | 985 | skb_queue_tail(&qca->txq, skb); |
986 | hci_uart_tx_wakeup(hu); | 986 | hci_uart_tx_wakeup(hu); |
987 | 987 | ||
988 | /* wait 300ms to change new baudrate on controller side | 988 | qcadev = serdev_device_get_drvdata(hu->serdev); |
989 | * controller will come back after they receive this HCI command | 989 | |
990 | * then host can communicate with new baudrate to controller | 990 | /* Wait for the baudrate change request to be sent */ |
991 | */ | 991 | |
992 | msleep(BAUDRATE_SETTLE_TIMEOUT_MS); | 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); | ||
993 | 1003 | ||
994 | return 0; | 1004 | return 0; |
995 | } | 1005 | } |
@@ -1005,7 +1015,7 @@ static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed) | |||
1005 | static int qca_send_power_pulse(struct hci_uart *hu, bool on) | 1015 | static int qca_send_power_pulse(struct hci_uart *hu, bool on) |
1006 | { | 1016 | { |
1007 | int ret; | 1017 | int ret; |
1008 | int timeout = msecs_to_jiffies(POWER_PULSE_TRANS_TIMEOUT_MS); | 1018 | int timeout = msecs_to_jiffies(CMD_TRANS_TIMEOUT_MS); |
1009 | u8 cmd = on ? QCA_WCN3990_POWERON_PULSE : QCA_WCN3990_POWEROFF_PULSE; | 1019 | u8 cmd = on ? QCA_WCN3990_POWERON_PULSE : QCA_WCN3990_POWEROFF_PULSE; |
1010 | 1020 | ||
1011 | /* These power pulses are single byte command which are sent | 1021 | /* These power pulses are single byte command which are sent |