import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / connectivity / conn_soc / common / include / wmt_exp.h
CommitLineData
6fa3eb70
S
1/*
2* Copyright (C) 2011-2014 MediaTek Inc.
3*
4* This program is free software: you can redistribute it and/or modify it under the terms of the
5* GNU General Public License version 2 as published by the Free Software Foundation.
6*
7* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9* See the GNU General Public License for more details.
10*
11* You should have received a copy of the GNU General Public License along with this program.
12* If not, see <http://www.gnu.org/licenses/>.
13*/
14
15/*! \file
16 \brief Declaration of library functions
17
18 Any definitions in this file will be shared among GLUE Layer and internal Driver Stack.
19*/
20
21
22
23#ifndef _WMT_EXP_H_
24#define _WMT_EXP_H_
25
26#include <mach/mtk_wcn_cmb_stub.h>
27#include "osal.h"
28#include "wmt_plat.h"
29#include "wmt_stp_exp.h"
30//not to reference to internal wmt
31//#include "wmt_core.h"
32/*******************************************************************************
33* C O M P I L E R F L A G S
34********************************************************************************
35*/
36
37/*******************************************************************************
38* M A C R O S
39********************************************************************************
40*/
41#if 1 /* moved from wmt_lib.h */
42#ifndef DFT_TAG
43#define DFT_TAG "[WMT-DFT]"
44#endif
45
46#define WMT_LOUD_FUNC(fmt, arg...) if (gWmtDbgLvl >= WMT_LOG_LOUD) { osal_dbg_print(DFT_TAG "[L]%s:" fmt, __FUNCTION__ ,##arg);}
47#define WMT_INFO_FUNC(fmt, arg...) if (gWmtDbgLvl >= WMT_LOG_INFO) { osal_info_print(DFT_TAG "[I]%s:" fmt, __FUNCTION__ ,##arg);}
48#define WMT_WARN_FUNC(fmt, arg...) if (gWmtDbgLvl >= WMT_LOG_WARN) { osal_warn_print(DFT_TAG "[W]%s:" fmt, __FUNCTION__ ,##arg);}
49#define WMT_ERR_FUNC(fmt, arg...) if (gWmtDbgLvl >= WMT_LOG_ERR) { osal_err_print(DFT_TAG "[E]%s(%d):" fmt, __FUNCTION__ , __LINE__, ##arg);}
50#define WMT_DBG_FUNC(fmt, arg...) if (gWmtDbgLvl >= WMT_LOG_DBG) { osal_dbg_print(DFT_TAG "[D]%s:" fmt, __FUNCTION__ ,##arg);}
51#define WMT_TRC_FUNC(f) if (gWmtDbgLvl >= WMT_LOG_DBG) { osal_dbg_print(DFT_TAG "<%s> <%d>\n", __FUNCTION__, __LINE__);}
52#endif
53
54/*******************************************************************************
55* E X T E R N A L R E F E R E N C E S
56********************************************************************************
57*/
58#if 1 /* moved from wmt_lib.h */
59extern UINT32 gWmtDbgLvl ;
60#endif
61extern OSAL_BIT_OP_VAR gBtWifiGpsState;
62extern OSAL_BIT_OP_VAR gGpsFmState;
63extern UINT32 gWifiProbed;
64/*******************************************************************************
65* C O N S T A N T S
66********************************************************************************
67*/
68#if 1 /* moved from wmt_lib.h */
69#define WMT_LOG_LOUD 4
70#define WMT_LOG_DBG 3
71#define WMT_LOG_INFO 2
72#define WMT_LOG_WARN 1
73#define WMT_LOG_ERR 0
74#endif
75#define CFG_CORE_INTERNAL_TXRX 0 /*just do TX/RX in host side*/
76
77/*******************************************************************************
78* D A T A T Y P E S
79********************************************************************************
80*/
81#ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
82typedef enum _ENUM_WMTDRV_TYPE_T {
83 WMTDRV_TYPE_BT = 0,
84 WMTDRV_TYPE_FM = 1,
85 WMTDRV_TYPE_GPS = 2,
86 WMTDRV_TYPE_WIFI = 3,
87 WMTDRV_TYPE_WMT = 4,
88 WMTDRV_TYPE_STP = 5,
89 WMTDRV_TYPE_LPBK = 6,
90 WMTDRV_TYPE_COREDUMP = 7,
91 WMTDRV_TYPE_MAX
92} ENUM_WMTDRV_TYPE_T, *P_ENUM_WMTDRV_TYPE_T;
93
94// TODO: [ChangeFeature][GeorgeKuo] Reconsider usage of this type
95// TODO: how do we extend for new chip and newer revision?
96// TODO: This way is hard to extend
97typedef enum _ENUM_WMTHWVER_TYPE_T{
98 WMTHWVER_E1 = 0x0,
99 WMTHWVER_E2 = 0x1,
100 WMTHWVER_E3 = 0x2,
101 WMTHWVER_E4 = 0x3,
102 WMTHWVER_E5 = 0x4,
103 WMTHWVER_E6 = 0x5,
104 WMTHWVER_MAX,
105 WMTHWVER_INVALID = 0xff
106} ENUM_WMTHWVER_TYPE_T, *P_ENUM_WMTHWVER_TYPE_T;
107
108typedef enum _ENUM_WMTDSNS_TYPE_T{
109 WMTDSNS_FM_DISABLE = 0,
110 WMTDSNS_FM_ENABLE = 1,
111 WMTDSNS_FM_GPS_DISABLE = 2,
112 WMTDSNS_FM_GPS_ENABLE = 3,
113 WMTDSNS_MAX
114} ENUM_WMTDSNS_TYPE_T, *P_ENUM_WMTDSNS_TYPE_T;
115
116typedef enum _ENUM_WMTTHERM_TYPE_T{
117 WMTTHERM_ZERO = 0,
118 WMTTHERM_ENABLE = WMTTHERM_ZERO + 1,
119 WMTTHERM_READ = WMTTHERM_ENABLE + 1,
120 WMTTHERM_DISABLE = WMTTHERM_READ + 1,
121 WMTTHERM_MAX
122}ENUM_WMTTHERM_TYPE_T, *P_ENUM_WMTTHERM_TYPE_T;
123
124typedef enum _ENUM_WMTMSG_TYPE_T {
125 WMTMSG_TYPE_POWER_ON = 0,
126 WMTMSG_TYPE_POWER_OFF = 1,
127 WMTMSG_TYPE_RESET = 2,
128 WMTMSG_TYPE_STP_RDY= 3,
129 WMTMSG_TYPE_HW_FUNC_ON= 4,
130 WMTMSG_TYPE_MAX
131} ENUM_WMTMSG_TYPE_T, *P_ENUM_WMTMSG_TYPE_T;
132
133typedef void (*PF_WMT_CB)(
134 ENUM_WMTDRV_TYPE_T, /* Source driver type */
135 ENUM_WMTDRV_TYPE_T, /* Destination driver type */
136 ENUM_WMTMSG_TYPE_T, /* Message type */
137 VOID *, /* READ-ONLY buffer. Buffer is allocated and freed by WMT_drv. Client
138 can't touch this buffer after this function return. */
139 UINT32 /* Buffer size in unit of byte */
140);
141
142typedef enum _SDIO_PS_OP{
143 OWN_SET = 0,
144 OWN_CLR = 1,
145 OWN_STATE = 2,
146} SDIO_PS_OP;
147
148
149typedef INT32 (*PF_WMT_SDIO_PSOP)(SDIO_PS_OP);
150
151
152typedef enum _ENUM_WMTCHIN_TYPE_T{
153 WMTCHIN_CHIPID = 0x0,
154 WMTCHIN_HWVER = WMTCHIN_CHIPID + 1,
155 WMTCHIN_MAPPINGHWVER = WMTCHIN_HWVER + 1,
156 WMTCHIN_FWVER = WMTCHIN_MAPPINGHWVER + 1,
157 WMTCHIN_MAX,
158
159}ENUM_WMT_CHIPINFO_TYPE_T, *P_ENUM_WMT_CHIPINFO_TYPE_T;
160
161#endif
162
163typedef enum _ENUM_WMTRSTMSG_TYPE_T{
164 WMTRSTMSG_RESET_START = 0x0,
165 WMTRSTMSG_RESET_END = 0x1,
166 WMTRSTMSG_RESET_END_FAIL = 0x2,
167 WMTRSTMSG_RESET_MAX,
168 WMTRSTMSG_RESET_INVALID = 0xff
169} ENUM_WMTRSTMSG_TYPE_T, *P_ENUM_WMTRSTMSG_TYPE_T;
170
171typedef enum _ENUM_BT_GPS_ONOFF_STATE_T{
172 WMT_BT_ON = 0,
173 WMT_GPS_ON = 1,
174 WMT_WIFI_ON = 2,
175 WMT_FM_ON = 3,
176 WMT_BT_GPS_STATE_MAX,
177 WMT_BT_GPS_STATE_INVALID = 0xff
178} ENUM_BT_GPS_ONOFF_STATE_T, *P_ENUM_BT_GPS_ONOFF_STATE_T;
179
180#if 1 /* moved from wmt_core.h */
181typedef enum {
182 WMT_SDIO_SLOT_INVALID = 0,
183 WMT_SDIO_SLOT_SDIO1 = 1, /* Wi-Fi dedicated SDIO1*/
184 WMT_SDIO_SLOT_SDIO2 = 2,
185 WMT_SDIO_SLOT_MAX
186} WMT_SDIO_SLOT_NUM;
187
188typedef enum {
189 WMT_SDIO_FUNC_STP = 0,
190 WMT_SDIO_FUNC_WIFI = 1,
191 WMT_SDIO_FUNC_MAX
192} WMT_SDIO_FUNC_TYPE;
193#endif
194
195
196typedef INT32(*wmt_wlan_probe_cb)(VOID);
197typedef INT32(*wmt_wlan_remove_cb)(VOID);
198typedef INT32(*wmt_wlan_bus_cnt_get_cb)(VOID);
199typedef INT32(*wmt_wlan_bus_cnt_clr_cb)(VOID);
200
201typedef struct _MTK_WCN_WMT_WLAN_CB_INFO{
202 wmt_wlan_probe_cb wlan_probe_cb;
203 wmt_wlan_remove_cb wlan_remove_cb;
204 wmt_wlan_bus_cnt_get_cb wlan_bus_cnt_get_cb;
205 wmt_wlan_bus_cnt_clr_cb wlan_bus_cnt_clr_cb;
206}MTK_WCN_WMT_WLAN_CB_INFO,*P_MTK_WCN_WMT_WLAN_CB_INFO;
207
208extern INT32 mtk_wcn_wmt_wlan_reg(P_MTK_WCN_WMT_WLAN_CB_INFO pWmtWlanCbInfo);
209extern INT32 mtk_wcn_wmt_wlan_unreg(VOID);
210/*******************************************************************************
211* P U B L I C D A T A
212********************************************************************************
213*/
214extern wmt_wlan_probe_cb mtk_wcn_wlan_probe;
215extern wmt_wlan_remove_cb mtk_wcn_wlan_remove;
216extern wmt_wlan_bus_cnt_get_cb mtk_wcn_wlan_bus_tx_cnt;
217extern wmt_wlan_bus_cnt_clr_cb mtk_wcn_wlan_bus_tx_cnt_clr;
218/*******************************************************************************
219* P R I V A T E D A T A
220********************************************************************************
221*/
222
223
224
225/*******************************************************************************
226* F U N C T I O N D E C L A R A T I O N S
227********************************************************************************
228*/
229/*subsystem function ctrl APIs*/
230
231#ifndef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
232#define WMT_EXP_HID_API_EXPORT 0
233
234extern MTK_WCN_BOOL
235mtk_wcn_wmt_func_off (
236 ENUM_WMTDRV_TYPE_T type
237 );
238
239extern MTK_WCN_BOOL
240mtk_wcn_wmt_func_on (
241 ENUM_WMTDRV_TYPE_T type
242 );
243
244extern MTK_WCN_BOOL mtk_wcn_wmt_dsns_ctrl (
245 ENUM_WMTDSNS_TYPE_T eType
246 );
247
248extern MTK_WCN_BOOL mtk_wcn_wmt_assert (ENUM_WMTDRV_TYPE_T type,
249 UINT32 reason
250 );
251
252extern INT32 mtk_wcn_wmt_msgcb_reg (
253 ENUM_WMTDRV_TYPE_T eType,
254 PF_WMT_CB pCb
255 );
256
257extern INT32 mtk_wcn_wmt_msgcb_unreg (
258 ENUM_WMTDRV_TYPE_T eType
259 );
260
261extern INT32
262mtk_wcn_stp_wmt_sdio_op_reg (
263 PF_WMT_SDIO_PSOP own_cb
264 );
265
266extern INT32
267mtk_wcn_stp_wmt_sdio_host_awake(
268 VOID
269 );
270/*
271return value:
272enable/disable thermal sensor function: true(1)/false(0)
273read thermal sensor function: thermal value
274
275*/
276extern INT8
277mtk_wcn_wmt_therm_ctrl (
278 ENUM_WMTTHERM_TYPE_T eType
279 );
280
281extern ENUM_WMTHWVER_TYPE_T
282mtk_wcn_wmt_hwver_get (VOID);
283
284#else
285#define WMT_EXP_HID_API_EXPORT 1
286#endif
287
288extern INT32 wmt_lib_set_aif (
289 CMB_STUB_AIF_X aif,
290 MTK_WCN_BOOL share
291 ); /* set AUDIO interface options */
292extern VOID
293wmt_lib_ps_irq_cb(VOID);
294
295extern VOID
296mtk_wcn_wmt_func_ctrl_for_plat (UINT32 on,
297 ENUM_WMTDRV_TYPE_T type);
298
299extern INT32 mtk_wcn_wmt_system_state_reset(VOID);
300
301#ifdef MTK_WCN_WMT_STP_EXP_SYMBOL_ABSTRACT
302extern VOID mtk_wcn_wmt_exp_init(VOID);
303extern VOID mtk_wcn_wmt_exp_deinit(VOID);
304#endif
305extern INT8 mtk_wcn_wmt_co_clock_flag_get(VOID);
306/*******************************************************************************
307* F U N C T I O N S
308********************************************************************************
309*/
310
311#endif /* _WMT_EXP_H_ */
312
313
314
315
316
317
318