blob: 7e960bad9b216d59d015d0d38923371abe02d9a0 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/******************************************************************************
43
44*
45
46* Name: pmcApi.h
47
48*
49
50* Description: Power Management Control (PMC) API definitions.
51
52* Copyright 2008 (c) Qualcomm, Incorporated.
53
54* All Rights Reserved.
55
56* Qualcomm Confidential and Proprietary.
57
58*
59
60******************************************************************************/
61
62
63#ifndef __PMC_API_H__
64
65#define __PMC_API_H__
66
67//This timer value determines the default periodicity at which BMPS retries will happen
68//This default value is overwritten typicaly by OS specific registry/INI values.
69#define BMPS_TRAFFIC_TIMER_DEFAULT 5000 //unit = ms
70#define DHCP_REMAIN_POWER_ACTIVE_THRESHOLD 12 // (12 * 5) sec = 60 seconds = 1 min
71
72//This timer value is used when starting the timer right after association. This value
73//should be large enough to allow the auth, DHCP handshake to complete
74#define BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP 8000 //unit = ms
75
76#define PMC_IS_CHIP_ACCESSIBLE(pmcState) ( (IMPS != (pmcState)) && (REQUEST_IMPS != (pmcState)) && \
77 (STANDBY != (pmcState)) && (REQUEST_STANDBY != (pmcState)) )
78
79
80
81/* Power events that are signaled to PMC. */
82
83typedef enum ePmcPowerEvent
84
85{
86
87 ePMC_SYSTEM_HIBERNATE, /* host is entering hibernation */
88
89 ePMC_SYSTEM_RESUME, /* host is resuming after hibernation */
90
91 ePMC_HW_WLAN_SWITCH_OFF, /* Hardware WLAN Switch has been turned off */
92
93 ePMC_HW_WLAN_SWITCH_ON, /* Hardware WLAN Switch has been turned on */
94
95 ePMC_SW_WLAN_SWITCH_OFF, /* Software WLAN Switch has been turned off */
96
97 ePMC_SW_WLAN_SWITCH_ON, /* Software WLAN Switch has been turned on */
98
99 ePMC_BATTERY_OPERATION, /* host is now operating on battery power */
100
101 ePMC_AC_OPERATION /* host is now operating on AC power */
102
103} tPmcPowerEvent;
104
105
106
107
108/* Power saving modes. */
109
110typedef enum ePmcPowerSavingMode
111
112{
113
114 ePMC_IDLE_MODE_POWER_SAVE, /* Idle Mode Power Save (IMPS) */
115
116 ePMC_BEACON_MODE_POWER_SAVE, /* Beacon Mode Power Save (BMPS) */
117
118 ePMC_SPATIAL_MULTIPLEX_POWER_SAVE, /* Spatial Multiplexing Power Save (SMPS) */
119
120 ePMC_UAPSD_MODE_POWER_SAVE, /* Unscheduled Automatic Power Save Delivery Mode */
121
122 ePMC_STANDBY_MODE_POWER_SAVE, /* Standby Power Save Mode */
123
124 ePMC_WOWL_MODE_POWER_SAVE /* Wake-on-Wireless LAN Power Save Mode */
125
126} tPmcPowerSavingMode;
127
128
129
130
131/* Switch states. */
132
133typedef enum ePmcSwitchState
134
135{
136
137 ePMC_SWITCH_OFF, /* switch off */
138
139 ePMC_SWITCH_ON /* switch on */
140
141} tPmcSwitchState;
142
143
144
145
146/* Device power states. */
147
148typedef enum ePmcPowerState
149
150{
151
152 ePMC_FULL_POWER, /* full power */
153
154 ePMC_LOW_POWER, /* low power */
155
156} tPmcPowerState;
157
158
159
160/* PMC states. */
161
162typedef enum ePmcState
163
164{
165
166 STOPPED, /* PMC is stopped */
167
168 FULL_POWER, /* full power */
169
170 LOW_POWER, /* low power */
171
172 REQUEST_IMPS, /* requesting IMPS */
173
174 IMPS, /* in IMPS */
175
176 REQUEST_BMPS, /* requesting BMPS */
177
178 BMPS, /* in BMPS */
179
180 REQUEST_FULL_POWER, /* requesting full power */
181
182 REQUEST_START_UAPSD, /* requesting Start UAPSD */
183
184 REQUEST_STOP_UAPSD, /* requesting Stop UAPSD */
185
186 UAPSD, /* in UAPSD */
187
188 REQUEST_STANDBY, /* requesting standby mode */
189
190 STANDBY, /* in standby mode */
191
192 REQUEST_ENTER_WOWL, /* requesting enter WOWL */
193
194 REQUEST_EXIT_WOWL, /* requesting exit WOWL */
195
196 WOWL /* Chip in WOWL mode */
197
198} tPmcState;
199
200
201/* Which beacons should be forwarded to the host. */
202
203typedef enum ePmcBeaconsToForward
204
205{
206
207 ePMC_NO_BEACONS, /* none */
208
209 ePMC_BEACONS_WITH_TIM_SET, /* with TIM set */
210
211 ePMC_BEACONS_WITH_DTIM_SET, /* with DTIM set */
212
213 ePMC_NTH_BEACON, /* every Nth beacon */
214
215 ePMC_ALL_BEACONS /* all beacons */
216
217} tPmcBeaconsToForward;
218
219
220
221
222/* The Spatial Mulitplexing Power Save modes. */
223
224typedef enum ePmcSmpsMode
225
226{
227
228 ePMC_DYNAMIC_SMPS, /* dynamic SMPS */
229
230 ePMC_STATIC_SMPS /* static SMPS */
231
232} tPmcSmpsMode;
233
234
235
236
237/* Configuration parameters for Idle Mode Power Save (IMPS). */
238
239typedef struct sPmcImpsConfigParams
240
241{
242
243 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter IMPS only when host operating
244
245 on battery power, TRUE if device should enter always */
246
247} tPmcImpsConfigParams, *tpPmcImpsConfigParams;
248
249
250
251
252/* Configuration parameters for Beacon Mode Power Save (BMPS). */
253
254typedef struct sPmcBmpsConfigParams
255
256{
257
258 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter BMPS only when host operating on
259
260 battery power, TRUE if device should enter always */
261
262 tANI_U32 txThreshold; /* transmit rate under which BMPS should be entered (frames / traffic measurement period) */
263
264 tANI_U32 rxThreshold; /* receive rate under which BMPS should be entered (frames / traffic measurement period) */
265
266 tANI_U32 trafficMeasurePeriod; /* period for BMPS traffic measurement (milliseconds) */
267
268 tANI_U32 bmpsPeriod; /* amount of time in low power (beacon intervals) */
269
270 tPmcBeaconsToForward forwardBeacons; /* which beacons should be forwarded to the host */
271
272 tANI_U32 valueOfN; /* the value of N when forwardBeacons is set to ePMC_NTH_BEACON */
273
274 tANI_BOOLEAN usePsPoll; /* TRUE if PS-POLL should be used to retrieve frames from AP, FALSE if a
275
276 null data frame with the PM bit reset should be used */
277
278 tANI_BOOLEAN setPmOnLastFrame; /* TRUE to keep device in BMPS as much as possible, FALSE otherwise, TRUE means:
279
280 1) PM bit should be set on last pending transmit data frame
281
282 2) null frame with PM bit set should be transmitted after last pending receive
283
284 frame has been processed */
285
286 tANI_BOOLEAN enableBeaconEarlyTermination; /* if TRUE, BET feature in RIVA
287 will be enabled, FALSE otherwise, TRUE means:
288 RXP will read the beacon header for the
289 TIM bit & discard the rest if set to 0,
290 while in BMPS */
291 tANI_U8 bcnEarlyTermWakeInterval; /* This specifies how often in terms
292 of LI we will disable BET in order to sync
293 up TSF*/
294
295} tPmcBmpsConfigParams, *tpPmcBmpsConfigParams;
296
297
298
299
300/* Configuration parameters for Spatial Mulitplexing Power Save (SMPS). */
301
302typedef struct sPmcSmpsConfigParams
303
304{
305
306 tPmcSmpsMode mode; /* mode to use */
307
308 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter SMPS only when host operating on
309
310 battery power, TRUE if device should enter always */
311
312} tPmcSmpsConfigParams, *tpPmcSmpsConfigParams;
313
314
315/* Routine definitions. */
316
317extern eHalStatus pmcOpen (tHalHandle hHal);
318
319extern eHalStatus pmcStart (tHalHandle hHal);
320
321extern eHalStatus pmcStop (tHalHandle hHal);
322
323extern eHalStatus pmcClose (tHalHandle hHal );
324
325extern eHalStatus pmcSignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event);
326
327extern eHalStatus pmcSetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
328
329extern eHalStatus pmcGetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
330
331extern eHalStatus pmcEnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
332
333extern eHalStatus pmcStartAutoBmpsTimer (tHalHandle hHal);
334
335extern eHalStatus pmcStopAutoBmpsTimer (tHalHandle hHal);
336
337extern eHalStatus pmcDisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
338
339extern eHalStatus pmcQueryPowerState (tHalHandle hHal, tPmcPowerState *pPowerState, tPmcSwitchState *pHwWlanSwitchState,
340
341 tPmcSwitchState *pSwWlanSwitchState);
342
343extern tANI_BOOLEAN pmcIsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode);
344
345extern eHalStatus pmcRequestFullPower (tHalHandle hHal, void (*callbackRoutine) (void *callbackContext, eHalStatus status),
346
347 void *callbackContext, tRequestFullPowerReason fullPowerReason);
348
349extern eHalStatus pmcRequestImps (tHalHandle hHal, tANI_U32 impsPeriod,
350
351 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
352
353 void *callbackContext);
354
355extern eHalStatus pmcRegisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext),
356
357 void *checkContext);
358
359extern eHalStatus pmcDeregisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext));
360
361extern void pmcMessageProcessor (tHalHandle hHal, tSirSmeRsp *pMsg);
Kiran Kumar Lokeref8c39922013-03-18 11:08:11 -0700362extern void pmcResetImpsFailStatus (tHalHandle hHal);
363extern v_BOOL_t IsPmcImpsReqFailed (tHalHandle hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365extern eHalStatus pmcRequestBmps (
366
367 tHalHandle hHal,
368
369 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
370
371 void *callbackContext);
372
373
374extern eHalStatus pmcStartUapsd (
375
376 tHalHandle hHal,
377
378 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
379
380 void *callbackContext);
381
382
383extern eHalStatus pmcStopUapsd (tHalHandle hHal);
384
385
386extern eHalStatus pmcRequestStandby (
387
388 tHalHandle hHal,
389
390 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
391
392 void *callbackContext);
393
394
395extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal,
396
397 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
398
399 void *callbackContext);
400
401
402extern eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal,
403
404 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
405
406
407extern eHalStatus pmcReady(tHalHandle hHal);
408
409
410void pmcDumpInit(tHalHandle hHal);
411
412
413extern eHalStatus pmcWowlAddBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700415 tpSirWowlAddBcastPtrn pattern,
416 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700417
418
419extern eHalStatus pmcWowlDelBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700421 tpSirWowlDelBcastPtrn pattern,
422 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
424
425extern eHalStatus pmcEnterWowl (
426
427 tHalHandle hHal,
428
429 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
430
431 void *enterWowlCallbackContext,
432#ifdef WLAN_WAKEUP_EVENTS
433 void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
434
435 void *wakeReasonIndCBContext,
436#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700437 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438
439extern eHalStatus pmcExitWowl (tHalHandle hHal);
440
441
Jeff Johnsone7245742012-09-05 17:12:55 -0700442extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700443 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700444
445/* ---------------------------------------------------------------------------
446 \fn pmcSetKeepAlive
447 \brief Set the Keep Alive feature.
448 \param hHal - The handle returned by macOpen.
449 \param pRequest - Pointer to the Keep Alive.
450 \return eHalStatus
451 eHAL_STATUS_FAILURE Cannot set the keepalive.
452 eHAL_STATUS_SUCCESS Request accepted.
453 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700454extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700455
456extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
457
458extern tANI_BOOLEAN pmcAllowImps( tHalHandle hHal );
459
460
461#ifdef FEATURE_WLAN_SCAN_PNO
462/*Pref netw found Cb declaration*/
463typedef void(*preferredNetworkFoundIndCallback)(void *callbackContext, tpSirPrefNetworkFoundInd pPrefNetworkFoundInd);
464
465extern eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext);
466extern eHalStatus pmcSetRssiFilter(tHalHandle hHal, v_U8_t rssiThreshold);
467#endif // FEATURE_WLAN_SCAN_PNO
468
469#ifdef WLAN_FEATURE_PACKET_FILTERING
470// Packet Coalescing Filter Match Count Callback declaration
471typedef void(*FilterMatchCountCallback)(void *callbackContext,
472 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700473extern eHalStatus pmcGetFilterMatchCount(tHalHandle hHal, FilterMatchCountCallback callbackRoutine,
474 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700475#endif // WLAN_FEATURE_PACKET_FILTERING
476
477#ifdef WLAN_FEATURE_GTK_OFFLOAD
478// GTK Offload Information Callback declaration
479typedef void(*GTKOffloadGetInfoCallback)(void *callbackContext, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
480
481/* ---------------------------------------------------------------------------
482 \fn pmcSetGTKOffload
483 \brief Set GTK offload feature.
484 \param hHal - The handle returned by macOpen.
485 \param pGtkOffload - Pointer to the GTK offload request.
486 \return eHalStatus
487 eHAL_STATUS_FAILURE Cannot set the offload.
488 eHAL_STATUS_SUCCESS Request accepted.
489 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700490extern eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700491
492/* ---------------------------------------------------------------------------
493 \fn pmcGetGTKOffload
494 \brief Get GTK offload information.
495 \param hHal - The handle returned by macOpen.
496 \param callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
497 \return eHalStatus
498 eHAL_STATUS_FAILURE Cannot set the offload.
499 eHAL_STATUS_SUCCESS Request accepted.
500 ---------------------------------------------------------------------------*/
Gopichand Nakkala870cbae2013-03-15 21:16:09 +0530501extern eHalStatus pmcGetGTKOffload(tHalHandle hHal,
502 GTKOffloadGetInfoCallback callbackRoutine,
503 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700504#endif // WLAN_FEATURE_GTK_OFFLOAD
505
506#endif
507