Lines Matching refs:hu
59 struct hci_uart *hu; member
71 struct hci_uart *hu; member
107 static int intel_wait_booting(struct hci_uart *hu) in intel_wait_booting() argument
109 struct intel_data *intel = hu->priv; in intel_wait_booting()
117 bt_dev_err(hu->hdev, "Device boot interrupted"); in intel_wait_booting()
122 bt_dev_err(hu->hdev, "Device boot timeout"); in intel_wait_booting()
130 static int intel_wait_lpm_transaction(struct hci_uart *hu) in intel_wait_lpm_transaction() argument
132 struct intel_data *intel = hu->priv; in intel_wait_lpm_transaction()
140 bt_dev_err(hu->hdev, "LPM transaction interrupted"); in intel_wait_lpm_transaction()
145 bt_dev_err(hu->hdev, "LPM transaction timeout"); in intel_wait_lpm_transaction()
152 static int intel_lpm_suspend(struct hci_uart *hu) in intel_lpm_suspend() argument
155 struct intel_data *intel = hu->priv; in intel_lpm_suspend()
165 bt_dev_dbg(hu->hdev, "Suspending"); in intel_lpm_suspend()
169 bt_dev_err(hu->hdev, "Failed to alloc memory for LPM packet"); in intel_lpm_suspend()
180 hci_uart_tx_wakeup(hu); in intel_lpm_suspend()
182 intel_wait_lpm_transaction(hu); in intel_lpm_suspend()
188 bt_dev_err(hu->hdev, "Device suspend error"); in intel_lpm_suspend()
192 bt_dev_dbg(hu->hdev, "Suspended"); in intel_lpm_suspend()
194 hci_uart_set_flow_control(hu, true); in intel_lpm_suspend()
199 static int intel_lpm_resume(struct hci_uart *hu) in intel_lpm_resume() argument
201 struct intel_data *intel = hu->priv; in intel_lpm_resume()
208 bt_dev_dbg(hu->hdev, "Resuming"); in intel_lpm_resume()
210 hci_uart_set_flow_control(hu, false); in intel_lpm_resume()
214 bt_dev_err(hu->hdev, "Failed to alloc memory for LPM packet"); in intel_lpm_resume()
224 hci_uart_tx_wakeup(hu); in intel_lpm_resume()
226 intel_wait_lpm_transaction(hu); in intel_lpm_resume()
232 bt_dev_err(hu->hdev, "Device resume error"); in intel_lpm_resume()
236 bt_dev_dbg(hu->hdev, "Resumed"); in intel_lpm_resume()
242 static int intel_lpm_host_wake(struct hci_uart *hu) in intel_lpm_host_wake() argument
245 struct intel_data *intel = hu->priv; in intel_lpm_host_wake()
248 hci_uart_set_flow_control(hu, false); in intel_lpm_host_wake()
254 bt_dev_err(hu->hdev, "Failed to alloc memory for LPM packet"); in intel_lpm_host_wake()
263 hci_uart_tx_wakeup(hu); in intel_lpm_host_wake()
265 bt_dev_dbg(hu->hdev, "Resumed by controller"); in intel_lpm_host_wake()
277 if (idev->hu) in intel_irq()
278 intel_lpm_host_wake(idev->hu); in intel_irq()
289 static int intel_set_power(struct hci_uart *hu, bool powered) in intel_set_power() argument
294 if (!hu->tty->dev) in intel_set_power()
303 if (hu->tty->dev->parent != idev->pdev->dev.parent) in intel_set_power()
312 hu, dev_name(&idev->pdev->dev), powered); in intel_set_power()
322 idev->hu = powered ? hu : NULL; in intel_set_power()
336 hu, idev->irq); in intel_set_power()
366 if (!intel->hu->tty->dev) in intel_busy_work()
372 if (intel->hu->tty->dev->parent == idev->pdev->dev.parent) { in intel_busy_work()
382 static int intel_open(struct hci_uart *hu) in intel_open() argument
386 BT_DBG("hu %p", hu); in intel_open()
388 if (!hci_uart_has_flow_control(hu)) in intel_open()
398 intel->hu = hu; in intel_open()
400 hu->priv = intel; in intel_open()
402 if (!intel_set_power(hu, true)) in intel_open()
408 static int intel_close(struct hci_uart *hu) in intel_close() argument
410 struct intel_data *intel = hu->priv; in intel_close()
412 BT_DBG("hu %p", hu); in intel_close()
416 intel_set_power(hu, false); in intel_close()
422 hu->priv = NULL; in intel_close()
426 static int intel_flush(struct hci_uart *hu) in intel_flush() argument
428 struct intel_data *intel = hu->priv; in intel_flush()
430 BT_DBG("hu %p", hu); in intel_flush()
462 static int intel_set_baudrate(struct hci_uart *hu, unsigned int speed) in intel_set_baudrate() argument
464 struct intel_data *intel = hu->priv; in intel_set_baudrate()
465 struct hci_dev *hdev = hu->hdev; in intel_set_baudrate()
473 err = intel_wait_booting(hu); in intel_set_baudrate()
509 hci_uart_set_flow_control(hu, true); in intel_set_baudrate()
512 hci_uart_tx_wakeup(hu); in intel_set_baudrate()
517 hci_uart_set_baudrate(hu, speed); in intel_set_baudrate()
518 hci_uart_set_flow_control(hu, false); in intel_set_baudrate()
523 static int intel_setup(struct hci_uart *hu) in intel_setup() argument
525 struct intel_data *intel = hu->priv; in intel_setup()
526 struct hci_dev *hdev = hu->hdev; in intel_setup()
542 hu->hdev->set_diag = btintel_set_diag; in intel_setup()
543 hu->hdev->set_bdaddr = btintel_set_bdaddr; in intel_setup()
553 if (hu->init_speed) in intel_setup()
554 init_speed = hu->init_speed; in intel_setup()
556 init_speed = hu->proto->init_speed; in intel_setup()
558 if (hu->oper_speed) in intel_setup()
559 oper_speed = hu->oper_speed; in intel_setup()
561 oper_speed = hu->proto->oper_speed; in intel_setup()
567 err = intel_wait_booting(hu); in intel_setup()
792 err = intel_set_baudrate(hu, init_speed); in intel_setup()
814 err = intel_wait_booting(hu); in intel_setup()
831 if (!hu->tty->dev) in intel_setup()
833 if (hu->tty->dev->parent == idev->pdev->dev.parent) { in intel_setup()
852 err = intel_set_baudrate(hu, oper_speed); in intel_setup()
866 struct hci_uart *hu = hci_get_drvdata(hdev); in intel_recv_event() local
867 struct intel_data *intel = hu->priv; in intel_recv_event()
904 struct hci_uart *hu = hci_get_drvdata(hdev); in intel_recv_lpm_notify() local
905 struct intel_data *intel = hu->priv; in intel_recv_lpm_notify()
920 struct hci_uart *hu = hci_get_drvdata(hdev); in intel_recv_lpm() local
921 struct intel_data *intel = hu->priv; in intel_recv_lpm()
926 bt_dev_err(hu->hdev, "Invalid LPM notification packet"); in intel_recv_lpm()
965 static int intel_recv(struct hci_uart *hu, const void *data, int count) in intel_recv() argument
967 struct intel_data *intel = hu->priv; in intel_recv()
969 if (!test_bit(HCI_UART_REGISTERED, &hu->flags)) in intel_recv()
972 intel->rx_skb = h4_recv_buf(hu->hdev, intel->rx_skb, data, count, in intel_recv()
977 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err); in intel_recv()
985 static int intel_enqueue(struct hci_uart *hu, struct sk_buff *skb) in intel_enqueue() argument
987 struct intel_data *intel = hu->priv; in intel_enqueue()
990 BT_DBG("hu %p skb %p", hu, skb); in intel_enqueue()
992 if (!hu->tty->dev) in intel_enqueue()
1000 if (hu->tty->dev->parent == idev->pdev->dev.parent) { in intel_enqueue()
1014 static struct sk_buff *intel_dequeue(struct hci_uart *hu) in intel_dequeue() argument
1016 struct intel_data *intel = hu->priv; in intel_dequeue()
1034 inject_cmd_complete(hu->hdev, opcode); in intel_dequeue()
1074 if (idev->hu) in intel_suspend_device()
1075 intel_lpm_suspend(idev->hu); in intel_suspend_device()
1086 if (idev->hu) in intel_resume_device()
1087 intel_lpm_resume(idev->hu); in intel_resume_device()