| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  *  Bluetooth HCI UART driver | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  Copyright (C) 2000-2001  Qualcomm Incorporated | 
					
						
							|  |  |  |  *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com> | 
					
						
							|  |  |  |  *  Copyright (C) 2004-2005  Marcel Holtmann <marcel@holtmann.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  *  it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  *  the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  *  (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  *  GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  *  along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | #ifndef N_HCI
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #define N_HCI	15
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Ioctls */ | 
					
						
							| 
									
										
										
										
											2007-05-09 09:15:35 +02:00
										 |  |  | #define HCIUARTSETPROTO		_IOW('U', 200, int)
 | 
					
						
							|  |  |  | #define HCIUARTGETPROTO		_IOR('U', 201, int)
 | 
					
						
							|  |  |  | #define HCIUARTGETDEVICE	_IOR('U', 202, int)
 | 
					
						
							| 
									
										
										
										
											2010-07-12 11:37:04 -03:00
										 |  |  | #define HCIUARTSETFLAGS		_IOW('U', 203, int)
 | 
					
						
							|  |  |  | #define HCIUARTGETFLAGS		_IOR('U', 204, int)
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* UART protocols */ | 
					
						
							| 
									
										
										
										
											2010-07-19 12:34:07 +05:30
										 |  |  | #define HCI_UART_MAX_PROTO	6
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define HCI_UART_H4	0
 | 
					
						
							|  |  |  | #define HCI_UART_BCSP	1
 | 
					
						
							|  |  |  | #define HCI_UART_3WIRE	2
 | 
					
						
							|  |  |  | #define HCI_UART_H4DS	3
 | 
					
						
							| 
									
										
										
										
											2007-10-20 13:42:36 +02:00
										 |  |  | #define HCI_UART_LL	4
 | 
					
						
							| 
									
										
										
										
											2010-07-19 12:34:07 +05:30
										 |  |  | #define HCI_UART_ATH3K	5
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-12 11:37:04 -03:00
										 |  |  | #define HCI_UART_RAW_DEVICE	0
 | 
					
						
							| 
									
										
										
										
											2012-02-24 17:12:24 +01:00
										 |  |  | #define HCI_UART_RESET_ON_INIT	1
 | 
					
						
							| 
									
										
										
										
											2012-02-24 17:09:38 +01:00
										 |  |  | #define HCI_UART_CREATE_AMP	2
 | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:11 +03:00
										 |  |  | #define HCI_UART_INIT_PENDING	3
 | 
					
						
							| 
									
										
										
										
											2014-07-11 07:12:58 +02:00
										 |  |  | #define HCI_UART_EXT_CONFIG	4
 | 
					
						
							| 
									
										
										
										
											2010-07-12 11:37:04 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | struct hci_uart; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct hci_uart_proto { | 
					
						
							|  |  |  | 	unsigned int id; | 
					
						
							|  |  |  | 	int (*open)(struct hci_uart *hu); | 
					
						
							|  |  |  | 	int (*close)(struct hci_uart *hu); | 
					
						
							|  |  |  | 	int (*flush)(struct hci_uart *hu); | 
					
						
							|  |  |  | 	int (*recv)(struct hci_uart *hu, void *data, int len); | 
					
						
							|  |  |  | 	int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); | 
					
						
							|  |  |  | 	struct sk_buff *(*dequeue)(struct hci_uart *hu); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct hci_uart { | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | 	struct tty_struct	*tty; | 
					
						
							|  |  |  | 	struct hci_dev		*hdev; | 
					
						
							|  |  |  | 	unsigned long		flags; | 
					
						
							| 
									
										
										
										
											2010-07-12 11:37:04 -03:00
										 |  |  | 	unsigned long		hdev_flags; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:11 +03:00
										 |  |  | 	struct work_struct	init_ready; | 
					
						
							| 
									
										
										
										
											2014-04-23 09:58:26 -05:00
										 |  |  | 	struct work_struct	write_work; | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:11 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | 	struct hci_uart_proto	*proto; | 
					
						
							|  |  |  | 	void			*priv; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct sk_buff		*tx_skb; | 
					
						
							|  |  |  | 	unsigned long		tx_state; | 
					
						
							|  |  |  | 	spinlock_t		rx_lock; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-12 11:37:04 -03:00
										 |  |  | /* HCI_UART proto flag bits */ | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | #define HCI_UART_PROTO_SET	0
 | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:11 +03:00
										 |  |  | #define HCI_UART_REGISTERED	1
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* TX states  */ | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | #define HCI_UART_SENDING	1
 | 
					
						
							|  |  |  | #define HCI_UART_TX_WAKEUP	2
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | int hci_uart_register_proto(struct hci_uart_proto *p); | 
					
						
							|  |  |  | int hci_uart_unregister_proto(struct hci_uart_proto *p); | 
					
						
							|  |  |  | int hci_uart_tx_wakeup(struct hci_uart *hu); | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:11 +03:00
										 |  |  | int hci_uart_init_ready(struct hci_uart *hu); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-10-28 19:20:45 +02:00
										 |  |  | #ifdef CONFIG_BT_HCIUART_H4
 | 
					
						
							|  |  |  | int h4_init(void); | 
					
						
							|  |  |  | int h4_deinit(void); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_BT_HCIUART_BCSP
 | 
					
						
							|  |  |  | int bcsp_init(void); | 
					
						
							|  |  |  | int bcsp_deinit(void); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-10-20 13:42:36 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_BT_HCIUART_LL
 | 
					
						
							|  |  |  | int ll_init(void); | 
					
						
							|  |  |  | int ll_deinit(void); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2010-07-19 12:34:07 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_BT_HCIUART_ATH3K
 | 
					
						
							|  |  |  | int ath_init(void); | 
					
						
							|  |  |  | int ath_deinit(void); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-07-16 16:12:02 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_BT_HCIUART_3WIRE
 | 
					
						
							|  |  |  | int h5_init(void); | 
					
						
							|  |  |  | int h5_deinit(void); | 
					
						
							|  |  |  | #endif
 |