Lines Matching refs:hu
102 * @hu: pointer to HCI UART controller struct,
143 struct hci_uart *hu;
170 static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed)
172 if (hu->serdev)
173 serdev_device_set_baudrate(hu->serdev, speed);
175 hci_uart_set_baudrate(hu, speed);
178 static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
180 struct hci_dev *hdev = hu->hdev;
181 struct bcm_data *bcm = hu->priv;
235 if (device && device->hu && device->hu->serdev)
392 static int bcm_setup_sleep(struct hci_uart *hu)
394 struct bcm_data *bcm = hu->priv;
400 skb = __hci_cmd_sync(hu->hdev, 0xfc27, sizeof(sleep_params),
404 bt_dev_err(hu->hdev, "Sleep VSC failed (%d)", err);
409 bt_dev_dbg(hu->hdev, "Set Sleep Parameters VSC succeeded");
415 static inline int bcm_setup_sleep(struct hci_uart *hu) { return 0; }
420 struct hci_uart *hu = hci_get_drvdata(hdev);
421 struct bcm_data *bcm = hu->priv;
436 hci_uart_tx_wakeup(hu);
441 static int bcm_open(struct hci_uart *hu)
447 bt_dev_dbg(hu->hdev, "hu %p", hu);
449 if (!hci_uart_has_flow_control(hu))
458 hu->priv = bcm;
462 if (hu->serdev) {
463 bcm->dev = serdev_device_get_drvdata(hu->serdev);
467 if (!hu->tty->dev)
477 if (hu->tty->dev->parent == dev->dev->parent) {
480 dev->hu = hu;
489 hci_uart_set_flow_control(hu, false); /* Assert BT_UART_CTS_N */
491 hci_uart_set_flow_control(hu, true);
494 hu->init_speed = min(bcm->dev->oper_speed, bcm->dev->max_autobaud_speed);
496 hu->init_speed = bcm->dev->init_speed;
502 hu->oper_speed = bcm->dev->oper_speed;
507 hci_uart_set_flow_control(hu, false);
518 if (!hu->serdev)
519 bcm->dev->hu = NULL;
522 hu->priv = NULL;
527 static int bcm_close(struct hci_uart *hu)
529 struct bcm_data *bcm = hu->priv;
533 bt_dev_dbg(hu->hdev, "hu %p", hu);
538 if (hu->serdev) {
539 bdev = serdev_device_get_drvdata(hu->serdev);
543 bdev->hu = NULL;
556 bt_dev_err(hu->hdev, "Failed to power down");
566 hu->priv = NULL;
570 static int bcm_flush(struct hci_uart *hu)
572 struct bcm_data *bcm = hu->priv;
574 bt_dev_dbg(hu->hdev, "hu %p", hu);
581 static int bcm_setup(struct hci_uart *hu)
583 struct bcm_data *bcm = hu->priv;
589 bt_dev_dbg(hu->hdev, "hu %p", hu);
591 hu->hdev->set_diag = bcm_set_diag;
592 hu->hdev->set_bdaddr = btbcm_set_bdaddr;
594 err = btbcm_initialize(hu->hdev, &fw_load_done, use_autobaud_mode);
604 else if (hu->proto->init_speed)
605 speed = hu->proto->init_speed;
610 host_set_baudrate(hu, speed);
613 if (hu->oper_speed)
614 speed = hu->oper_speed;
617 else if (hu->proto->oper_speed)
618 speed = hu->proto->oper_speed;
623 err = bcm_set_baudrate(hu, speed);
625 host_set_baudrate(hu, speed);
632 btbcm_read_pcm_int_params(hu->hdev, ¶ms);
635 btbcm_write_pcm_int_params(hu->hdev, ¶ms);
638 err = btbcm_finalize(hu->hdev, &fw_load_done, use_autobaud_mode);
646 if (test_bit(HCI_QUIRK_INVALID_BDADDR, &hu->hdev->quirks))
647 set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks);
650 err = bcm_setup_sleep(hu);
694 static int bcm_recv(struct hci_uart *hu, const void *data, int count)
696 struct bcm_data *bcm = hu->priv;
698 if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
701 bcm->rx_skb = h4_recv_buf(hu->hdev, bcm->rx_skb, data, count,
705 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
722 static int bcm_enqueue(struct hci_uart *hu, struct sk_buff *skb)
724 struct bcm_data *bcm = hu->priv;
726 bt_dev_dbg(hu->hdev, "hu %p skb %p", hu, skb);
735 static struct sk_buff *bcm_dequeue(struct hci_uart *hu)
737 struct bcm_data *bcm = hu->priv;
769 if (!bdev->is_suspended && bdev->hu) {
770 hci_uart_set_flow_control(bdev->hu, true);
779 if (bdev->is_suspended && bdev->hu) {
781 hci_uart_set_flow_control(bdev->hu, false);
809 if (bdev->is_suspended && bdev->hu) {
812 hci_uart_set_flow_control(bdev->hu, false);
836 if (!bdev->hu)
870 if (!bdev->hu)
1532 bcmdev->hu = &bcmdev->serdev_hu;