Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 Gautam | b19046a | 2011-09-02 15:56:38 +0530 | [diff] [blame] | 21 | #ifdef CONFIG_MSM_SDIO_CMUX |
| 22 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 23 | enum { |
| 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 Ramasubramanian | 4d3ebd4 | 2011-09-27 12:54:07 -0600 | [diff] [blame] | 34 | SDIO_CMUX_CSVT_CTL_0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 35 | 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 | */ |
| 51 | int 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 | */ |
| 62 | int 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 | */ |
| 69 | int 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 | */ |
| 78 | int 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 | */ |
| 83 | int sdio_cmux_tiocmget(int id); |
| 84 | int 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 | */ |
| 91 | int 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 | */ |
| 98 | int sdio_cmux_is_channel_reset(int id); |
| 99 | |
Manu Gautam | b19046a | 2011-09-02 15:56:38 +0530 | [diff] [blame] | 100 | #else |
| 101 | |
| 102 | static 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 | } |
| 110 | static int __maybe_unused sdio_cmux_close(int id) |
| 111 | { |
| 112 | return -ENODEV; |
| 113 | } |
| 114 | |
| 115 | static int __maybe_unused sdio_cmux_write_avail(int id) |
| 116 | { |
| 117 | return -ENODEV; |
| 118 | } |
| 119 | |
| 120 | static int __maybe_unused sdio_cmux_write(int id, void *data, int len) |
| 121 | { |
| 122 | return -ENODEV; |
| 123 | } |
| 124 | |
| 125 | static int __maybe_unused sdio_cmux_tiocmget(int id) |
| 126 | { |
| 127 | return -ENODEV; |
| 128 | } |
| 129 | |
| 130 | static int __maybe_unused sdio_cmux_tiocmset(int id, unsigned int set, |
| 131 | unsigned int clear) |
| 132 | { |
| 133 | return -ENODEV; |
| 134 | } |
| 135 | |
| 136 | static int __maybe_unused is_remote_open(int id) |
| 137 | { |
| 138 | return -ENODEV; |
| 139 | } |
| 140 | |
| 141 | static int __maybe_unused sdio_cmux_is_channel_reset(int id) |
| 142 | { |
| 143 | return -ENODEV; |
| 144 | } |
| 145 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 146 | #endif /* __SDIO_CMUX__ */ |