--- zzzz-none-000/linux-4.4.271/drivers/bluetooth/hci_qca.c 2021-06-03 06:22:09.000000000 +0000 +++ maple-fsgw-759/linux-4.4.271/drivers/bluetooth/hci_qca.c 2023-12-20 10:37:06.000000000 +0000 @@ -231,11 +231,11 @@ BT_DBG("hu %p wq awake device", hu); + spin_lock(&qca->hci_ibs_lock); + /* Vote for serial clock */ serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu); - spin_lock(&qca->hci_ibs_lock); - /* Send wake indication to device */ if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0) BT_ERR("Failed to send WAKE to device"); @@ -260,9 +260,10 @@ BT_DBG("hu %p wq awake rx", hu); + spin_lock(&qca->hci_ibs_lock); + serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu); - spin_lock(&qca->hci_ibs_lock); qca->rx_ibs_state = HCI_IBS_RX_AWAKE; /* Always acknowledge device wake up, @@ -287,7 +288,11 @@ BT_DBG("hu %p rx clock vote off", hu); + spin_lock(&qca->hci_ibs_lock); + serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_OFF, hu); + + spin_unlock(&qca->hci_ibs_lock); } static void qca_wq_serial_tx_clock_vote_off(struct work_struct *work) @@ -298,6 +303,8 @@ BT_DBG("hu %p tx clock vote off", hu); + spin_lock(&qca->hci_ibs_lock); + /* Run HCI tx handling unlocked */ hci_uart_tx_wakeup(hu); @@ -305,6 +312,8 @@ * It is up to the tty driver to pend the clocks off until tx done. */ serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_OFF, hu); + + spin_unlock(&qca->hci_ibs_lock); } static void hci_ibs_tx_idle_timeout(unsigned long arg) @@ -520,8 +529,12 @@ BT_DBG("hu %p qca close", hu); + spin_lock(&qca->hci_ibs_lock); + serial_clock_vote(HCI_IBS_VOTE_STATS_UPDATE, hu); + spin_unlock(&qca->hci_ibs_lock); + skb_queue_purge(&qca->tx_wait_q); skb_queue_purge(&qca->txq); del_timer(&qca->tx_idle_timer);