diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-07-16 09:12:02 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-07-17 13:33:20 -0400 |
commit | 7dec65c8a7fdab87d23bcf3c7e7eff662d180853 (patch) | |
tree | 11c79d87b6aa1c3fa73c3ed0eddc867c744420e4 | |
parent | 83ce9a06b5307c8d759ddd8e4f49e2495fb321f7 (diff) |
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>
-rw-r--r-- | drivers/bluetooth/Kconfig | 12 | ||||
-rw-r--r-- | drivers/bluetooth/Makefile | 1 | ||||
-rw-r--r-- | drivers/bluetooth/hci_h5.c | 88 | ||||
-rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 6 | ||||
-rw-r--r-- | drivers/bluetooth/hci_uart.h | 5 |
5 files changed, 112 insertions, 0 deletions
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 5ccf142ef0b8..e9f203eadb1f 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig | |||
@@ -81,6 +81,18 @@ config BT_HCIUART_LL | |||
81 | 81 | ||
82 | Say Y here to compile support for HCILL protocol. | 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 | config BT_HCIBCM203X | 96 | config BT_HCIBCM203X |
85 | tristate "HCI BCM203x USB driver" | 97 | tristate "HCI BCM203x USB driver" |
86 | depends on USB | 98 | depends on USB |
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile index f4460f4f4b78..4afae20df512 100644 --- a/drivers/bluetooth/Makefile +++ b/drivers/bluetooth/Makefile | |||
@@ -28,4 +28,5 @@ hci_uart-$(CONFIG_BT_HCIUART_H4) += hci_h4.o | |||
28 | hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o | 28 | hci_uart-$(CONFIG_BT_HCIUART_BCSP) += hci_bcsp.o |
29 | hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o | 29 | hci_uart-$(CONFIG_BT_HCIUART_LL) += hci_ll.o |
30 | hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o | 30 | hci_uart-$(CONFIG_BT_HCIUART_ATH3K) += hci_ath.o |
31 | hci_uart-$(CONFIG_BT_HCIUART_3WIRE) += hci_h5.o | ||
31 | hci_uart-objs := $(hci_uart-y) | 32 | hci_uart-objs := $(hci_uart-y) |
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c new file mode 100644 index 000000000000..6353d00ba864 --- /dev/null +++ b/drivers/bluetooth/hci_h5.c | |||
@@ -0,0 +1,88 @@ | |||
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 | } | ||
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 2f9b796e106e..142f49cde848 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -558,6 +558,9 @@ static int __init hci_uart_init(void) | |||
558 | #ifdef CONFIG_BT_HCIUART_ATH3K | 558 | #ifdef CONFIG_BT_HCIUART_ATH3K |
559 | ath_init(); | 559 | ath_init(); |
560 | #endif | 560 | #endif |
561 | #ifdef CONFIG_BT_HCIUART_3WIRE | ||
562 | h5_init(); | ||
563 | #endif | ||
561 | 564 | ||
562 | return 0; | 565 | return 0; |
563 | } | 566 | } |
@@ -578,6 +581,9 @@ static void __exit hci_uart_exit(void) | |||
578 | #ifdef CONFIG_BT_HCIUART_ATH3K | 581 | #ifdef CONFIG_BT_HCIUART_ATH3K |
579 | ath_deinit(); | 582 | ath_deinit(); |
580 | #endif | 583 | #endif |
584 | #ifdef CONFIG_BT_HCIUART_3WIRE | ||
585 | h5_deinit(); | ||
586 | #endif | ||
581 | 587 | ||
582 | /* Release tty registration of line discipline */ | 588 | /* Release tty registration of line discipline */ |
583 | if ((err = tty_unregister_ldisc(N_HCI))) | 589 | if ((err = tty_unregister_ldisc(N_HCI))) |
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h index 6cf6ab22ad21..aaf9d7de1b9f 100644 --- a/drivers/bluetooth/hci_uart.h +++ b/drivers/bluetooth/hci_uart.h | |||
@@ -104,3 +104,8 @@ int ll_deinit(void); | |||
104 | int ath_init(void); | 104 | int ath_init(void); |
105 | int ath_deinit(void); | 105 | int ath_deinit(void); |
106 | #endif | 106 | #endif |
107 | |||
108 | #ifdef CONFIG_BT_HCIUART_3WIRE | ||
109 | int h5_init(void); | ||
110 | int h5_deinit(void); | ||
111 | #endif | ||