Lines Matching refs:hu
89 * @hu: pointer to HCI UART controller struct,
124 struct hci_uart *hu;
148 static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed)
150 if (hu->serdev)
151 serdev_device_set_baudrate(hu->serdev, speed);
153 hci_uart_set_baudrate(hu, speed);
156 static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
158 struct hci_dev *hdev = hu->hdev;
212 if (device && device->hu && device->hu->serdev)
369 static int bcm_setup_sleep(struct hci_uart *hu)
371 struct bcm_data *bcm = hu->priv;
377 skb = __hci_cmd_sync(hu->hdev, 0xfc27, sizeof(sleep_params),
381 bt_dev_err(hu->hdev, "Sleep VSC failed (%d)", err);
386 bt_dev_dbg(hu->hdev, "Set Sleep Parameters VSC succeeded");
392 static inline int bcm_setup_sleep(struct hci_uart *hu) { return 0; }
397 struct hci_uart *hu = hci_get_drvdata(hdev);
398 struct bcm_data *bcm = hu->priv;
413 hci_uart_tx_wakeup(hu);
418 static int bcm_open(struct hci_uart *hu)
424 bt_dev_dbg(hu->hdev, "hu %p", hu);
426 if (!hci_uart_has_flow_control(hu))
435 hu->priv = bcm;
439 if (hu->serdev) {
440 bcm->dev = serdev_device_get_drvdata(hu->serdev);
444 if (!hu->tty->dev)
454 if (hu->tty->dev->parent == dev->dev->parent) {
457 dev->hu = hu;
466 hci_uart_set_flow_control(hu, true);
468 hu->init_speed = bcm->dev->init_speed;
474 hu->oper_speed = bcm->dev->oper_speed;
479 hci_uart_set_flow_control(hu, false);
490 if (!hu->serdev)
491 bcm->dev->hu = NULL;
494 hu->priv = NULL;
499 static int bcm_close(struct hci_uart *hu)
501 struct bcm_data *bcm = hu->priv;
505 bt_dev_dbg(hu->hdev, "hu %p", hu);
510 if (hu->serdev) {
511 bdev = serdev_device_get_drvdata(hu->serdev);
515 bdev->hu = NULL;
528 bt_dev_err(hu->hdev, "Failed to power down");
538 hu->priv = NULL;
542 static int bcm_flush(struct hci_uart *hu)
544 struct bcm_data *bcm = hu->priv;
546 bt_dev_dbg(hu->hdev, "hu %p", hu);
553 static int bcm_setup(struct hci_uart *hu)
555 struct bcm_data *bcm = hu->priv;
560 bt_dev_dbg(hu->hdev, "hu %p", hu);
562 hu->hdev->set_diag = bcm_set_diag;
563 hu->hdev->set_bdaddr = btbcm_set_bdaddr;
565 err = btbcm_initialize(hu->hdev, &fw_load_done);
573 if (hu->init_speed)
574 speed = hu->init_speed;
575 else if (hu->proto->init_speed)
576 speed = hu->proto->init_speed;
581 host_set_baudrate(hu, speed);
584 if (hu->oper_speed)
585 speed = hu->oper_speed;
588 else if (hu->proto->oper_speed)
589 speed = hu->proto->oper_speed;
594 err = bcm_set_baudrate(hu, speed);
596 host_set_baudrate(hu, speed);
603 btbcm_read_pcm_int_params(hu->hdev, ¶ms);
606 btbcm_write_pcm_int_params(hu->hdev, ¶ms);
609 err = btbcm_finalize(hu->hdev, &fw_load_done);
617 set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hu->hdev->quirks);
620 err = bcm_setup_sleep(hu);
663 static int bcm_recv(struct hci_uart *hu, const void *data, int count)
665 struct bcm_data *bcm = hu->priv;
667 if (!test_bit(HCI_UART_REGISTERED, &hu->flags))
670 bcm->rx_skb = h4_recv_buf(hu->hdev, bcm->rx_skb, data, count,
674 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err);
691 static int bcm_enqueue(struct hci_uart *hu, struct sk_buff *skb)
693 struct bcm_data *bcm = hu->priv;
695 bt_dev_dbg(hu->hdev, "hu %p skb %p", hu, skb);
704 static struct sk_buff *bcm_dequeue(struct hci_uart *hu)
706 struct bcm_data *bcm = hu->priv;
738 if (!bdev->is_suspended && bdev->hu) {
739 hci_uart_set_flow_control(bdev->hu, true);
748 if (bdev->is_suspended && bdev->hu) {
750 hci_uart_set_flow_control(bdev->hu, false);
778 if (bdev->is_suspended && bdev->hu) {
781 hci_uart_set_flow_control(bdev->hu, false);
805 if (!bdev->hu)
839 if (!bdev->hu)
1432 bcmdev->hu = &bcmdev->serdev_hu;