blob: 0297f0713635c427fadf469b6c3b721ece5851a2 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14/*
15 * SDIO CMUX API
16 */
17
18#ifndef __SDIO_CMUX__
19#define __SDIO_CMUX__
20
Manu Gautamb19046a2011-09-02 15:56:38 +053021#ifdef CONFIG_MSM_SDIO_CMUX
22
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023enum {
24 SDIO_CMUX_DATA_CTL_0,
25 SDIO_CMUX_DATA_CTL_1,
26 SDIO_CMUX_DATA_CTL_2,
27 SDIO_CMUX_DATA_CTL_3,
28 SDIO_CMUX_DATA_CTL_4,
29 SDIO_CMUX_DATA_CTL_5,
30 SDIO_CMUX_DATA_CTL_6,
31 SDIO_CMUX_DATA_CTL_7,
32 SDIO_CMUX_USB_CTL_0,
33 SDIO_CMUX_USB_DUN_CTL_0,
Karthikeyan Ramasubramanian4d3ebd42011-09-27 12:54:07 -060034 SDIO_CMUX_CSVT_CTL_0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035 SDIO_CMUX_NUM_CHANNELS
36};
37
38
39/*
40 * sdio_cmux_open - Open the mux channel
41 *
42 * @id: Mux Channel id to be opened
43 * @receive_cb: Notification when data arrives. Parameters are data received,
44 * size of data, private context pointer.
45 * @write_done: Notification when data is written. Parameters are data written,
46 * size of data, private context pointer. Please note that the data
47 * written pointer will always be NULL as the cmux makes an internal copy
48 * of the data.
49 * @priv: caller's private context pointer
50 */
51int sdio_cmux_open(const int id,
52 void (*receive_cb)(void *, int, void *),
53 void (*write_done)(void *, int, void *),
54 void (*status_callback)(int, void *),
55 void *priv);
56
57/*
58 * sdio_cmux_close - Close the mux channel
59 *
60 * @id: Channel id to be closed
61 */
62int sdio_cmux_close(int id);
63
64/*
65 * sdio_cmux_write_avail - Write space avaialable for this channel
66 *
67 * @id: Channel id to look for the available write space
68 */
69int sdio_cmux_write_avail(int id);
70
71/*
72 * sdio_cmux_write - Write the data onto the CMUX channel
73 *
74 * @id: Channel id onto which the data has to be written
75 * @data: Starting address of the data buffer to be written
76 * @len: Length of the data to be written
77 */
78int sdio_cmux_write(int id, void *data, int len);
79
80/* these are used to get and set the IF sigs of a channel.
81 * DTR and RTS can be set; DSR, CTS, CD and RI can be read.
82 */
83int sdio_cmux_tiocmget(int id);
84int sdio_cmux_tiocmset(int id, unsigned int set, unsigned int clear);
85
86/*
87 * is_remote_open - Check whether the remote channel is open
88 *
89 * @id: Channel id to be checked
90 */
91int is_remote_open(int id);
92
93/*
94 * sdio_cmux_is_channel_reset - Check whether the channel is in reset state
95 *
96 * @id: Channel id to be checked
97 */
98int sdio_cmux_is_channel_reset(int id);
99
Manu Gautamb19046a2011-09-02 15:56:38 +0530100#else
101
102static int __maybe_unused sdio_cmux_open(const int id,
103 void (*receive_cb)(void *, int, void *),
104 void (*write_done)(void *, int, void *),
105 void (*status_callback)(int, void *),
106 void *priv)
107{
108 return -ENODEV;
109}
110static int __maybe_unused sdio_cmux_close(int id)
111{
112 return -ENODEV;
113}
114
115static int __maybe_unused sdio_cmux_write_avail(int id)
116{
117 return -ENODEV;
118}
119
120static int __maybe_unused sdio_cmux_write(int id, void *data, int len)
121{
122 return -ENODEV;
123}
124
125static int __maybe_unused sdio_cmux_tiocmget(int id)
126{
127 return -ENODEV;
128}
129
130static int __maybe_unused sdio_cmux_tiocmset(int id, unsigned int set,
131 unsigned int clear)
132{
133 return -ENODEV;
134}
135
136static int __maybe_unused is_remote_open(int id)
137{
138 return -ENODEV;
139}
140
141static int __maybe_unused sdio_cmux_is_channel_reset(int id)
142{
143 return -ENODEV;
144}
145#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700146#endif /* __SDIO_CMUX__ */