Lines Matching refs:hu
72 int (*rx_func)(struct hci_uart *hu, u8 c);
75 struct hci_uart *hu; /* Parent HCI UART */ member
111 static void h5_link_control(struct hci_uart *hu, const void *data, size_t len) in h5_link_control() argument
113 struct h5 *h5 = hu->priv; in h5_link_control()
138 struct hci_uart *hu = h5->hu; in h5_timed_event() local
142 BT_DBG("%s", hu->hdev->name); in h5_timed_event()
145 h5_link_control(hu, sync_req, sizeof(sync_req)); in h5_timed_event()
149 h5_link_control(hu, conf_req, sizeof(conf_req)); in h5_timed_event()
162 BT_DBG("hu %p retransmitting %u pkts", hu, h5->unack.qlen); in h5_timed_event()
174 hci_uart_tx_wakeup(hu); in h5_timed_event()
177 static void h5_peer_reset(struct hci_uart *hu) in h5_peer_reset() argument
179 struct h5 *h5 = hu->priv; in h5_peer_reset()
181 bt_dev_err(hu->hdev, "Peer device has reset"); in h5_peer_reset()
195 hci_reset_dev(hu->hdev); in h5_peer_reset()
198 static int h5_open(struct hci_uart *hu) in h5_open() argument
203 BT_DBG("hu %p", hu); in h5_open()
205 if (hu->serdev) { in h5_open()
206 h5 = serdev_device_get_drvdata(hu->serdev); in h5_open()
213 hu->priv = h5; in h5_open()
214 h5->hu = hu; in h5_open()
229 set_bit(HCI_UART_INIT_PENDING, &hu->hdev_flags); in h5_open()
232 h5_link_control(hu, sync, sizeof(sync)); in h5_open()
238 static int h5_close(struct hci_uart *hu) in h5_close() argument
240 struct h5 *h5 = hu->priv; in h5_close()
251 if (!hu->serdev) in h5_close()
257 static int h5_setup(struct hci_uart *hu) in h5_setup() argument
259 struct h5 *h5 = hu->priv; in h5_setup()
309 static void h5_handle_internal_rx(struct hci_uart *hu) in h5_handle_internal_rx() argument
311 struct h5 *h5 = hu->priv; in h5_handle_internal_rx()
322 BT_DBG("%s", hu->hdev->name); in h5_handle_internal_rx()
334 h5_peer_reset(hu); in h5_handle_internal_rx()
335 h5_link_control(hu, sync_rsp, 2); in h5_handle_internal_rx()
338 h5_peer_reset(hu); in h5_handle_internal_rx()
340 h5_link_control(hu, conf_req, 3); in h5_handle_internal_rx()
342 h5_link_control(hu, conf_rsp, 2); in h5_handle_internal_rx()
343 h5_link_control(hu, conf_req, 3); in h5_handle_internal_rx()
349 hci_uart_init_ready(hu); in h5_handle_internal_rx()
360 h5_link_control(hu, woken_req, 2); in h5_handle_internal_rx()
367 hci_uart_tx_wakeup(hu); in h5_handle_internal_rx()
370 static void h5_complete_rx_pkt(struct hci_uart *hu) in h5_complete_rx_pkt() argument
372 struct h5 *h5 = hu->priv; in h5_complete_rx_pkt()
378 hci_uart_tx_wakeup(hu); in h5_complete_rx_pkt()
395 hci_recv_frame(hu->hdev, h5->rx_skb); in h5_complete_rx_pkt()
401 h5_handle_internal_rx(hu); in h5_complete_rx_pkt()
408 static int h5_rx_crc(struct hci_uart *hu, unsigned char c) in h5_rx_crc() argument
410 h5_complete_rx_pkt(hu); in h5_rx_crc()
415 static int h5_rx_payload(struct hci_uart *hu, unsigned char c) in h5_rx_payload() argument
417 struct h5 *h5 = hu->priv; in h5_rx_payload()
424 h5_complete_rx_pkt(hu); in h5_rx_payload()
430 static int h5_rx_3wire_hdr(struct hci_uart *hu, unsigned char c) in h5_rx_3wire_hdr() argument
432 struct h5 *h5 = hu->priv; in h5_rx_3wire_hdr()
436 hu->hdev->name, H5_HDR_SEQ(hdr), H5_HDR_ACK(hdr), in h5_rx_3wire_hdr()
441 bt_dev_err(hu->hdev, "Invalid header checksum"); in h5_rx_3wire_hdr()
447 bt_dev_err(hu->hdev, "Out-of-order packet arrived (%u != %u)", in h5_rx_3wire_hdr()
455 bt_dev_err(hu->hdev, "Non-link packet received in non-active state"); in h5_rx_3wire_hdr()
466 static int h5_rx_pkt_start(struct hci_uart *hu, unsigned char c) in h5_rx_pkt_start() argument
468 struct h5 *h5 = hu->priv; in h5_rx_pkt_start()
478 bt_dev_err(hu->hdev, "Can't allocate mem for new packet"); in h5_rx_pkt_start()
483 h5->rx_skb->dev = (void *)hu->hdev; in h5_rx_pkt_start()
488 static int h5_rx_delimiter(struct hci_uart *hu, unsigned char c) in h5_rx_delimiter() argument
490 struct h5 *h5 = hu->priv; in h5_rx_delimiter()
541 static int h5_recv(struct hci_uart *hu, const void *data, int count) in h5_recv() argument
543 struct h5 *h5 = hu->priv; in h5_recv()
546 BT_DBG("%s pending %zu count %d", hu->hdev->name, h5->rx_pending, in h5_recv()
554 bt_dev_err(hu->hdev, "Too short H5 packet"); in h5_recv()
565 processed = h5->rx_func(hu, *ptr); in h5_recv()
576 static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb) in h5_enqueue() argument
578 struct h5 *h5 = hu->priv; in h5_enqueue()
581 bt_dev_err(hu->hdev, "Packet too long (%u bytes)", skb->len); in h5_enqueue()
587 bt_dev_err(hu->hdev, "Ignoring HCI data in non-active state"); in h5_enqueue()
604 bt_dev_err(hu->hdev, "Unknown packet type %u", hci_skb_pkt_type(skb)); in h5_enqueue()
651 static struct sk_buff *h5_prepare_pkt(struct hci_uart *hu, u8 pkt_type, in h5_prepare_pkt() argument
654 struct h5 *h5 = hu->priv; in h5_prepare_pkt()
660 bt_dev_err(hu->hdev, "Unknown packet type %u", pkt_type); in h5_prepare_pkt()
693 hu->hdev->name, H5_HDR_SEQ(hdr), H5_HDR_ACK(hdr), in h5_prepare_pkt()
708 static struct sk_buff *h5_dequeue(struct hci_uart *hu) in h5_dequeue() argument
710 struct h5 *h5 = hu->priv; in h5_dequeue()
724 return h5_prepare_pkt(hu, HCI_3WIRE_LINK_PKT, wakeup_req, 2); in h5_dequeue()
729 nskb = h5_prepare_pkt(hu, hci_skb_pkt_type(skb), in h5_dequeue()
737 bt_dev_err(hu->hdev, "Could not dequeue pkt because alloc_skb failed"); in h5_dequeue()
747 nskb = h5_prepare_pkt(hu, hci_skb_pkt_type(skb), in h5_dequeue()
757 bt_dev_err(hu->hdev, "Could not dequeue pkt because alloc_skb failed"); in h5_dequeue()
764 return h5_prepare_pkt(hu, HCI_3WIRE_ACK_PKT, NULL, 0); in h5_dequeue()
769 static int h5_flush(struct hci_uart *hu) in h5_flush() argument
771 BT_DBG("hu %p", hu); in h5_flush()
796 h5->hu = &h5->serdev_hu; in h5_serdev_probe()
876 btrtl_dev = btrtl_initialize(h5->hu->hdev, h5->id); in h5_btrtl_setup()
880 err = btrtl_get_uart_settings(h5->hu->hdev, btrtl_dev, in h5_btrtl_setup()
887 skb = __hci_cmd_sync(h5->hu->hdev, 0xfc17, sizeof(baudrate_data), in h5_btrtl_setup()
890 rtl_dev_err(h5->hu->hdev, "set baud rate command failed\n"); in h5_btrtl_setup()
899 serdev_device_set_baudrate(h5->hu->serdev, controller_baudrate); in h5_btrtl_setup()
900 serdev_device_set_flow_control(h5->hu->serdev, flow_control); in h5_btrtl_setup()
902 err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev); in h5_btrtl_setup()
915 serdev_device_set_flow_control(h5->hu->serdev, false); in h5_btrtl_open()
916 serdev_device_set_parity(h5->hu->serdev, SERDEV_PARITY_EVEN); in h5_btrtl_open()
917 serdev_device_set_baudrate(h5->hu->serdev, 115200); in h5_btrtl_open()
939 serdev_device_set_flow_control(h5->hu->serdev, false); in h5_btrtl_suspend()
976 reprobe->dev = get_device(&h5->hu->serdev->dev); in h5_btrtl_resume()