blob: ab8cececfc5bc0394e097203f41421b17869fe64 [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);
362
363
364extern eHalStatus pmcRequestBmps (
365
366 tHalHandle hHal,
367
368 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
369
370 void *callbackContext);
371
372
373extern eHalStatus pmcStartUapsd (
374
375 tHalHandle hHal,
376
377 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
378
379 void *callbackContext);
380
381
382extern eHalStatus pmcStopUapsd (tHalHandle hHal);
383
384
385extern eHalStatus pmcRequestStandby (
386
387 tHalHandle hHal,
388
389 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
390
391 void *callbackContext);
392
393
394extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal,
395
396 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
397
398 void *callbackContext);
399
400
401extern eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal,
402
403 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
404
405
406extern eHalStatus pmcReady(tHalHandle hHal);
407
408
409void pmcDumpInit(tHalHandle hHal);
410
411
412extern eHalStatus pmcWowlAddBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700414 tpSirWowlAddBcastPtrn pattern,
415 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700416
417
418extern eHalStatus pmcWowlDelBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700420 tpSirWowlDelBcastPtrn pattern,
421 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
423
424extern eHalStatus pmcEnterWowl (
425
426 tHalHandle hHal,
427
428 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
429
430 void *enterWowlCallbackContext,
431#ifdef WLAN_WAKEUP_EVENTS
432 void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
433
434 void *wakeReasonIndCBContext,
435#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700436 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700437
438extern eHalStatus pmcExitWowl (tHalHandle hHal);
439
440
Jeff Johnsone7245742012-09-05 17:12:55 -0700441extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700442 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
444/* ---------------------------------------------------------------------------
445 \fn pmcSetKeepAlive
446 \brief Set the Keep Alive feature.
447 \param hHal - The handle returned by macOpen.
448 \param pRequest - Pointer to the Keep Alive.
449 \return eHalStatus
450 eHAL_STATUS_FAILURE Cannot set the keepalive.
451 eHAL_STATUS_SUCCESS Request accepted.
452 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700453extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
455extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
456
457extern tANI_BOOLEAN pmcAllowImps( tHalHandle hHal );
458
459
460#ifdef FEATURE_WLAN_SCAN_PNO
461/*Pref netw found Cb declaration*/
462typedef void(*preferredNetworkFoundIndCallback)(void *callbackContext, tpSirPrefNetworkFoundInd pPrefNetworkFoundInd);
463
464extern eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext);
465extern eHalStatus pmcSetRssiFilter(tHalHandle hHal, v_U8_t rssiThreshold);
466#endif // FEATURE_WLAN_SCAN_PNO
467
468#ifdef WLAN_FEATURE_PACKET_FILTERING
469// Packet Coalescing Filter Match Count Callback declaration
470typedef void(*FilterMatchCountCallback)(void *callbackContext,
471 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700472extern eHalStatus pmcGetFilterMatchCount(tHalHandle hHal, FilterMatchCountCallback callbackRoutine,
473 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700474#endif // WLAN_FEATURE_PACKET_FILTERING
475
476#ifdef WLAN_FEATURE_GTK_OFFLOAD
477// GTK Offload Information Callback declaration
478typedef void(*GTKOffloadGetInfoCallback)(void *callbackContext, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
479
480/* ---------------------------------------------------------------------------
481 \fn pmcSetGTKOffload
482 \brief Set GTK offload feature.
483 \param hHal - The handle returned by macOpen.
484 \param pGtkOffload - Pointer to the GTK offload request.
485 \return eHalStatus
486 eHAL_STATUS_FAILURE Cannot set the offload.
487 eHAL_STATUS_SUCCESS Request accepted.
488 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700489extern eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700490
491/* ---------------------------------------------------------------------------
492 \fn pmcGetGTKOffload
493 \brief Get GTK offload information.
494 \param hHal - The handle returned by macOpen.
495 \param callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
496 \return eHalStatus
497 eHAL_STATUS_FAILURE Cannot set the offload.
498 eHAL_STATUS_SUCCESS Request accepted.
499 ---------------------------------------------------------------------------*/
500extern eHalStatus pmcGetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext);
501#endif // WLAN_FEATURE_GTK_OFFLOAD
502
503#endif
504