aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPavan Savoy <pavan_savoy@ti.com>2010-09-30 16:13:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-05 14:48:07 -0400
commite5558679bbb80788dc8c4c30484ac0a68e971ca5 (patch)
tree5639f51fb808644a537dc7be385962a9a32ce1ed /include/linux
parentc7afa08d80dbcfdbd7fd04388f7bc475ec8acf69 (diff)
staging: ti-st: mv ti_wilink_st header
Move the header to a standard linux device driver location. This should pave the way for other drivers to be moved into the relevant directories. ti_wilink_st.h is a common header file used by the TI's shared transport device driver for WiLink chipsets. Each individual protocol drivers like bluetooth driver, FM V4L2 driver and GPS drivers will make use of this header. Signed-off-by: Pavan Savoy <pavan_savoy@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ti_wilink_st.h402
1 files changed, 402 insertions, 0 deletions
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
new file mode 100644
index 000000000000..2a5acf599598
--- /dev/null
+++ b/include/linux/ti_wilink_st.h
@@ -0,0 +1,402 @@
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 * and also serves the sub-modules of the shared transport driver.
6 *
7 * Copyright (C) 2009-2010 Texas Instruments
8 * Author: Pavan Savoy <pavan_savoy@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#ifndef TI_WILINK_ST_H
26#define TI_WILINK_ST_H
27
28/**
29 * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW
30 * gpio states for their chip/core enable gpios
31 */
32enum kim_gpio_state {
33 KIM_GPIO_INACTIVE,
34 KIM_GPIO_ACTIVE,
35};
36
37/**
38 * enum proto-type - The protocol on WiLink chips which share a
39 * common physical interface like UART.
40 */
41enum proto_type {
42 ST_BT,
43 ST_FM,
44 ST_GPS,
45 ST_MAX,
46};
47
48/**
49 * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST
50 * @type: type of the protocol being registered among the
51 * available proto_type(BT, FM, GPS the protocol which share TTY).
52 * @recv: the receiver callback pointing to a function in the
53 * protocol drivers called by the ST driver upon receiving
54 * relevant data.
55 * @match_packet: reserved for future use, to make ST more generic
56 * @reg_complete_cb: callback handler pointing to a function in protocol
57 * handler called by ST when the pending registrations are complete.
58 * The registrations are marked pending, in situations when fw
59 * download is in progress.
60 * @write: pointer to function in ST provided to protocol drivers from ST,
61 * to be made use when protocol drivers have data to send to TTY.
62 * @priv_data: privdate data holder for the protocol drivers, sent
63 * from the protocol drivers during registration, and sent back on
64 * reg_complete_cb and recv.
65 */
66struct st_proto_s {
67 enum proto_type type;
68 long (*recv) (void *, struct sk_buff *);
69 unsigned char (*match_packet) (const unsigned char *data);
70 void (*reg_complete_cb) (void *, char data);
71 long (*write) (struct sk_buff *skb);
72 void *priv_data;
73};
74
75extern long st_register(struct st_proto_s *);
76extern long st_unregister(enum proto_type);
77
78
79/*
80 * header information used by st_core.c
81 */
82
83/* states of protocol list */
84#define ST_NOTEMPTY 1
85#define ST_EMPTY 0
86
87/*
88 * possible st_states
89 */
90#define ST_INITIALIZING 1
91#define ST_REG_IN_PROGRESS 2
92#define ST_REG_PENDING 3
93#define ST_WAITING_FOR_RESP 4
94
95/**
96 * struct st_data_s - ST core internal structure
97 * @st_state: different states of ST like initializing, registration
98 * in progress, this is mainly used to return relevant err codes
99 * when protocol drivers are registering. It is also used to track
100 * the recv function, as in during fw download only HCI events
101 * can occur , where as during other times other events CH8, CH9
102 * can occur.
103 * @tty: tty provided by the TTY core for line disciplines.
104 * @ldisc_ops: the procedures that this line discipline registers with TTY.
105 * @tx_skb: If for some reason the tty's write returns lesser bytes written
106 * then to maintain the rest of data to be written on next instance.
107 * This needs to be protected, hence the lock inside wakeup func.
108 * @tx_state: if the data is being written onto the TTY and protocol driver
109 * wants to send more, queue up data and mark that there is
110 * more data to send.
111 * @list: the list of protocols registered, only MAX can exist, one protocol
112 * can register only once.
113 * @rx_state: states to be maintained inside st's tty receive
114 * @rx_count: count to be maintained inside st's tty receieve
115 * @rx_skb: the skb where all data for a protocol gets accumulated,
116 * since tty might not call receive when a complete event packet
117 * is received, the states, count and the skb needs to be maintained.
118 * @txq: the list of skbs which needs to be sent onto the TTY.
119 * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued
120 * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs
121 * from waitq can be moved onto the txq.
122 * Needs locking too.
123 * @lock: the lock to protect skbs, queues, and ST states.
124 * @protos_registered: count of the protocols registered, also when 0 the
125 * chip enable gpio can be toggled, and when it changes to 1 the fw
126 * needs to be downloaded to initialize chip side ST.
127 * @ll_state: the various PM states the chip can be, the states are notified
128 * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND).
129 * @kim_data: reference to the parent encapsulating structure.
130 *
131 */
132struct st_data_s {
133 unsigned long st_state;
134 struct tty_struct *tty;
135 struct tty_ldisc_ops *ldisc_ops;
136 struct sk_buff *tx_skb;
137#define ST_TX_SENDING 1
138#define ST_TX_WAKEUP 2
139 unsigned long tx_state;
140 struct st_proto_s *list[ST_MAX];
141 unsigned long rx_state;
142 unsigned long rx_count;
143 struct sk_buff *rx_skb;
144 struct sk_buff_head txq, tx_waitq;
145 spinlock_t lock;
146 unsigned char protos_registered;
147 unsigned long ll_state;
148 void *kim_data;
149};
150
151/**
152 * st_int_write -
153 * point this to tty->driver->write or tty->ops->write
154 * depending upon the kernel version
155 */
156int st_int_write(struct st_data_s*, const unsigned char*, int);
157
158/**
159 * st_write -
160 * internal write function, passed onto protocol drivers
161 * via the write function ptr of protocol struct
162 */
163long st_write(struct sk_buff *);
164
165/* function to be called from ST-LL */
166void st_ll_send_frame(enum proto_type, struct sk_buff *);
167
168/* internal wake up function */
169void st_tx_wakeup(struct st_data_s *st_data);
170
171/* init, exit entry funcs called from KIM */
172int st_core_init(struct st_data_s **);
173void st_core_exit(struct st_data_s *);
174
175/* ask for reference from KIM */
176void st_kim_ref(struct st_data_s **, int);
177
178#define GPS_STUB_TEST
179#ifdef GPS_STUB_TEST
180int gps_chrdrv_stub_write(const unsigned char*, int);
181void gps_chrdrv_stub_init(void);
182#endif
183
184/*
185 * header information used by st_kim.c
186 */
187
188/* time in msec to wait for
189 * line discipline to be installed
190 */
191#define LDISC_TIME 500