Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Initial skeleton for Three-wire UART (H5) support

This patch adds the initial skeleton for Three-wire UART (H5) support
and hooks it up to the HCI UART framework.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

authored by

Johan Hedberg and committed by
Gustavo Padovan
7dec65c8 83ce9a06

+112
+12
drivers/bluetooth/Kconfig
··· 81 81 82 82 Say Y here to compile support for HCILL protocol. 83 83 84 + config BT_HCIUART_3WIRE 85 + bool "Three-wire UART (H5) protocol support" 86 + depends on BT_HCIUART 87 + help 88 + The HCI Three-wire UART Transport Layer makes it possible to 89 + user the Bluetooth HCI over a serial port interface. The HCI 90 + Three-wire UART Transport Layer assumes that the UART 91 + communication may have bit errors, overrun errors or burst 92 + errors and thereby making CTS/RTS lines unnecessary. 93 + 94 + Say Y here to compile support for Three-wire UART protocol. 95 + 84 96 config BT_HCIBCM203X 85 97 tristate "HCI BCM203x USB driver" 86 98 depends on USB
+1
drivers/bluetooth/Makefile
··· 28 28 hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o 29 29 hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o 30 30 hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o 31 + hci_uart-$(CONFIG_BT_HCIUART_3WIRE) += hci_h5.o 31 32 hci_uart-objs := $(hci_uart-y)
+88
drivers/bluetooth/hci_h5.c
··· 1 + /* 2 + * 3 + * Bluetooth HCI Three-wire UART driver 4 + * 5 + * Copyright (C) 2012 Intel Corporation 6 + * 7 + * 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. 12 + * 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. 17 + * 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 21 + * 22 + */ 23 + 24 + #include <linux/kernel.h> 25 + #include <linux/errno.h> 26 + #include <linux/skbuff.h> 27 + 28 + #include <net/bluetooth/bluetooth.h> 29 + #include <net/bluetooth/hci_core.h> 30 + 31 + #include "hci_uart.h" 32 + 33 + static int h5_open(struct hci_uart *hu) 34 + { 35 + return -ENOSYS; 36 + } 37 + 38 + static int h5_close(struct hci_uart *hu) 39 + { 40 + return -ENOSYS; 41 + } 42 + 43 + static int h5_recv(struct hci_uart *hu, void *data, int count) 44 + { 45 + return -ENOSYS; 46 + } 47 + 48 + static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb) 49 + { 50 + return -ENOSYS; 51 + } 52 + 53 + static struct sk_buff *h5_dequeue(struct hci_uart *hu) 54 + { 55 + return NULL; 56 + } 57 + 58 + static int h5_flush(struct hci_uart *hu) 59 + { 60 + return -ENOSYS; 61 + } 62 + 63 + static struct hci_uart_proto h5p = { 64 + .id = HCI_UART_3WIRE, 65 + .open = h5_open, 66 + .close = h5_close, 67 + .recv = h5_recv, 68 + .enqueue = h5_enqueue, 69 + .dequeue = h5_dequeue, 70 + .flush = h5_flush, 71 + }; 72 + 73 + int __init h5_init(void) 74 + { 75 + int err = hci_uart_register_proto(&h5p); 76 + 77 + if (!err) 78 + BT_INFO("HCI Three-wire UART (H5) protocol initialized"); 79 + else 80 + BT_ERR("HCI Three-wire UART (H5) protocol init failed"); 81 + 82 + return err; 83 + } 84 + 85 + int __exit h5_deinit(void) 86 + { 87 + return hci_uart_unregister_proto(&h5p); 88 + }
+6
drivers/bluetooth/hci_ldisc.c
··· 558 558 #ifdef CONFIG_BT_HCIUART_ATH3K 559 559 ath_init(); 560 560 #endif 561 + #ifdef CONFIG_BT_HCIUART_3WIRE 562 + h5_init(); 563 + #endif 561 564 562 565 return 0; 563 566 } ··· 580 577 #endif 581 578 #ifdef CONFIG_BT_HCIUART_ATH3K 582 579 ath_deinit(); 580 + #endif 581 + #ifdef CONFIG_BT_HCIUART_3WIRE 582 + h5_deinit(); 583 583 #endif 584 584 585 585 /* Release tty registration of line discipline */
+5
drivers/bluetooth/hci_uart.h
··· 104 104 int ath_init(void); 105 105 int ath_deinit(void); 106 106 #endif 107 + 108 + #ifdef CONFIG_BT_HCIUART_3WIRE 109 + int h5_init(void); 110 + int h5_deinit(void); 111 + #endif