Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.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 /* TODO:
29  * Move the following to tty.h upon acceptance
30  */
31 #define N_TI_WL 20      /* Ldisc for TI's WL BT, FM, GPS combo chips */
32
33 /**
34  * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW
35  *      gpio states for their chip/core enable gpios
36  */
37 enum kim_gpio_state {
38         KIM_GPIO_INACTIVE,
39         KIM_GPIO_ACTIVE,
40 };
41
42 /**
43  * enum proto-type - The protocol on WiLink chips which share a
44  *      common physical interface like UART.
45  */
46 enum proto_type {
47         ST_BT,
48         ST_FM,
49         ST_GPS,
50         ST_MAX,
51 };
52
53 /**
54  * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST
55  * @type: type of the protocol being registered among the
56  *      available proto_type(BT, FM, GPS the protocol which share TTY).
57  * @recv: the receiver callback pointing to a function in the
58  *      protocol drivers called by the ST driver upon receiving
59  *      relevant data.
60  * @match_packet: reserved for future use, to make ST more generic
61  * @reg_complete_cb: callback handler pointing to a function in protocol
62  *      handler called by ST when the pending registrations are complete.
63  *      The registrations are marked pending, in situations when fw
64  *      download is in progress.
65  * @write: pointer to function in ST provided to protocol drivers from ST,
66  *      to be made use when protocol drivers have data to send to TTY.
67  * @priv_data: privdate data holder for the protocol drivers, sent
68  *      from the protocol drivers during registration, and sent back on
69  *      reg_complete_cb and recv.
70  */
71 struct st_proto_s {
72         enum proto_type type;
73         long (*recv) (void *, struct sk_buff *);
74         unsigned char (*match_packet) (const unsigned char *data);
75         void (*reg_complete_cb) (void *, char data);
76         long (*write) (struct sk_buff *skb);
77         void *priv_data;
78 };
79
80 extern long st_register(struct st_proto_s *);
81 extern long st_unregister(enum proto_type);
82
83 #endif /* ST_H */