Lines Matching +full:vddaon +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0-only
5 * HCI_IBS (HCI In-Band Sleep) is Qualcomm's power management
13 * Written by Ohad Ben-Cohen <ohad@bencohen.org>
243 if (hu->serdev) { in qca_soc_type()
244 struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev); in qca_soc_type()
246 soc_type = qsd->btsoc_type; in qca_soc_type()
256 if (hu->serdev) { in qca_get_firmware_name()
257 struct qca_serdev *qsd = serdev_device_get_drvdata(hu->serdev); in qca_get_firmware_name()
259 return qsd->firmware_name; in qca_get_firmware_name()
284 struct qca_data *qca = hu->priv; in serial_clock_vote()
287 bool old_vote = (qca->tx_vote | qca->rx_vote); in serial_clock_vote()
292 diff = jiffies_to_msecs(jiffies - qca->vote_last_jif); in serial_clock_vote()
295 qca->vote_off_ms += diff; in serial_clock_vote()
297 qca->vote_on_ms += diff; in serial_clock_vote()
301 qca->tx_vote = true; in serial_clock_vote()
302 qca->tx_votes_on++; in serial_clock_vote()
306 qca->rx_vote = true; in serial_clock_vote()
307 qca->rx_votes_on++; in serial_clock_vote()
311 qca->tx_vote = false; in serial_clock_vote()
312 qca->tx_votes_off++; in serial_clock_vote()
316 qca->rx_vote = false; in serial_clock_vote()
317 qca->rx_votes_off++; in serial_clock_vote()
325 new_vote = qca->rx_vote | qca->tx_vote; in serial_clock_vote()
329 __serial_clock_on(hu->tty); in serial_clock_vote()
331 __serial_clock_off(hu->tty); in serial_clock_vote()
336 diff = jiffies_to_msecs(jiffies - qca->vote_last_jif); in serial_clock_vote()
339 qca->votes_on++; in serial_clock_vote()
340 qca->vote_off_ms += diff; in serial_clock_vote()
342 qca->votes_off++; in serial_clock_vote()
343 qca->vote_on_ms += diff; in serial_clock_vote()
345 qca->vote_last_jif = jiffies; in serial_clock_vote()
356 struct qca_data *qca = hu->priv; in send_hci_ibs_cmd()
363 return -ENOMEM; in send_hci_ibs_cmd()
369 skb_queue_tail(&qca->txq, skb); in send_hci_ibs_cmd()
378 struct hci_uart *hu = qca->hu; in qca_wq_awake_device()
387 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in qca_wq_awake_device()
393 qca->ibs_sent_wakes++; in qca_wq_awake_device()
396 retrans_delay = msecs_to_jiffies(qca->wake_retrans); in qca_wq_awake_device()
397 mod_timer(&qca->wake_retrans_timer, jiffies + retrans_delay); in qca_wq_awake_device()
399 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_wq_awake_device()
409 struct hci_uart *hu = qca->hu; in qca_wq_awake_rx()
416 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in qca_wq_awake_rx()
417 qca->rx_ibs_state = HCI_IBS_RX_AWAKE; in qca_wq_awake_rx()
425 qca->ibs_sent_wacks++; in qca_wq_awake_rx()
427 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_wq_awake_rx()
437 struct hci_uart *hu = qca->hu; in qca_wq_serial_rx_clock_vote_off()
448 struct hci_uart *hu = qca->hu; in qca_wq_serial_tx_clock_vote_off()
464 struct hci_uart *hu = qca->hu; in hci_ibs_tx_idle_timeout()
467 BT_DBG("hu %p idle timeout in %d state", hu, qca->tx_ibs_state); in hci_ibs_tx_idle_timeout()
469 spin_lock_irqsave_nested(&qca->hci_ibs_lock, in hci_ibs_tx_idle_timeout()
472 switch (qca->tx_ibs_state) { in hci_ibs_tx_idle_timeout()
479 qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; in hci_ibs_tx_idle_timeout()
480 qca->ibs_sent_slps++; in hci_ibs_tx_idle_timeout()
481 queue_work(qca->workqueue, &qca->ws_tx_vote_off); in hci_ibs_tx_idle_timeout()
487 BT_ERR("Spurious timeout tx state %d", qca->tx_ibs_state); in hci_ibs_tx_idle_timeout()
491 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in hci_ibs_tx_idle_timeout()
497 struct hci_uart *hu = qca->hu; in hci_ibs_wake_retrans_timeout()
502 hu, qca->tx_ibs_state); in hci_ibs_wake_retrans_timeout()
504 spin_lock_irqsave_nested(&qca->hci_ibs_lock, in hci_ibs_wake_retrans_timeout()
508 if (test_bit(QCA_SUSPENDING, &qca->flags)) { in hci_ibs_wake_retrans_timeout()
509 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in hci_ibs_wake_retrans_timeout()
513 switch (qca->tx_ibs_state) { in hci_ibs_wake_retrans_timeout()
521 qca->ibs_sent_wakes++; in hci_ibs_wake_retrans_timeout()
522 retrans_delay = msecs_to_jiffies(qca->wake_retrans); in hci_ibs_wake_retrans_timeout()
523 mod_timer(&qca->wake_retrans_timer, jiffies + retrans_delay); in hci_ibs_wake_retrans_timeout()
529 BT_ERR("Spurious timeout tx state %d", qca->tx_ibs_state); in hci_ibs_wake_retrans_timeout()
533 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in hci_ibs_wake_retrans_timeout()
544 struct hci_uart *hu = qca->hu; in qca_controller_memdump_timeout()
546 mutex_lock(&qca->hci_memdump_lock); in qca_controller_memdump_timeout()
547 if (test_bit(QCA_MEMDUMP_COLLECTION, &qca->flags)) { in qca_controller_memdump_timeout()
548 qca->memdump_state = QCA_MEMDUMP_TIMEOUT; in qca_controller_memdump_timeout()
549 if (!test_bit(QCA_HW_ERROR_EVENT, &qca->flags)) { in qca_controller_memdump_timeout()
553 hci_reset_dev(hu->hdev); in qca_controller_memdump_timeout()
557 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump_timeout()
570 return -EOPNOTSUPP; in qca_open()
574 return -ENOMEM; in qca_open()
576 skb_queue_head_init(&qca->txq); in qca_open()
577 skb_queue_head_init(&qca->tx_wait_q); in qca_open()
578 skb_queue_head_init(&qca->rx_memdump_q); in qca_open()
579 spin_lock_init(&qca->hci_ibs_lock); in qca_open()
580 mutex_init(&qca->hci_memdump_lock); in qca_open()
581 qca->workqueue = alloc_ordered_workqueue("qca_wq", 0); in qca_open()
582 if (!qca->workqueue) { in qca_open()
585 return -ENOMEM; in qca_open()
588 INIT_WORK(&qca->ws_awake_rx, qca_wq_awake_rx); in qca_open()
589 INIT_WORK(&qca->ws_awake_device, qca_wq_awake_device); in qca_open()
590 INIT_WORK(&qca->ws_rx_vote_off, qca_wq_serial_rx_clock_vote_off); in qca_open()
591 INIT_WORK(&qca->ws_tx_vote_off, qca_wq_serial_tx_clock_vote_off); in qca_open()
592 INIT_WORK(&qca->ctrl_memdump_evt, qca_controller_memdump); in qca_open()
593 INIT_DELAYED_WORK(&qca->ctrl_memdump_timeout, in qca_open()
595 init_waitqueue_head(&qca->suspend_wait_q); in qca_open()
597 qca->hu = hu; in qca_open()
598 init_completion(&qca->drop_ev_comp); in qca_open()
600 /* Assume we start with both sides asleep -- extra wakes OK */ in qca_open()
601 qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; in qca_open()
602 qca->rx_ibs_state = HCI_IBS_RX_ASLEEP; in qca_open()
604 qca->vote_last_jif = jiffies; in qca_open()
606 hu->priv = qca; in qca_open()
608 if (hu->serdev) { in qca_open()
609 qcadev = serdev_device_get_drvdata(hu->serdev); in qca_open()
611 switch (qcadev->btsoc_type) { in qca_open()
617 hu->init_speed = qcadev->init_speed; in qca_open()
624 if (qcadev->oper_speed) in qca_open()
625 hu->oper_speed = qcadev->oper_speed; in qca_open()
628 timer_setup(&qca->wake_retrans_timer, hci_ibs_wake_retrans_timeout, 0); in qca_open()
629 qca->wake_retrans = IBS_WAKE_RETRANS_TIMEOUT_MS; in qca_open()
631 timer_setup(&qca->tx_idle_timer, hci_ibs_tx_idle_timeout, 0); in qca_open()
632 qca->tx_idle_delay = IBS_HOST_TX_IDLE_TIMEOUT_MS; in qca_open()
635 qca->tx_idle_delay, qca->wake_retrans); in qca_open()
643 struct qca_data *qca = hu->priv; in qca_debugfs_init()
647 if (!hdev->debugfs) in qca_debugfs_init()
650 if (test_and_set_bit(QCA_DEBUGFS_CREATED, &qca->flags)) in qca_debugfs_init()
653 ibs_dir = debugfs_create_dir("ibs", hdev->debugfs); in qca_debugfs_init()
657 debugfs_create_u8("tx_ibs_state", mode, ibs_dir, &qca->tx_ibs_state); in qca_debugfs_init()
658 debugfs_create_u8("rx_ibs_state", mode, ibs_dir, &qca->rx_ibs_state); in qca_debugfs_init()
660 &qca->ibs_sent_slps); in qca_debugfs_init()
662 &qca->ibs_sent_wakes); in qca_debugfs_init()
664 &qca->ibs_sent_wacks); in qca_debugfs_init()
666 &qca->ibs_recv_slps); in qca_debugfs_init()
668 &qca->ibs_recv_wakes); in qca_debugfs_init()
670 &qca->ibs_recv_wacks); in qca_debugfs_init()
671 debugfs_create_bool("tx_vote", mode, ibs_dir, &qca->tx_vote); in qca_debugfs_init()
672 debugfs_create_u64("tx_votes_on", mode, ibs_dir, &qca->tx_votes_on); in qca_debugfs_init()
673 debugfs_create_u64("tx_votes_off", mode, ibs_dir, &qca->tx_votes_off); in qca_debugfs_init()
674 debugfs_create_bool("rx_vote", mode, ibs_dir, &qca->rx_vote); in qca_debugfs_init()
675 debugfs_create_u64("rx_votes_on", mode, ibs_dir, &qca->rx_votes_on); in qca_debugfs_init()
676 debugfs_create_u64("rx_votes_off", mode, ibs_dir, &qca->rx_votes_off); in qca_debugfs_init()
677 debugfs_create_u64("votes_on", mode, ibs_dir, &qca->votes_on); in qca_debugfs_init()
678 debugfs_create_u64("votes_off", mode, ibs_dir, &qca->votes_off); in qca_debugfs_init()
679 debugfs_create_u32("vote_on_ms", mode, ibs_dir, &qca->vote_on_ms); in qca_debugfs_init()
680 debugfs_create_u32("vote_off_ms", mode, ibs_dir, &qca->vote_off_ms); in qca_debugfs_init()
684 debugfs_create_u32("wake_retrans", mode, ibs_dir, &qca->wake_retrans); in qca_debugfs_init()
686 &qca->tx_idle_delay); in qca_debugfs_init()
692 struct qca_data *qca = hu->priv; in qca_flush()
696 skb_queue_purge(&qca->tx_wait_q); in qca_flush()
697 skb_queue_purge(&qca->txq); in qca_flush()
705 struct qca_data *qca = hu->priv; in qca_close()
711 skb_queue_purge(&qca->tx_wait_q); in qca_close()
712 skb_queue_purge(&qca->txq); in qca_close()
713 skb_queue_purge(&qca->rx_memdump_q); in qca_close()
720 timer_shutdown_sync(&qca->tx_idle_timer); in qca_close()
721 timer_shutdown_sync(&qca->wake_retrans_timer); in qca_close()
722 destroy_workqueue(qca->workqueue); in qca_close()
723 qca->hu = NULL; in qca_close()
725 kfree_skb(qca->rx_skb); in qca_close()
727 hu->priv = NULL; in qca_close()
734 /* Called upon a wake-up-indication from the device.
739 struct qca_data *qca = hu->priv; in device_want_to_wakeup()
743 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in device_want_to_wakeup()
745 qca->ibs_recv_wakes++; in device_want_to_wakeup()
748 if (test_bit(QCA_SUSPENDING, &qca->flags)) { in device_want_to_wakeup()
749 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_want_to_wakeup()
753 switch (qca->rx_ibs_state) { in device_want_to_wakeup()
755 /* Make sure clock is on - we may have turned clock off since in device_want_to_wakeup()
758 queue_work(qca->workqueue, &qca->ws_awake_rx); in device_want_to_wakeup()
759 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_want_to_wakeup()
770 qca->ibs_sent_wacks++; in device_want_to_wakeup()
776 qca->rx_ibs_state); in device_want_to_wakeup()
780 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_want_to_wakeup()
786 /* Called upon a sleep-indication from the device.
791 struct qca_data *qca = hu->priv; in device_want_to_sleep()
793 BT_DBG("hu %p want to sleep in %d state", hu, qca->rx_ibs_state); in device_want_to_sleep()
795 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in device_want_to_sleep()
797 qca->ibs_recv_slps++; in device_want_to_sleep()
799 switch (qca->rx_ibs_state) { in device_want_to_sleep()
802 qca->rx_ibs_state = HCI_IBS_RX_ASLEEP; in device_want_to_sleep()
804 queue_work(qca->workqueue, &qca->ws_rx_vote_off); in device_want_to_sleep()
813 qca->rx_ibs_state); in device_want_to_sleep()
817 wake_up_interruptible(&qca->suspend_wait_q); in device_want_to_sleep()
819 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_want_to_sleep()
822 /* Called upon wake-up-acknowledgement from the device
827 struct qca_data *qca = hu->priv; in device_woke_up()
832 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in device_woke_up()
834 qca->ibs_recv_wacks++; in device_woke_up()
836 /* Don't react to the wake-up-acknowledgment when suspending. */ in device_woke_up()
837 if (test_bit(QCA_SUSPENDING, &qca->flags)) { in device_woke_up()
838 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_woke_up()
842 switch (qca->tx_ibs_state) { in device_woke_up()
846 qca->tx_ibs_state); in device_woke_up()
851 while ((skb = skb_dequeue(&qca->tx_wait_q))) in device_woke_up()
852 skb_queue_tail(&qca->txq, skb); in device_woke_up()
855 del_timer(&qca->wake_retrans_timer); in device_woke_up()
856 idle_delay = msecs_to_jiffies(qca->tx_idle_delay); in device_woke_up()
857 mod_timer(&qca->tx_idle_timer, jiffies + idle_delay); in device_woke_up()
858 qca->tx_ibs_state = HCI_IBS_TX_AWAKE; in device_woke_up()
864 qca->tx_ibs_state); in device_woke_up()
868 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in device_woke_up()
880 struct qca_data *qca = hu->priv; in qca_enqueue()
883 qca->tx_ibs_state); in qca_enqueue()
885 if (test_bit(QCA_SSR_TRIGGERED, &qca->flags)) { in qca_enqueue()
887 bt_dev_dbg(hu->hdev, "SSR is in progress"); in qca_enqueue()
895 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in qca_enqueue()
898 * Out-Of-Band(GPIOs control) sleep is selected. in qca_enqueue()
901 if (test_bit(QCA_IBS_DISABLED, &qca->flags) || in qca_enqueue()
902 test_bit(QCA_SUSPENDING, &qca->flags)) { in qca_enqueue()
903 skb_queue_tail(&qca->txq, skb); in qca_enqueue()
904 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_enqueue()
909 switch (qca->tx_ibs_state) { in qca_enqueue()
912 skb_queue_tail(&qca->txq, skb); in qca_enqueue()
913 idle_delay = msecs_to_jiffies(qca->tx_idle_delay); in qca_enqueue()
914 mod_timer(&qca->tx_idle_timer, jiffies + idle_delay); in qca_enqueue()
920 skb_queue_tail(&qca->tx_wait_q, skb); in qca_enqueue()
922 qca->tx_ibs_state = HCI_IBS_TX_WAKING; in qca_enqueue()
924 queue_work(qca->workqueue, &qca->ws_awake_device); in qca_enqueue()
930 skb_queue_tail(&qca->tx_wait_q, skb); in qca_enqueue()
935 qca->tx_ibs_state); in qca_enqueue()
940 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_enqueue()
988 if (get_unaligned_le16(skb->data) == QCA_DEBUG_HANDLE) in qca_recv_acl_data()
997 struct qca_data *qca = hu->priv; in qca_dmp_hdr()
1001 qca->controller_id); in qca_dmp_hdr()
1005 qca->fw_version); in qca_dmp_hdr()
1012 hu->serdev->dev.driver->name); in qca_dmp_hdr()
1020 struct hci_uart *hu = qca->hu; in qca_controller_memdump()
1023 struct qca_memdump_info *qca_memdump = qca->qca_memdump; in qca_controller_memdump()
1030 while ((skb = skb_dequeue(&qca->rx_memdump_q))) { in qca_controller_memdump()
1032 mutex_lock(&qca->hci_memdump_lock); in qca_controller_memdump()
1036 if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || in qca_controller_memdump()
1037 qca->memdump_state == QCA_MEMDUMP_COLLECTED) { in qca_controller_memdump()
1038 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1046 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1050 qca->qca_memdump = qca_memdump; in qca_controller_memdump()
1053 qca->memdump_state = QCA_MEMDUMP_COLLECTING; in qca_controller_memdump()
1054 cmd_hdr = (void *) skb->data; in qca_controller_memdump()
1055 seq_no = __le16_to_cpu(cmd_hdr->seq_no); in qca_controller_memdump()
1066 set_bit(QCA_IBS_DISABLED, &qca->flags); in qca_controller_memdump()
1067 set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_controller_memdump()
1068 dump = (void *) skb->data; in qca_controller_memdump()
1069 qca_memdump->ram_dump_size = __le32_to_cpu(dump->dump_size); in qca_controller_memdump()
1070 if (!(qca_memdump->ram_dump_size)) { in qca_controller_memdump()
1071 bt_dev_err(hu->hdev, "Rx invalid memdump size"); in qca_controller_memdump()
1074 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1078 queue_delayed_work(qca->workqueue, in qca_controller_memdump()
1079 &qca->ctrl_memdump_timeout, in qca_controller_memdump()
1081 skb_pull(skb, sizeof(qca_memdump->ram_dump_size)); in qca_controller_memdump()
1082 qca_memdump->current_seq_no = 0; in qca_controller_memdump()
1083 qca_memdump->received_dump = 0; in qca_controller_memdump()
1084 ret = hci_devcd_init(hu->hdev, qca_memdump->ram_dump_size); in qca_controller_memdump()
1085 bt_dev_info(hu->hdev, "hci_devcd_init Return:%d", in qca_controller_memdump()
1088 kfree(qca->qca_memdump); in qca_controller_memdump()
1089 qca->qca_memdump = NULL; in qca_controller_memdump()
1090 qca->memdump_state = QCA_MEMDUMP_COLLECTED; in qca_controller_memdump()
1091 cancel_delayed_work(&qca->ctrl_memdump_timeout); in qca_controller_memdump()
1092 clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_controller_memdump()
1093 clear_bit(QCA_IBS_DISABLED, &qca->flags); in qca_controller_memdump()
1094 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1098 bt_dev_info(hu->hdev, "QCA collecting dump of size:%u", in qca_controller_memdump()
1099 qca_memdump->ram_dump_size); in qca_controller_memdump()
1106 if (!test_bit(QCA_MEMDUMP_COLLECTION, &qca->flags)) { in qca_controller_memdump()
1107 bt_dev_err(hu->hdev, "QCA: Discarding other packets"); in qca_controller_memdump()
1110 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1121 while ((seq_no > qca_memdump->current_seq_no + 1) && in qca_controller_memdump()
1124 bt_dev_err(hu->hdev, "QCA controller missed packet:%d", in qca_controller_memdump()
1125 qca_memdump->current_seq_no); in qca_controller_memdump()
1126 rx_size = qca_memdump->received_dump; in qca_controller_memdump()
1128 if (rx_size > qca_memdump->ram_dump_size) { in qca_controller_memdump()
1129 bt_dev_err(hu->hdev, in qca_controller_memdump()
1131 qca_memdump->received_dump); in qca_controller_memdump()
1134 hci_devcd_append_pattern(hu->hdev, 0x00, in qca_controller_memdump()
1136 qca_memdump->received_dump += QCA_DUMP_PACKET_SIZE; in qca_controller_memdump()
1137 qca_memdump->current_seq_no++; in qca_controller_memdump()
1140 rx_size = qca_memdump->received_dump + skb->len; in qca_controller_memdump()
1141 if (rx_size <= qca_memdump->ram_dump_size) { in qca_controller_memdump()
1143 (seq_no != qca_memdump->current_seq_no)) { in qca_controller_memdump()
1144 bt_dev_err(hu->hdev, in qca_controller_memdump()
1148 bt_dev_dbg(hu->hdev, in qca_controller_memdump()
1150 seq_no, skb->len); in qca_controller_memdump()
1151 hci_devcd_append(hu->hdev, skb); in qca_controller_memdump()
1152 qca_memdump->current_seq_no += 1; in qca_controller_memdump()
1153 qca_memdump->received_dump = rx_size; in qca_controller_memdump()
1155 bt_dev_err(hu->hdev, in qca_controller_memdump()
1157 qca_memdump->current_seq_no); in qca_controller_memdump()
1161 bt_dev_info(hu->hdev, in qca_controller_memdump()
1163 qca_memdump->received_dump, in qca_controller_memdump()
1164 qca_memdump->ram_dump_size); in qca_controller_memdump()
1165 hci_devcd_complete(hu->hdev); in qca_controller_memdump()
1166 cancel_delayed_work(&qca->ctrl_memdump_timeout); in qca_controller_memdump()
1167 kfree(qca->qca_memdump); in qca_controller_memdump()
1168 qca->qca_memdump = NULL; in qca_controller_memdump()
1169 qca->memdump_state = QCA_MEMDUMP_COLLECTED; in qca_controller_memdump()
1170 clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_controller_memdump()
1173 mutex_unlock(&qca->hci_memdump_lock); in qca_controller_memdump()
1182 struct qca_data *qca = hu->priv; in qca_controller_memdump_event()
1184 set_bit(QCA_SSR_TRIGGERED, &qca->flags); in qca_controller_memdump_event()
1185 skb_queue_tail(&qca->rx_memdump_q, skb); in qca_controller_memdump_event()
1186 queue_work(qca->workqueue, &qca->ctrl_memdump_evt); in qca_controller_memdump_event()
1194 struct qca_data *qca = hu->priv; in qca_recv_event()
1196 if (test_bit(QCA_DROP_VENDOR_EVENT, &qca->flags)) { in qca_recv_event()
1197 struct hci_event_hdr *hdr = (void *)skb->data; in qca_recv_event()
1209 if (hdr->evt == HCI_EV_VENDOR) in qca_recv_event()
1210 complete(&qca->drop_ev_comp); in qca_recv_event()
1221 if ((skb->data[0] == HCI_VENDOR_PKT) && in qca_recv_event()
1222 (get_unaligned_be16(skb->data + 2) == QCA_SSR_DUMP_HANDLE)) in qca_recv_event()
1260 struct qca_data *qca = hu->priv; in qca_recv()
1262 if (!test_bit(HCI_UART_REGISTERED, &hu->flags)) in qca_recv()
1263 return -EUNATCH; in qca_recv()
1265 qca->rx_skb = h4_recv_buf(hu->hdev, qca->rx_skb, data, count, in qca_recv()
1267 if (IS_ERR(qca->rx_skb)) { in qca_recv()
1268 int err = PTR_ERR(qca->rx_skb); in qca_recv()
1269 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err); in qca_recv()
1270 qca->rx_skb = NULL; in qca_recv()
1279 struct qca_data *qca = hu->priv; in qca_dequeue()
1281 return skb_dequeue(&qca->txq); in qca_dequeue()
1323 struct qca_data *qca = hu->priv; in qca_set_baudrate()
1328 return -EINVAL; in qca_set_baudrate()
1335 return -ENOMEM; in qca_set_baudrate()
1342 skb_queue_tail(&qca->txq, skb); in qca_set_baudrate()
1347 while (!skb_queue_empty(&qca->txq)) in qca_set_baudrate()
1350 if (hu->serdev) in qca_set_baudrate()
1351 serdev_device_wait_until_sent(hu->serdev, in qca_set_baudrate()
1375 if (hu->serdev) in host_set_baudrate()
1376 serdev_device_set_baudrate(hu->serdev, speed); in host_set_baudrate()
1390 * For example, wcn3990 supports RF COEX antenna for both Wi-Fi/BT in qca_send_power_pulse()
1392 * Wi-Fi/BT. Powering up the power sources will not enable BT, until in qca_send_power_pulse()
1397 bt_dev_dbg(hu->hdev, "sending power pulse %02x to controller", cmd); in qca_send_power_pulse()
1399 serdev_device_write_flush(hu->serdev); in qca_send_power_pulse()
1401 ret = serdev_device_write_buf(hu->serdev, &cmd, sizeof(cmd)); in qca_send_power_pulse()
1403 bt_dev_err(hu->hdev, "failed to send power pulse %02x", cmd); in qca_send_power_pulse()
1407 serdev_device_wait_until_sent(hu->serdev, timeout); in qca_send_power_pulse()
1425 if (hu->init_speed) in qca_get_speed()
1426 speed = hu->init_speed; in qca_get_speed()
1427 else if (hu->proto->init_speed) in qca_get_speed()
1428 speed = hu->proto->init_speed; in qca_get_speed()
1430 if (hu->oper_speed) in qca_get_speed()
1431 speed = hu->oper_speed; in qca_get_speed()
1432 else if (hu->proto->oper_speed) in qca_get_speed()
1433 speed = hu->proto->oper_speed; in qca_get_speed()
1451 return -EINVAL; in qca_check_speeds()
1457 return -EINVAL; in qca_check_speeds()
1466 struct qca_data *qca = hu->priv; in qca_set_speed()
1500 reinit_completion(&qca->drop_ev_comp); in qca_set_speed()
1501 set_bit(QCA_DROP_VENDOR_EVENT, &qca->flags); in qca_set_speed()
1509 bt_dev_dbg(hu->hdev, "Set UART speed to %d", speed); in qca_set_speed()
1510 ret = qca_set_baudrate(hu->hdev, qca_baudrate); in qca_set_speed()
1537 if (!wait_for_completion_timeout(&qca->drop_ev_comp, in qca_set_speed()
1539 bt_dev_err(hu->hdev, in qca_set_speed()
1541 ret = -ETIMEDOUT; in qca_set_speed()
1544 clear_bit(QCA_DROP_VENDOR_EVENT, &qca->flags); in qca_set_speed()
1557 struct qca_data *qca = hu->priv; in qca_send_crashbuffer()
1562 bt_dev_err(hu->hdev, "Failed to allocate memory for skb packet"); in qca_send_crashbuffer()
1563 return -ENOMEM; in qca_send_crashbuffer()
1573 bt_dev_info(hu->hdev, "crash the soc to collect controller dump"); in qca_send_crashbuffer()
1574 skb_queue_tail(&qca->txq, skb); in qca_send_crashbuffer()
1583 struct qca_data *qca = hu->priv; in qca_wait_for_dump_collection()
1585 wait_on_bit_timeout(&qca->flags, QCA_MEMDUMP_COLLECTION, in qca_wait_for_dump_collection()
1588 clear_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_wait_for_dump_collection()
1594 struct qca_data *qca = hu->priv; in qca_hw_error()
1596 set_bit(QCA_SSR_TRIGGERED, &qca->flags); in qca_hw_error()
1597 set_bit(QCA_HW_ERROR_EVENT, &qca->flags); in qca_hw_error()
1598 bt_dev_info(hdev, "mem_dump_status: %d", qca->memdump_state); in qca_hw_error()
1600 if (qca->memdump_state == QCA_MEMDUMP_IDLE) { in qca_hw_error()
1607 set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_hw_error()
1610 } else if (qca->memdump_state == QCA_MEMDUMP_COLLECTING) { in qca_hw_error()
1618 mutex_lock(&qca->hci_memdump_lock); in qca_hw_error()
1619 if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { in qca_hw_error()
1620 bt_dev_err(hu->hdev, "clearing allocated memory due to memdump timeout"); in qca_hw_error()
1621 hci_devcd_abort(hu->hdev); in qca_hw_error()
1622 if (qca->qca_memdump) { in qca_hw_error()
1623 kfree(qca->qca_memdump); in qca_hw_error()
1624 qca->qca_memdump = NULL; in qca_hw_error()
1626 qca->memdump_state = QCA_MEMDUMP_TIMEOUT; in qca_hw_error()
1627 cancel_delayed_work(&qca->ctrl_memdump_timeout); in qca_hw_error()
1629 mutex_unlock(&qca->hci_memdump_lock); in qca_hw_error()
1631 if (qca->memdump_state == QCA_MEMDUMP_TIMEOUT || in qca_hw_error()
1632 qca->memdump_state == QCA_MEMDUMP_COLLECTED) { in qca_hw_error()
1633 cancel_work_sync(&qca->ctrl_memdump_evt); in qca_hw_error()
1634 skb_queue_purge(&qca->rx_memdump_q); in qca_hw_error()
1637 clear_bit(QCA_HW_ERROR_EVENT, &qca->flags); in qca_hw_error()
1643 struct qca_data *qca = hu->priv; in qca_cmd_timeout()
1645 set_bit(QCA_SSR_TRIGGERED, &qca->flags); in qca_cmd_timeout()
1646 if (qca->memdump_state == QCA_MEMDUMP_IDLE) { in qca_cmd_timeout()
1647 set_bit(QCA_MEMDUMP_COLLECTION, &qca->flags); in qca_cmd_timeout()
1650 } else if (qca->memdump_state == QCA_MEMDUMP_COLLECTING) { in qca_cmd_timeout()
1658 mutex_lock(&qca->hci_memdump_lock); in qca_cmd_timeout()
1659 if (qca->memdump_state != QCA_MEMDUMP_COLLECTED) { in qca_cmd_timeout()
1660 qca->memdump_state = QCA_MEMDUMP_TIMEOUT; in qca_cmd_timeout()
1661 if (!test_bit(QCA_HW_ERROR_EVENT, &qca->flags)) { in qca_cmd_timeout()
1665 hci_reset_dev(hu->hdev); in qca_cmd_timeout()
1668 mutex_unlock(&qca->hci_memdump_lock); in qca_cmd_timeout()
1676 if (!hu->serdev) in qca_wakeup()
1683 wakeup = device_may_wakeup(&hu->serdev->ctrl->dev); in qca_wakeup()
1684 bt_dev_dbg(hu->hdev, "wakeup status : %d", wakeup); in qca_wakeup()
1699 qcadev = serdev_device_get_drvdata(hu->serdev); in qca_regulator_init()
1700 if (!qcadev->bt_power->vregs_on) { in qca_regulator_init()
1701 serdev_device_close(hu->serdev); in qca_regulator_init()
1706 ret = serdev_device_open(hu->serdev); in qca_regulator_init()
1708 bt_dev_err(hu->hdev, "failed to open port"); in qca_regulator_init()
1730 if (qcadev->bt_en) { in qca_regulator_init()
1731 gpiod_set_value_cansleep(qcadev->bt_en, 0); in qca_regulator_init()
1733 gpiod_set_value_cansleep(qcadev->bt_en, 1); in qca_regulator_init()
1735 if (qcadev->sw_ctrl) { in qca_regulator_init()
1736 sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl); in qca_regulator_init()
1737 bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state); in qca_regulator_init()
1762 serdev_device_close(hu->serdev); in qca_regulator_init()
1763 ret = serdev_device_open(hu->serdev); in qca_regulator_init()
1765 bt_dev_err(hu->hdev, "failed to open port"); in qca_regulator_init()
1779 struct qca_data *qca = hu->priv; in qca_power_on()
1782 /* Non-serdev device usually is powered by external power in qca_power_on()
1785 if (!hu->serdev) in qca_power_on()
1800 qcadev = serdev_device_get_drvdata(hu->serdev); in qca_power_on()
1801 if (qcadev->bt_en) { in qca_power_on()
1802 gpiod_set_value_cansleep(qcadev->bt_en, 1); in qca_power_on()
1808 clear_bit(QCA_BT_OFF, &qca->flags); in qca_power_on()
1824 struct hci_dev *hdev = hu->hdev; in qca_setup()
1825 struct qca_data *qca = hu->priv; in qca_setup()
1839 clear_bit(QCA_ROM_FW, &qca->flags); in qca_setup()
1841 set_bit(QCA_IBS_DISABLED, &qca->flags); in qca_setup()
1846 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); in qca_setup()
1877 qca->memdump_state = QCA_MEMDUMP_IDLE; in qca_setup()
1884 clear_bit(QCA_SSR_TRIGGERED, &qca->flags); in qca_setup()
1894 qcadev = serdev_device_get_drvdata(hu->serdev); in qca_setup()
1895 if (qcadev->bdaddr_property_broken) in qca_setup()
1896 set_bit(HCI_QUIRK_BDADDR_PROPERTY_BROKEN, &hdev->quirks); in qca_setup()
1940 clear_bit(QCA_IBS_DISABLED, &qca->flags); in qca_setup()
1942 hu->hdev->hw_error = qca_hw_error; in qca_setup()
1943 hu->hdev->cmd_timeout = qca_cmd_timeout; in qca_setup()
1944 if (hu->serdev) { in qca_setup()
1945 if (device_can_wakeup(hu->serdev->ctrl->dev.parent)) in qca_setup()
1946 hu->hdev->wakeup = qca_wakeup; in qca_setup()
1948 } else if (ret == -ENOENT) { in qca_setup()
1949 /* No patch/nvm-config found, run with original fw/config */ in qca_setup()
1950 set_bit(QCA_ROM_FW, &qca->flags); in qca_setup()
1952 } else if (ret == -EAGAIN) { in qca_setup()
1954 * Userspace firmware loader will return -EAGAIN in case no in qca_setup()
1955 * patch/nvm-config is found, so run with original fw/config. in qca_setup()
1957 set_bit(QCA_ROM_FW, &qca->flags); in qca_setup()
1965 if (hu->serdev) { in qca_setup()
1966 serdev_device_close(hu->serdev); in qca_setup()
1967 ret = serdev_device_open(hu->serdev); in qca_setup()
1979 hu->hdev->set_bdaddr = qca_set_bdaddr_rome; in qca_setup()
1981 hu->hdev->set_bdaddr = qca_set_bdaddr; in qca_setup()
1982 qca->fw_version = le16_to_cpu(ver.patch_ver); in qca_setup()
1983 qca->controller_id = le16_to_cpu(ver.rom_ver); in qca_setup()
2064 { "vddaon", 26000 },
2095 { "vddaon", 26000 },
2108 struct qca_data *qca = hu->priv; in qca_power_shutdown()
2117 spin_lock_irqsave(&qca->hci_ibs_lock, flags); in qca_power_shutdown()
2118 set_bit(QCA_IBS_DISABLED, &qca->flags); in qca_power_shutdown()
2120 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_power_shutdown()
2122 /* Non-serdev device usually is powered by external power in qca_power_shutdown()
2125 if (!hu->serdev) in qca_power_shutdown()
2128 qcadev = serdev_device_get_drvdata(hu->serdev); in qca_power_shutdown()
2142 gpiod_set_value_cansleep(qcadev->bt_en, 0); in qca_power_shutdown()
2145 if (qcadev->sw_ctrl) { in qca_power_shutdown()
2146 sw_ctrl_state = gpiod_get_value_cansleep(qcadev->sw_ctrl); in qca_power_shutdown()
2147 bt_dev_dbg(hu->hdev, "SW_CTRL is %d", sw_ctrl_state); in qca_power_shutdown()
2152 gpiod_set_value_cansleep(qcadev->bt_en, 0); in qca_power_shutdown()
2155 set_bit(QCA_BT_OFF, &qca->flags); in qca_power_shutdown()
2161 struct qca_data *qca = hu->priv; in qca_power_off()
2164 hu->hdev->hw_error = NULL; in qca_power_off()
2165 hu->hdev->cmd_timeout = NULL; in qca_power_off()
2167 del_timer_sync(&qca->wake_retrans_timer); in qca_power_off()
2168 del_timer_sync(&qca->tx_idle_timer); in qca_power_off()
2172 && qca->memdump_state == QCA_MEMDUMP_IDLE) { in qca_power_off()
2183 struct qca_power *power = qcadev->bt_power; in qca_regulator_enable()
2187 if (power->vregs_on) in qca_regulator_enable()
2190 BT_DBG("enabling %d regulators)", power->num_vregs); in qca_regulator_enable()
2192 ret = regulator_bulk_enable(power->num_vregs, power->vreg_bulk); in qca_regulator_enable()
2196 power->vregs_on = true; in qca_regulator_enable()
2198 ret = clk_prepare_enable(qcadev->susclk); in qca_regulator_enable()
2212 power = qcadev->bt_power; in qca_regulator_disable()
2215 if (!power->vregs_on) in qca_regulator_disable()
2218 regulator_bulk_disable(power->num_vregs, power->vreg_bulk); in qca_regulator_disable()
2219 power->vregs_on = false; in qca_regulator_disable()
2221 clk_disable_unprepare(qcadev->susclk); in qca_regulator_disable()
2231 bulk = devm_kcalloc(qca->dev, num_vregs, sizeof(*bulk), GFP_KERNEL); in qca_init_regulators()
2233 return -ENOMEM; in qca_init_regulators()
2236 bulk[i].supply = vregs[i].name; in qca_init_regulators()
2238 ret = devm_regulator_bulk_get(qca->dev, num_vregs, bulk); in qca_init_regulators()
2248 qca->vreg_bulk = bulk; in qca_init_regulators()
2249 qca->num_vregs = num_vregs; in qca_init_regulators()
2262 qcadev = devm_kzalloc(&serdev->dev, sizeof(*qcadev), GFP_KERNEL); in qca_serdev_probe()
2264 return -ENOMEM; in qca_serdev_probe()
2266 qcadev->serdev_hu.serdev = serdev; in qca_serdev_probe()
2267 data = device_get_match_data(&serdev->dev); in qca_serdev_probe()
2269 device_property_read_string(&serdev->dev, "firmware-name", in qca_serdev_probe()
2270 &qcadev->firmware_name); in qca_serdev_probe()
2271 device_property_read_u32(&serdev->dev, "max-speed", in qca_serdev_probe()
2272 &qcadev->oper_speed); in qca_serdev_probe()
2273 if (!qcadev->oper_speed) in qca_serdev_probe()
2276 qcadev->bdaddr_property_broken = device_property_read_bool(&serdev->dev, in qca_serdev_probe()
2277 "qcom,local-bd-address-broken"); in qca_serdev_probe()
2280 qcadev->btsoc_type = data->soc_type; in qca_serdev_probe()
2282 qcadev->btsoc_type = QCA_ROME; in qca_serdev_probe()
2284 switch (qcadev->btsoc_type) { in qca_serdev_probe()
2292 qcadev->bt_power = devm_kzalloc(&serdev->dev, in qca_serdev_probe()
2295 if (!qcadev->bt_power) in qca_serdev_probe()
2296 return -ENOMEM; in qca_serdev_probe()
2298 qcadev->bt_power->dev = &serdev->dev; in qca_serdev_probe()
2299 err = qca_init_regulators(qcadev->bt_power, data->vregs, in qca_serdev_probe()
2300 data->num_vregs); in qca_serdev_probe()
2306 qcadev->bt_power->vregs_on = false; in qca_serdev_probe()
2308 qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", in qca_serdev_probe()
2310 if (IS_ERR(qcadev->bt_en) && in qca_serdev_probe()
2311 (data->soc_type == QCA_WCN6750 || in qca_serdev_probe()
2312 data->soc_type == QCA_WCN6855)) { in qca_serdev_probe()
2313 dev_err(&serdev->dev, "failed to acquire BT_EN gpio\n"); in qca_serdev_probe()
2314 return PTR_ERR(qcadev->bt_en); in qca_serdev_probe()
2317 if (!qcadev->bt_en) in qca_serdev_probe()
2320 qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl", in qca_serdev_probe()
2322 if (IS_ERR(qcadev->sw_ctrl) && in qca_serdev_probe()
2323 (data->soc_type == QCA_WCN6750 || in qca_serdev_probe()
2324 data->soc_type == QCA_WCN6855 || in qca_serdev_probe()
2325 data->soc_type == QCA_WCN7850)) { in qca_serdev_probe()
2326 dev_err(&serdev->dev, "failed to acquire SW_CTRL gpio\n"); in qca_serdev_probe()
2327 return PTR_ERR(qcadev->sw_ctrl); in qca_serdev_probe()
2330 qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); in qca_serdev_probe()
2331 if (IS_ERR(qcadev->susclk)) { in qca_serdev_probe()
2332 dev_err(&serdev->dev, "failed to acquire clk\n"); in qca_serdev_probe()
2333 return PTR_ERR(qcadev->susclk); in qca_serdev_probe()
2336 err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto); in qca_serdev_probe()
2344 qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", in qca_serdev_probe()
2346 if (IS_ERR(qcadev->bt_en)) { in qca_serdev_probe()
2347 dev_err(&serdev->dev, "failed to acquire enable gpio\n"); in qca_serdev_probe()
2348 return PTR_ERR(qcadev->bt_en); in qca_serdev_probe()
2351 if (!qcadev->bt_en) in qca_serdev_probe()
2354 qcadev->susclk = devm_clk_get_optional(&serdev->dev, NULL); in qca_serdev_probe()
2355 if (IS_ERR(qcadev->susclk)) { in qca_serdev_probe()
2356 dev_warn(&serdev->dev, "failed to acquire clk\n"); in qca_serdev_probe()
2357 return PTR_ERR(qcadev->susclk); in qca_serdev_probe()
2359 err = clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ); in qca_serdev_probe()
2363 err = clk_prepare_enable(qcadev->susclk); in qca_serdev_probe()
2367 err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto); in qca_serdev_probe()
2370 clk_disable_unprepare(qcadev->susclk); in qca_serdev_probe()
2375 hdev = qcadev->serdev_hu.hdev; in qca_serdev_probe()
2378 set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks); in qca_serdev_probe()
2379 hdev->shutdown = qca_power_off; in qca_serdev_probe()
2386 if (data->capabilities & QCA_CAP_WIDEBAND_SPEECH) in qca_serdev_probe()
2388 &hdev->quirks); in qca_serdev_probe()
2390 if (data->capabilities & QCA_CAP_VALID_LE_STATES) in qca_serdev_probe()
2391 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); in qca_serdev_probe()
2400 struct qca_power *power = qcadev->bt_power; in qca_serdev_remove()
2402 switch (qcadev->btsoc_type) { in qca_serdev_remove()
2410 if (power->vregs_on) { in qca_serdev_remove()
2411 qca_power_shutdown(&qcadev->serdev_hu); in qca_serdev_remove()
2417 if (qcadev->susclk) in qca_serdev_remove()
2418 clk_disable_unprepare(qcadev->susclk); in qca_serdev_remove()
2421 hci_uart_unregister_device(&qcadev->serdev_hu); in qca_serdev_remove()
2430 struct hci_uart *hu = &qcadev->serdev_hu; in qca_serdev_shutdown()
2431 struct hci_dev *hdev = hu->hdev; in qca_serdev_shutdown()
2435 if (qcadev->btsoc_type == QCA_QCA6390) { in qca_serdev_shutdown()
2437 * state and the state will ensure next hdev->setup() success. in qca_serdev_shutdown()
2439 * hdev->setup() can do its job regardless of SoC state, so in qca_serdev_shutdown()
2441 * if HCI_SETUP is set, it means that hdev->setup() was never in qca_serdev_shutdown()
2445 if (test_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks) || in qca_serdev_shutdown()
2450 * here, so also fix the use-after-free issue caused by that in qca_serdev_shutdown()
2479 struct hci_uart *hu = &qcadev->serdev_hu; in qca_suspend()
2480 struct qca_data *qca = hu->priv; in qca_suspend()
2487 set_bit(QCA_SUSPENDING, &qca->flags); in qca_suspend()
2490 * support in-band sleep in qca_suspend()
2492 if (test_bit(QCA_ROM_FW, &qca->flags)) in qca_suspend()
2499 if (test_bit(QCA_BT_OFF, &qca->flags) && in qca_suspend()
2500 !test_bit(QCA_SSR_TRIGGERED, &qca->flags)) in qca_suspend()
2503 if (test_bit(QCA_IBS_DISABLED, &qca->flags) || in qca_suspend()
2504 test_bit(QCA_SSR_TRIGGERED, &qca->flags)) { in qca_suspend()
2505 wait_timeout = test_bit(QCA_SSR_TRIGGERED, &qca->flags) ? in qca_suspend()
2513 wait_on_bit_timeout(&qca->flags, QCA_IBS_DISABLED, in qca_suspend()
2516 if (test_bit(QCA_IBS_DISABLED, &qca->flags)) { in qca_suspend()
2517 bt_dev_err(hu->hdev, "SSR or FW download time out"); in qca_suspend()
2518 ret = -ETIMEDOUT; in qca_suspend()
2523 cancel_work_sync(&qca->ws_awake_device); in qca_suspend()
2524 cancel_work_sync(&qca->ws_awake_rx); in qca_suspend()
2526 spin_lock_irqsave_nested(&qca->hci_ibs_lock, in qca_suspend()
2529 switch (qca->tx_ibs_state) { in qca_suspend()
2531 del_timer(&qca->wake_retrans_timer); in qca_suspend()
2534 del_timer(&qca->tx_idle_timer); in qca_suspend()
2536 serdev_device_write_flush(hu->serdev); in qca_suspend()
2538 ret = serdev_device_write_buf(hu->serdev, &cmd, sizeof(cmd)); in qca_suspend()
2545 qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; in qca_suspend()
2546 qca->ibs_sent_slps++; in qca_suspend()
2554 BT_ERR("Spurious tx state %d", qca->tx_ibs_state); in qca_suspend()
2555 ret = -EINVAL; in qca_suspend()
2559 spin_unlock_irqrestore(&qca->hci_ibs_lock, flags); in qca_suspend()
2565 serdev_device_wait_until_sent(hu->serdev, in qca_suspend()
2573 ret = wait_event_interruptible_timeout(qca->suspend_wait_q, in qca_suspend()
2574 qca->rx_ibs_state == HCI_IBS_RX_ASLEEP, in qca_suspend()
2577 ret = -ETIMEDOUT; in qca_suspend()
2584 clear_bit(QCA_SUSPENDING, &qca->flags); in qca_suspend()
2593 struct hci_uart *hu = &qcadev->serdev_hu; in qca_resume()
2594 struct qca_data *qca = hu->priv; in qca_resume()
2596 clear_bit(QCA_SUSPENDING, &qca->flags); in qca_resume()
2605 { .compatible = "qcom,qca2066-bt", .data = &qca_soc_data_qca2066},
2606 { .compatible = "qcom,qca6174-bt" },
2607 { .compatible = "qcom,qca6390-bt", .data = &qca_soc_data_qca6390},
2608 { .compatible = "qcom,qca9377-bt" },
2609 { .compatible = "qcom,wcn3988-bt", .data = &qca_soc_data_wcn3988},
2610 { .compatible = "qcom,wcn3990-bt", .data = &qca_soc_data_wcn3990},
2611 { .compatible = "qcom,wcn3991-bt", .data = &qca_soc_data_wcn3991},
2612 { .compatible = "qcom,wcn3998-bt", .data = &qca_soc_data_wcn3998},
2613 { .compatible = "qcom,wcn6750-bt", .data = &qca_soc_data_wcn6750},
2614 { .compatible = "qcom,wcn6855-bt", .data = &qca_soc_data_wcn6855},
2615 { .compatible = "qcom,wcn7850-bt", .data = &qca_soc_data_wcn7850},
2638 struct hci_uart *hu = &qcadev->serdev_hu; in hciqca_coredump()
2639 struct hci_dev *hdev = hu->hdev; in hciqca_coredump()
2641 if (hdev->dump.coredump) in hciqca_coredump()
2642 hdev->dump.coredump(hdev); in hciqca_coredump()