3 * Bluetooth HCI UART driver
5 * Copyright (C) 2011-2014 wifi_fae<wifi_fae@realtek.com.tw>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <linux/module.h>
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28 #include <linux/types.h>
29 #include <linux/fcntl.h>
30 #include <linux/interrupt.h>
31 #include <linux/ptrace.h>
32 #include <linux/poll.h>
34 #include <linux/slab.h>
35 #include <linux/tty.h>
36 #include <linux/errno.h>
37 #include <linux/string.h>
38 #include <linux/signal.h>
39 #include <linux/ioctl.h>
40 #include <linux/skbuff.h>
41 #include <linux/bitrev.h>
42 #include <asm/unaligned.h>
44 #include <net/bluetooth/bluetooth.h>
45 #include <net/bluetooth/hci_core.h>
52 //static int hciextn = 1;
54 #define H5_TXWINSIZE 4
55 #define H5_ACK_PKT 0x00
56 #define H5_LE_PKT 0x0F
57 #define H5_VDRSPEC_PKT 0x0E
60 struct sk_buff_head unack; /* Unack'ed packets queue */
61 struct sk_buff_head rel; /* Reliable packets queue */
62 struct sk_buff_head unrel; /* Unreliable packets queue */
64 unsigned long rx_count;
65 struct sk_buff *rx_skb;
66 u8 rxseq_txack; /* rxseq == txack. */
67 u8 rxack; /* Last packet sent by us that the peer ack'ed */
68 struct timer_list th5;
85 u8 txack_req; /* Do we need to send ack's to the peer? */
87 /* Reliable packet sequence number - used to assign seq to each rel pkt. */
91 /* ---- H5 CRC calculation ---- */
93 /* Table for calculating CRC for polynomial 0x1021, LSB processed first,
94 initial value 0xffff, bits shifted in reverse order. */
96 static const u16 crc_table[] = {
97 0x0000, 0x1081, 0x2102, 0x3183,
98 0x4204, 0x5285, 0x6306, 0x7387,
99 0x8408, 0x9489, 0xa50a, 0xb58b,
100 0xc60c, 0xd68d, 0xe70e, 0xf78f
103 /* Initialise the crc calculator */
104 #define H5_CRC_INIT(x) x = 0xffff
107 Update crc with next data byte
110 The data byte is treated as two nibbles. The crc is generated
111 in reverse, i.e., bits are fed into the register from the top.
113 static void h5_crc_update(u16 *crc, u8 d)
117 reg = (reg >> 4) ^ crc_table[(reg ^ d) & 0x000f];
118 reg = (reg >> 4) ^ crc_table[(reg ^ (d >> 4)) & 0x000f];
123 /* ---- H5 core ---- */
125 static void h5_slip_msgdelim(struct sk_buff *skb)
127 const char pkt_delim = 0xc0;
129 memcpy(skb_put(skb, 1), &pkt_delim, 1);
132 static void h5_slip_one_byte(struct sk_buff *skb, u8 c)
134 const char esc_c0[2] = { 0xdb, 0xdc };
135 const char esc_db[2] = { 0xdb, 0xdd };
136 const char esc_11[2] = { 0xdb, 0xde };
137 const char esc_13[2] = { 0xdb, 0xdf };
141 memcpy(skb_put(skb, 2), &esc_c0, 2);
144 memcpy(skb_put(skb, 2), &esc_db, 2);
147 memcpy(skb_put(skb, 2), &esc_11, 2);
150 memcpy(skb_put(skb, 2), &esc_13, 2);
153 memcpy(skb_put(skb, 1), &c, 1);
157 static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
159 struct h5_struct *h5 = hu->priv;
161 if (skb->len > 0xFFF) { //Pkt length must be less than 4095 bytes
162 BT_ERR("Packet too long");
167 switch (bt_cb(skb)->pkt_type) {
168 case HCI_ACLDATA_PKT:
169 case HCI_COMMAND_PKT:
170 skb_queue_tail(&h5->rel, skb);
173 case HCI_SCODATA_PKT:
174 skb_queue_tail(&h5->unrel, skb);
179 skb_queue_tail(&h5->unrel, skb); /* 3-wire LinkEstablishment*/
183 BT_ERR("Unknown packet type");
191 static struct sk_buff *h5_prepare_pkt(struct h5_struct *h5, u8 *data,
192 int len, int pkt_type)
194 struct sk_buff *nskb;
196 u16 H5_CRC_INIT(h5_txmsg_crc);
200 case HCI_ACLDATA_PKT:
201 chan = 2; /* 3-wire ACL channel */
202 rel = 1; /* reliable channel */
204 case HCI_COMMAND_PKT:
205 chan = 1; /* 3-wire cmd channel */
206 rel = 1; /* reliable channel */
209 chan = 4; /* 3-wire cmd channel */
210 rel = 1; /* reliable channel */
212 case HCI_SCODATA_PKT:
213 chan = 3; /* 3-wire SCO channel */
214 rel = 0; /* unreliable channel */
217 chan = 15; /* 3-wire LinkEstablishment channel */
218 rel = 0; /* unreliable channel */
221 chan = 0; /* 3-wire ACK channel */
222 rel = 0; /* unreliable channel */
225 chan = 14; /* 3-wire Vendor Specific channel */
226 rel = 0; /* unreliable channel */
229 BT_ERR("Unknown packet type");
234 /* Max len of packet: (original len +4(h5 hdr) +2(crc))*2
235 (because bytes 0xc0 and 0xdb are escaped, worst case is
236 when the packet is all made of 0xc0 and 0xdb :) )
237 + 2 (0xc0 delimiters at start and end). */
239 nskb = alloc_skb((len + 6) * 2 + 2, GFP_ATOMIC);
243 bt_cb(nskb)->pkt_type = pkt_type;
245 h5_slip_msgdelim(nskb);
247 hdr[0] = h5->rxseq_txack << 3;
249 BT_DBG("We request packet no %u to card", h5->rxseq_txack);
252 hdr[0] |= 0x80 + h5->msgq_txseq;
253 BT_DBG("Sending packet with seqno %u", h5->msgq_txseq);
254 h5->msgq_txseq = (h5->msgq_txseq + 1) & 0x07;
260 hdr[1] = ((len << 4) & 0xff) | chan;
262 hdr[3] = ~(hdr[0] + hdr[1] + hdr[2]);
265 for (i = 0; i < 4; i++) {
266 h5_slip_one_byte(nskb, hdr[i]);
269 h5_crc_update(&h5_txmsg_crc, hdr[i]);
273 for (i = 0; i < len; i++) {
274 h5_slip_one_byte(nskb, data[i]);
277 h5_crc_update(&h5_txmsg_crc, data[i]);
282 h5_txmsg_crc = bitrev16(h5_txmsg_crc);
283 h5_slip_one_byte(nskb, (u8) ((h5_txmsg_crc >> 8) & 0x00ff));
284 h5_slip_one_byte(nskb, (u8) (h5_txmsg_crc & 0x00ff));
287 h5_slip_msgdelim(nskb);
291 /* This is a rewrite of pkt_avail in AH5 */
292 static struct sk_buff *h5_dequeue(struct hci_uart *hu)
294 struct h5_struct *h5 = hu->priv;
298 /* First of all, check for unreliable messages in the queue,
299 since they have priority */
301 if ((skb = skb_dequeue(&h5->unrel)) != NULL) {
302 struct sk_buff *nskb = h5_prepare_pkt(h5, skb->data, skb->len, bt_cb(skb)->pkt_type);
307 skb_queue_head(&h5->unrel, skb);
308 BT_ERR("Could not dequeue pkt because alloc_skb failed");
312 /* Now, try to send a reliable pkt. We can only send a
313 reliable packet if the number of packets sent but not yet ack'ed
314 is < than the winsize */
316 spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
318 if (h5->unack.qlen < H5_TXWINSIZE && (skb = skb_dequeue(&h5->rel)) != NULL) {
319 struct sk_buff *nskb = h5_prepare_pkt(h5, skb->data, skb->len, bt_cb(skb)->pkt_type);
321 __skb_queue_tail(&h5->unack, skb);
322 mod_timer(&h5->th5, jiffies + HZ / 4);
323 spin_unlock_irqrestore(&h5->unack.lock, flags);
326 skb_queue_head(&h5->rel, skb);
327 BT_ERR("Could not dequeue pkt because alloc_skb failed");
331 spin_unlock_irqrestore(&h5->unack.lock, flags);
333 /* We could not send a reliable packet, either because there are
334 none or because there are too many unack'ed pkts. Did we receive
335 any packets we have not acknowledged yet ? */
338 /* if so, craft an empty ACK pkt and send it on H5 unreliable
340 struct sk_buff *nskb = h5_prepare_pkt(h5, NULL, 0, H5_ACK_PKT);
344 /* We have nothing to send */
348 static int h5_flush(struct hci_uart *hu)
354 /* Remove ack'ed packets */
355 static void h5_pkt_cull(struct h5_struct *h5)
357 struct sk_buff *skb, *tmp;
359 int i, pkts_to_be_removed;
362 spin_lock_irqsave(&h5->unack.lock, flags);
364 pkts_to_be_removed = skb_queue_len(&h5->unack);
365 seqno = h5->msgq_txseq;
367 while (pkts_to_be_removed) {
368 if (h5->rxack == seqno)
370 pkts_to_be_removed--;
371 seqno = (seqno - 1) & 0x07;
374 if (h5->rxack != seqno)
375 BT_ERR("Peer acked invalid packet");
377 BT_DBG("Removing %u pkts out of %u, up to seqno %u",
378 pkts_to_be_removed, skb_queue_len(&h5->unack),
382 skb_queue_walk_safe(&h5->unack, skb, tmp) {
383 if (i >= pkts_to_be_removed)
387 __skb_unlink(skb, &h5->unack);
391 if (skb_queue_empty(&h5->unack))
394 spin_unlock_irqrestore(&h5->unack.lock, flags);
396 if (i != pkts_to_be_removed)
397 BT_ERR("Removed only %u out of %u pkts", i, pkts_to_be_removed);
400 /* Handle H5 link-establishment packets. When we
401 detect a "sync" packet, symptom that the BT module has reset,
402 we do nothing :) (yet) */
403 static void h5_handle_le_pkt(struct hci_uart *hu)
405 struct h5_struct *h5 = hu->priv;
406 u8 conf_pkt[2] = { 0x03, 0xfc};
407 u8 conf_rsp_pkt[3] = { 0x04, 0x7b, 0x00};
408 u8 sync_pkt[2] = { 0x01, 0x7e};
409 u8 sync_rsp_pkt[2] = { 0x02, 0x7d};
411 u8 wakeup_pkt[2] = { 0x05, 0xfa};
412 u8 woken_pkt[2] = { 0x06, 0xf9};
413 u8 sleep_pkt[2] = { 0x07, 0x78};
415 /* spot "conf" pkts and reply with a "conf rsp" pkt */
416 if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
417 !memcmp(&h5->rx_skb->data[4], conf_pkt, 2)) {
418 struct sk_buff *nskb = alloc_skb(3, GFP_ATOMIC);
420 BT_DBG("Found a LE conf pkt");
424 conf_rsp_pkt[2] |= txcrc << 0x4; //crc check enable, version no = 0. needed to be as avariable.
425 memcpy(skb_put(nskb, 3), conf_rsp_pkt, 3);
426 bt_cb(nskb)->pkt_type = H5_LE_PKT;
428 skb_queue_head(&h5->unrel, nskb);
429 hci_uart_tx_wakeup(hu);
431 /* spot "conf resp" pkts*/
432 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
433 !memcmp(&h5->rx_skb->data[4], conf_rsp_pkt, 2)) {
434 BT_DBG("Found a LE conf resp pkt, device go into active state");
435 txcrc = (h5->rx_skb->data[6] >> 0x4) & 0x1;
438 /* Spot "sync" pkts. If we find one...disaster! */
439 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
440 !memcmp(&h5->rx_skb->data[4], sync_pkt, 2)) {
441 BT_ERR("Found a LE sync pkt, card has reset");
444 /* Spot "sync resp" pkts. If we find one...disaster! */
445 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
446 !memcmp(&h5->rx_skb->data[4], sync_rsp_pkt, 2)) {
447 BT_ERR("Found a LE sync resp pkt, device go into initialized state");
450 /* Spot "wakeup" pkts. reply woken message when in active mode */
451 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
452 !memcmp(&h5->rx_skb->data[4], wakeup_pkt, 2)) {
453 struct sk_buff *nskb = alloc_skb(2, GFP_ATOMIC);
455 BT_ERR("Found a LE Wakeup pkt, and reply woken message");
458 memcpy(skb_put(nskb, 2), woken_pkt, 2);
459 bt_cb(nskb)->pkt_type = H5_LE_PKT;
461 skb_queue_head(&h5->unrel, nskb);
462 hci_uart_tx_wakeup(hu);
464 /* Spot "woken" pkts. receive woken message from device */
465 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
466 !memcmp(&h5->rx_skb->data[4], woken_pkt, 2)) {
467 BT_ERR("Found a LE woken pkt from device");
470 /* Spot "Sleep" pkts*/
471 else if (h5->rx_skb->data[1] >> 4 == 2 && h5->rx_skb->data[2] == 0 &&
472 !memcmp(&h5->rx_skb->data[4], sleep_pkt, 2)) {
473 BT_ERR("Found a LE Sleep pkt");
479 static inline void h5_unslip_one_byte(struct h5_struct *h5, unsigned char byte)
481 const u8 c0 = 0xc0, db = 0xdb;
482 const u8 oof1 = 0x11, oof2 = 0x13;
484 switch (h5->rx_esc_state) {
485 case H5_ESCSTATE_NOESC:
488 h5->rx_esc_state = H5_ESCSTATE_ESC;
491 memcpy(skb_put(h5->rx_skb, 1), &byte, 1);
492 if ((h5->rx_skb-> data[0] & 0x40) != 0 &&
493 h5->rx_state != H5_W4_CRC)
494 h5_crc_update(&h5->message_crc, byte);
499 case H5_ESCSTATE_ESC:
502 memcpy(skb_put(h5->rx_skb, 1), &c0, 1);
503 if ((h5->rx_skb-> data[0] & 0x40) != 0 &&
504 h5->rx_state != H5_W4_CRC)
505 h5_crc_update(&h5-> message_crc, 0xc0);
506 h5->rx_esc_state = H5_ESCSTATE_NOESC;
511 memcpy(skb_put(h5->rx_skb, 1), &db, 1);
512 if ((h5->rx_skb-> data[0] & 0x40) != 0 &&
513 h5->rx_state != H5_W4_CRC)
514 h5_crc_update(&h5-> message_crc, 0xdb);
515 h5->rx_esc_state = H5_ESCSTATE_NOESC;
520 memcpy(skb_put(h5->rx_skb, 1), &oof1, 1);
521 if ((h5->rx_skb-> data[0] & 0x40) != 0 && h5->rx_state != H5_W4_CRC)
522 h5_crc_update(&h5-> message_crc, oof1);
523 h5->rx_esc_state = H5_ESCSTATE_NOESC;
528 memcpy(skb_put(h5->rx_skb, 1), &oof2, 1);
529 if ((h5->rx_skb-> data[0] & 0x40) != 0 && h5->rx_state != H5_W4_CRC)
530 h5_crc_update(&h5-> message_crc, oof2);
531 h5->rx_esc_state = H5_ESCSTATE_NOESC;
536 BT_ERR ("Invalid byte %02x after esc byte", byte);
537 kfree_skb(h5->rx_skb);
539 h5->rx_state = H5_W4_PKT_DELIMITER;
545 static void h5_complete_rx_pkt(struct hci_uart *hu)
547 struct h5_struct *h5 = hu->priv;
550 if (h5->rx_skb->data[0] & 0x80) { /* reliable pkt */
551 BT_DBG("Received seqno %u from card", h5->rxseq_txack);
553 h5->rxseq_txack %= 0x8;
556 /* If needed, transmit an ack pkt */
557 hci_uart_tx_wakeup(hu);
560 h5->rxack = (h5->rx_skb->data[0] >> 3) & 0x07;
561 BT_DBG("Request for pkt %u from card", h5->rxack);
565 if ((h5->rx_skb->data[1] & 0x0f) == 2 &&
566 h5->rx_skb->data[0] & 0x80) {
567 bt_cb(h5->rx_skb)->pkt_type = HCI_ACLDATA_PKT;
569 } else if ((h5->rx_skb->data[1] & 0x0f) == 4 &&
570 h5->rx_skb->data[0] & 0x80) {
571 bt_cb(h5->rx_skb)->pkt_type = HCI_EVENT_PKT;
573 } else if ((h5->rx_skb->data[1] & 0x0f) == 3) {
574 bt_cb(h5->rx_skb)->pkt_type = HCI_SCODATA_PKT;
576 } else if ((h5->rx_skb->data[1] & 0x0f) == 15 &&
577 !(h5->rx_skb->data[0] & 0x80)) {
578 //h5_handle_le_pkt(hu);//Link Establishment Pkt
580 } else if ((h5->rx_skb->data[1] & 0x0f) == 1 &&
581 h5->rx_skb->data[0] & 0x80) {
582 bt_cb(h5->rx_skb)->pkt_type = HCI_COMMAND_PKT;
584 } else if ((h5->rx_skb->data[1] & 0x0f) == 14) {
585 bt_cb(h5->rx_skb)->pkt_type = H5_VDRSPEC_PKT;
591 struct hci_event_hdr hdr;
592 u8 desc = (h5->rx_skb->data[1] & 0x0f);
594 if (desc != H5_ACK_PKT && desc != H5_LE_PKT) {
598 skb_pull(h5->rx_skb, 4);
599 memcpy(skb_push(h5->rx_skb, 1), &desc, 1);
602 hdr.plen = h5->rx_skb->len;
603 memcpy(skb_push(h5->rx_skb, HCI_EVENT_HDR_SIZE), &hdr, HCI_EVENT_HDR_SIZE);
604 bt_cb(h5->rx_skb)->pkt_type = HCI_EVENT_PKT;
606 hci_recv_frame(h5->rx_skb);
609 BT_ERR ("Packet for unknown channel (%u %s)",
610 h5->rx_skb->data[1] & 0x0f,
611 h5->rx_skb->data[0] & 0x80 ?
612 "reliable" : "unreliable");
613 kfree_skb(h5->rx_skb);
616 kfree_skb(h5->rx_skb);
618 /* Pull out H5 hdr */
619 skb_pull(h5->rx_skb, 4);
621 hci_recv_frame(h5->rx_skb);
624 h5->rx_state = H5_W4_PKT_DELIMITER;
628 static u16 bscp_get_crc(struct h5_struct *h5)
630 return get_unaligned_be16(&h5->rx_skb->data[h5->rx_skb->len - 2]);
634 static int h5_recv(struct hci_uart *hu, void *data, int count)
636 struct h5_struct *h5 = hu->priv;
637 register unsigned char *ptr;
639 BT_DBG("hu %p count %d rx_state %d rx_count %ld",
640 hu, count, h5->rx_state, h5->rx_count);
646 BT_ERR("Short H5 packet");
647 kfree_skb(h5->rx_skb);
648 h5->rx_state = H5_W4_PKT_START;
651 h5_unslip_one_byte(h5, *ptr);
657 switch (h5->rx_state) {
659 if ((0xff & (u8) ~ (h5->rx_skb->data[0] + h5->rx_skb->data[1] +
660 h5->rx_skb->data[2])) != h5->rx_skb->data[3]) {
661 BT_ERR("Error in H5 hdr checksum");
662 kfree_skb(h5->rx_skb);
663 h5->rx_state = H5_W4_PKT_DELIMITER;
667 if (h5->rx_skb->data[0] & 0x80 /* reliable pkt */
668 && (h5->rx_skb->data[0] & 0x07) != h5->rxseq_txack) {
669 BT_ERR ("Out-of-order packet arrived, got %u expected %u",
670 h5->rx_skb->data[0] & 0x07, h5->rxseq_txack);
673 hci_uart_tx_wakeup(hu);
674 kfree_skb(h5->rx_skb);
675 h5->rx_state = H5_W4_PKT_DELIMITER;
679 h5->rx_state = H5_W4_DATA;
680 h5->rx_count = (h5->rx_skb->data[1] >> 4) +
681 (h5->rx_skb->data[2] << 4); /* May be 0 */
685 if (h5->rx_skb->data[0] & 0x40) { /* pkt with crc */
686 h5->rx_state = H5_W4_CRC;
689 h5_complete_rx_pkt(hu);
693 if (bitrev16(h5->message_crc) != bscp_get_crc(h5)) {
694 BT_ERR ("Checksum failed: computed %04x received %04x",
695 bitrev16(h5->message_crc),
698 kfree_skb(h5->rx_skb);
699 h5->rx_state = H5_W4_PKT_DELIMITER;
703 skb_trim(h5->rx_skb, h5->rx_skb->len - 2);
704 h5_complete_rx_pkt(hu);
707 case H5_W4_PKT_DELIMITER:
710 h5->rx_state = H5_W4_PKT_START;
713 /*BT_ERR("Ignoring byte %02x", *ptr);*/
719 case H5_W4_PKT_START:
726 h5->rx_state = H5_W4_HDR;
728 h5->rx_esc_state = H5_ESCSTATE_NOESC;
729 H5_CRC_INIT(h5->message_crc);
731 /* Do not increment ptr or decrement count
732 * Allocate packet. Max len of a H5 pkt=
733 * 0xFFF (payload) +4 (header) +2 (crc) */
735 h5->rx_skb = bt_skb_alloc(0x1005, GFP_ATOMIC);
737 BT_ERR("Can't allocate mem for new packet");
738 h5->rx_state = H5_W4_PKT_DELIMITER;
742 h5->rx_skb->dev = (void *) hu->hdev;
751 /* Arrange to retransmit all messages in the relq. */
752 static void h5_timed_event(unsigned long arg)
754 struct hci_uart *hu = (struct hci_uart *) arg;
755 struct h5_struct *h5 = hu->priv;
759 BT_DBG("hu %p retransmitting %u pkts", hu, h5->unack.qlen);
761 spin_lock_irqsave_nested(&h5->unack.lock, flags, SINGLE_DEPTH_NESTING);
763 while ((skb = __skb_dequeue_tail(&h5->unack)) != NULL) {
764 h5->msgq_txseq = (h5->msgq_txseq - 1) & 0x07;
765 skb_queue_head(&h5->rel, skb);
768 spin_unlock_irqrestore(&h5->unack.lock, flags);
770 hci_uart_tx_wakeup(hu);
773 static int h5_open(struct hci_uart *hu)
775 struct h5_struct *h5;
779 h5 = kzalloc(sizeof(*h5), GFP_ATOMIC);
784 skb_queue_head_init(&h5->unack);
785 skb_queue_head_init(&h5->rel);
786 skb_queue_head_init(&h5->unrel);
788 init_timer(&h5->th5);
789 h5->th5.function = h5_timed_event;
790 h5->th5.data = (u_long) hu;
792 h5->rx_state = H5_W4_PKT_DELIMITER;
800 static int h5_close(struct hci_uart *hu)
802 struct h5_struct *h5 = hu->priv;
807 skb_queue_purge(&h5->unack);
808 skb_queue_purge(&h5->rel);
809 skb_queue_purge(&h5->unrel);
816 static struct hci_uart_proto h5 = {
817 .id = HCI_UART_3WIRE,
820 .enqueue = h5_enqueue,
821 .dequeue = h5_dequeue,
828 int err = hci_uart_register_proto(&h5);
831 BT_INFO("HCI Realtek H5 protocol initialized");
833 BT_ERR("HCI Realtek H5 protocol registration failed");
840 return hci_uart_unregister_proto(&h5);
844 module_param(hciextn, bool, 0644);
845 MODULE_PARM_DESC(hciextn, "Convert HCI Extensions into H5 packets-3wire test");