Staging: sources for ST header file
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / ti-st / st.h
1 /*
2 * Shared Transport Header file
3 * To be included by the protocol stack drivers for
4 * Texas Instruments BT,FM and GPS combo chip drivers
5 *
6 * Copyright (C) 2009 Texas Instruments
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 version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23 #ifndef ST_H
24 #define ST_H
25
26 #include <linux/skbuff.h>
27 /*
28 * st.h
29 */
30
31 /* TODO:
32 * Move the following to tty.h upon acceptance
33 */
34 #define N_TI_WL 20 /* Ldisc for TI's WL BT, FM, GPS combo chips */
35
36 /* some gpios have active high, others like fm have
37 * active low
38 */
39 enum kim_gpio_state {
40 KIM_GPIO_INACTIVE,
41 KIM_GPIO_ACTIVE,
42 };
43 /*
44 * the list of protocols on chip
45 */
46 enum proto_type {
47 ST_BT,
48 ST_FM,
49 ST_GPS,
50 ST_MAX,
51 };
52
53 enum {
54 ST_ERR_FAILURE = -1, /* check struct */
55 ST_SUCCESS,
56 ST_ERR_PENDING = -5, /* to call reg_complete_cb */
57 ST_ERR_ALREADY, /* already registered */
58 ST_ERR_INPROGRESS,
59 ST_ERR_NOPROTO, /* protocol not supported */
60 };
61
62 /* per protocol structure
63 * for BT/FM and GPS
64 */
65 struct st_proto_s {
66 enum proto_type type;
67 /*
68 * to be called by ST when data arrives
69 */
70 long (*recv) (struct sk_buff *);
71 /*
72 * for future use, logic now to be in ST
73 */
74 unsigned char (*match_packet) (const unsigned char *data);
75 /*
76 * subsequent registration return PENDING,
77 * signalled complete by this callback function
78 */
79 void (*reg_complete_cb) (char data);
80 /*
81 * write function, sent in as NULL and to be returned to
82 * protocol drivers
83 */
84 long (*write) (struct sk_buff *skb);
85 };
86
87 extern long st_register(struct st_proto_s *new_proto);
88 extern long st_unregister(enum proto_type type);
89
90 #endif /* ST_H */