blob: 4a1915f1a19816b220cd63c51549fbe66747e1ad [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumara4c34572015-07-09 20:00:41 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/******************************************************************************
29
30*
31
32* Name: pmcApi.h
33
34*
35
36* Description: Power Management Control (PMC) API definitions.
37
Jeff Johnson295189b2012-06-20 16:38:30 -070038* All Rights Reserved.
39
Jeff Johnson295189b2012-06-20 16:38:30 -070040
41*
42
43******************************************************************************/
44
45
46#ifndef __PMC_API_H__
47
48#define __PMC_API_H__
49
50//This timer value determines the default periodicity at which BMPS retries will happen
51//This default value is overwritten typicaly by OS specific registry/INI values.
52#define BMPS_TRAFFIC_TIMER_DEFAULT 5000 //unit = ms
53#define DHCP_REMAIN_POWER_ACTIVE_THRESHOLD 12 // (12 * 5) sec = 60 seconds = 1 min
54
55//This timer value is used when starting the timer right after association. This value
56//should be large enough to allow the auth, DHCP handshake to complete
57#define BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP 8000 //unit = ms
58
Padma, Santhosh Kumara4c34572015-07-09 20:00:41 +053059//This timer value is used to start the timer right after key completion
60//during roaming. This should be small enough to allow STA to enter PS
61//immediately after key completion as no DHCP phase during roaming.
62#define TRAFFIC_TIMER_ROAMING 100 //unit = ms
63
Jeff Johnson295189b2012-06-20 16:38:30 -070064#define PMC_IS_CHIP_ACCESSIBLE(pmcState) ( (IMPS != (pmcState)) && (REQUEST_IMPS != (pmcState)) && \
65 (STANDBY != (pmcState)) && (REQUEST_STANDBY != (pmcState)) )
66
Jeff Johnson295189b2012-06-20 16:38:30 -070067/* Power events that are signaled to PMC. */
68
69typedef enum ePmcPowerEvent
70
71{
72
73 ePMC_SYSTEM_HIBERNATE, /* host is entering hibernation */
74
75 ePMC_SYSTEM_RESUME, /* host is resuming after hibernation */
76
77 ePMC_HW_WLAN_SWITCH_OFF, /* Hardware WLAN Switch has been turned off */
78
79 ePMC_HW_WLAN_SWITCH_ON, /* Hardware WLAN Switch has been turned on */
80
81 ePMC_SW_WLAN_SWITCH_OFF, /* Software WLAN Switch has been turned off */
82
83 ePMC_SW_WLAN_SWITCH_ON, /* Software WLAN Switch has been turned on */
84
85 ePMC_BATTERY_OPERATION, /* host is now operating on battery power */
86
87 ePMC_AC_OPERATION /* host is now operating on AC power */
88
89} tPmcPowerEvent;
90
91
92
93
94/* Power saving modes. */
95
96typedef enum ePmcPowerSavingMode
97
98{
99
100 ePMC_IDLE_MODE_POWER_SAVE, /* Idle Mode Power Save (IMPS) */
101
102 ePMC_BEACON_MODE_POWER_SAVE, /* Beacon Mode Power Save (BMPS) */
103
104 ePMC_SPATIAL_MULTIPLEX_POWER_SAVE, /* Spatial Multiplexing Power Save (SMPS) */
105
106 ePMC_UAPSD_MODE_POWER_SAVE, /* Unscheduled Automatic Power Save Delivery Mode */
107
108 ePMC_STANDBY_MODE_POWER_SAVE, /* Standby Power Save Mode */
109
110 ePMC_WOWL_MODE_POWER_SAVE /* Wake-on-Wireless LAN Power Save Mode */
111
112} tPmcPowerSavingMode;
113
114
115
116
117/* Switch states. */
118
119typedef enum ePmcSwitchState
120
121{
122
123 ePMC_SWITCH_OFF, /* switch off */
124
125 ePMC_SWITCH_ON /* switch on */
126
127} tPmcSwitchState;
128
129
130
131
132/* Device power states. */
133
134typedef enum ePmcPowerState
135
136{
137
138 ePMC_FULL_POWER, /* full power */
139
140 ePMC_LOW_POWER, /* low power */
141
142} tPmcPowerState;
143
144
145
146/* PMC states. */
147
148typedef enum ePmcState
149
150{
151
152 STOPPED, /* PMC is stopped */
153
154 FULL_POWER, /* full power */
155
156 LOW_POWER, /* low power */
157
158 REQUEST_IMPS, /* requesting IMPS */
159
160 IMPS, /* in IMPS */
161
162 REQUEST_BMPS, /* requesting BMPS */
163
164 BMPS, /* in BMPS */
165
166 REQUEST_FULL_POWER, /* requesting full power */
167
168 REQUEST_START_UAPSD, /* requesting Start UAPSD */
169
170 REQUEST_STOP_UAPSD, /* requesting Stop UAPSD */
171
172 UAPSD, /* in UAPSD */
173
174 REQUEST_STANDBY, /* requesting standby mode */
175
176 STANDBY, /* in standby mode */
177
178 REQUEST_ENTER_WOWL, /* requesting enter WOWL */
179
180 REQUEST_EXIT_WOWL, /* requesting exit WOWL */
181
182 WOWL /* Chip in WOWL mode */
183
184} tPmcState;
185
Jeff Johnson295189b2012-06-20 16:38:30 -0700186/* Which beacons should be forwarded to the host. */
187
188typedef enum ePmcBeaconsToForward
189
190{
191
192 ePMC_NO_BEACONS, /* none */
193
194 ePMC_BEACONS_WITH_TIM_SET, /* with TIM set */
195
196 ePMC_BEACONS_WITH_DTIM_SET, /* with DTIM set */
197
198 ePMC_NTH_BEACON, /* every Nth beacon */
199
200 ePMC_ALL_BEACONS /* all beacons */
201
202} tPmcBeaconsToForward;
203
204
205
206
207/* The Spatial Mulitplexing Power Save modes. */
208
209typedef enum ePmcSmpsMode
210
211{
212
213 ePMC_DYNAMIC_SMPS, /* dynamic SMPS */
214
215 ePMC_STATIC_SMPS /* static SMPS */
216
217} tPmcSmpsMode;
218
c_hpothu01484c02014-05-16 14:05:15 +0530219typedef enum
220{
221 eWOWL_EXIT_USER,
222 eWOWL_EXIT_WAKEIND
223}tWowlExitSource;
Jeff Johnson295189b2012-06-20 16:38:30 -0700224
225/* Configuration parameters for Idle Mode Power Save (IMPS). */
226
227typedef struct sPmcImpsConfigParams
228
229{
230
231 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter IMPS only when host operating
232
233 on battery power, TRUE if device should enter always */
234
235} tPmcImpsConfigParams, *tpPmcImpsConfigParams;
236
237
238
239
240/* Configuration parameters for Beacon Mode Power Save (BMPS). */
241
242typedef struct sPmcBmpsConfigParams
243
244{
245
246 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter BMPS only when host operating on
247
248 battery power, TRUE if device should enter always */
249
250 tANI_U32 txThreshold; /* transmit rate under which BMPS should be entered (frames / traffic measurement period) */
251
252 tANI_U32 rxThreshold; /* receive rate under which BMPS should be entered (frames / traffic measurement period) */
253
254 tANI_U32 trafficMeasurePeriod; /* period for BMPS traffic measurement (milliseconds) */
255
256 tANI_U32 bmpsPeriod; /* amount of time in low power (beacon intervals) */
257
258 tPmcBeaconsToForward forwardBeacons; /* which beacons should be forwarded to the host */
259
260 tANI_U32 valueOfN; /* the value of N when forwardBeacons is set to ePMC_NTH_BEACON */
261
262 tANI_BOOLEAN usePsPoll; /* TRUE if PS-POLL should be used to retrieve frames from AP, FALSE if a
263
264 null data frame with the PM bit reset should be used */
265
266 tANI_BOOLEAN setPmOnLastFrame; /* TRUE to keep device in BMPS as much as possible, FALSE otherwise, TRUE means:
267
268 1) PM bit should be set on last pending transmit data frame
269
270 2) null frame with PM bit set should be transmitted after last pending receive
271
272 frame has been processed */
273
274 tANI_BOOLEAN enableBeaconEarlyTermination; /* if TRUE, BET feature in RIVA
275 will be enabled, FALSE otherwise, TRUE means:
276 RXP will read the beacon header for the
277 TIM bit & discard the rest if set to 0,
278 while in BMPS */
279 tANI_U8 bcnEarlyTermWakeInterval; /* This specifies how often in terms
280 of LI we will disable BET in order to sync
281 up TSF*/
282
283} tPmcBmpsConfigParams, *tpPmcBmpsConfigParams;
284
285
286
287
288/* Configuration parameters for Spatial Mulitplexing Power Save (SMPS). */
289
290typedef struct sPmcSmpsConfigParams
291
292{
293
294 tPmcSmpsMode mode; /* mode to use */
295
296 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter SMPS only when host operating on
297
298 battery power, TRUE if device should enter always */
299
300} tPmcSmpsConfigParams, *tpPmcSmpsConfigParams;
301
302
303/* Routine definitions. */
Jeff Johnson295189b2012-06-20 16:38:30 -0700304extern eHalStatus pmcOpen (tHalHandle hHal);
305
306extern eHalStatus pmcStart (tHalHandle hHal);
307
308extern eHalStatus pmcStop (tHalHandle hHal);
309
310extern eHalStatus pmcClose (tHalHandle hHal );
311
312extern eHalStatus pmcSignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event);
313
314extern eHalStatus pmcSetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
315
316extern eHalStatus pmcGetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
317
318extern eHalStatus pmcEnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
319
320extern eHalStatus pmcStartAutoBmpsTimer (tHalHandle hHal);
321
322extern eHalStatus pmcStopAutoBmpsTimer (tHalHandle hHal);
323
324extern eHalStatus pmcDisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
325
326extern eHalStatus pmcQueryPowerState (tHalHandle hHal, tPmcPowerState *pPowerState, tPmcSwitchState *pHwWlanSwitchState,
327
328 tPmcSwitchState *pSwWlanSwitchState);
329
330extern tANI_BOOLEAN pmcIsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode);
331
332extern eHalStatus pmcRequestFullPower (tHalHandle hHal, void (*callbackRoutine) (void *callbackContext, eHalStatus status),
333
334 void *callbackContext, tRequestFullPowerReason fullPowerReason);
335
336extern eHalStatus pmcRequestImps (tHalHandle hHal, tANI_U32 impsPeriod,
337
338 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
339
340 void *callbackContext);
341
342extern eHalStatus pmcRegisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext),
343
344 void *checkContext);
345
346extern eHalStatus pmcDeregisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext));
347
348extern void pmcMessageProcessor (tHalHandle hHal, tSirSmeRsp *pMsg);
Kiran Kumar Lokeref8c39922013-03-18 11:08:11 -0700349extern void pmcResetImpsFailStatus (tHalHandle hHal);
350extern v_BOOL_t IsPmcImpsReqFailed (tHalHandle hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700351
352extern eHalStatus pmcRequestBmps (
353
354 tHalHandle hHal,
355
356 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
357
358 void *callbackContext);
359
360
361extern eHalStatus pmcStartUapsd (
362
363 tHalHandle hHal,
364
365 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
366
367 void *callbackContext);
368
369
370extern eHalStatus pmcStopUapsd (tHalHandle hHal);
371
372
373extern eHalStatus pmcRequestStandby (
374
375 tHalHandle hHal,
376
377 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
378
379 void *callbackContext);
380
381
382extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal,
383
384 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
385
386 void *callbackContext);
387
388
389extern eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal,
390
391 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
392
393
394extern eHalStatus pmcReady(tHalHandle hHal);
395
396
397void pmcDumpInit(tHalHandle hHal);
398
399
400extern eHalStatus pmcWowlAddBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700402 tpSirWowlAddBcastPtrn pattern,
403 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700404
405
406extern eHalStatus pmcWowlDelBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700408 tpSirWowlDelBcastPtrn pattern,
409 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
411
412extern eHalStatus pmcEnterWowl (
413
414 tHalHandle hHal,
415
416 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
417
418 void *enterWowlCallbackContext,
419#ifdef WLAN_WAKEUP_EVENTS
420 void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
421
422 void *wakeReasonIndCBContext,
423#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700424 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700425
c_hpothu01484c02014-05-16 14:05:15 +0530426extern eHalStatus pmcExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -0700427
428
Jeff Johnsone7245742012-09-05 17:12:55 -0700429extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700430 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700431
432/* ---------------------------------------------------------------------------
433 \fn pmcSetKeepAlive
434 \brief Set the Keep Alive feature.
435 \param hHal - The handle returned by macOpen.
436 \param pRequest - Pointer to the Keep Alive.
437 \return eHalStatus
438 eHAL_STATUS_FAILURE Cannot set the keepalive.
439 eHAL_STATUS_SUCCESS Request accepted.
440 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700441extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700442
443extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
444
445extern tANI_BOOLEAN pmcAllowImps( tHalHandle hHal );
446
447
448#ifdef FEATURE_WLAN_SCAN_PNO
449/*Pref netw found Cb declaration*/
450typedef void(*preferredNetworkFoundIndCallback)(void *callbackContext, tpSirPrefNetworkFoundInd pPrefNetworkFoundInd);
451
452extern eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext);
453extern eHalStatus pmcSetRssiFilter(tHalHandle hHal, v_U8_t rssiThreshold);
454#endif // FEATURE_WLAN_SCAN_PNO
455
456#ifdef WLAN_FEATURE_PACKET_FILTERING
457// Packet Coalescing Filter Match Count Callback declaration
458typedef void(*FilterMatchCountCallback)(void *callbackContext,
459 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700460extern eHalStatus pmcGetFilterMatchCount(tHalHandle hHal, FilterMatchCountCallback callbackRoutine,
461 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700462#endif // WLAN_FEATURE_PACKET_FILTERING
463
464#ifdef WLAN_FEATURE_GTK_OFFLOAD
465// GTK Offload Information Callback declaration
466typedef void(*GTKOffloadGetInfoCallback)(void *callbackContext, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
467
468/* ---------------------------------------------------------------------------
469 \fn pmcSetGTKOffload
470 \brief Set GTK offload feature.
471 \param hHal - The handle returned by macOpen.
472 \param pGtkOffload - Pointer to the GTK offload request.
473 \return eHalStatus
474 eHAL_STATUS_FAILURE Cannot set the offload.
475 eHAL_STATUS_SUCCESS Request accepted.
476 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700477extern eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700478
479/* ---------------------------------------------------------------------------
480 \fn pmcGetGTKOffload
481 \brief Get GTK offload information.
482 \param hHal - The handle returned by macOpen.
483 \param callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
484 \return eHalStatus
485 eHAL_STATUS_FAILURE Cannot set the offload.
486 eHAL_STATUS_SUCCESS Request accepted.
487 ---------------------------------------------------------------------------*/
Gopichand Nakkala870cbae2013-03-15 21:16:09 +0530488extern eHalStatus pmcGetGTKOffload(tHalHandle hHal,
489 GTKOffloadGetInfoCallback callbackRoutine,
490 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700491#endif // WLAN_FEATURE_GTK_OFFLOAD
492
Rajeev79dbe4c2013-10-05 11:03:42 +0530493#ifdef FEATURE_WLAN_BATCH_SCAN
494/*Set batch scan request Cb declaration*/
495typedef void(*hddSetBatchScanReqCallback)(void *callbackContext,
496 tSirSetBatchScanRsp *pRsp);
497
498/*Trigger batch scan result indication Cb declaration*/
499typedef void(*hddTriggerBatchScanResultIndCallback)(void *callbackContext,
500 void *pRsp);
501
502/* -----------------------------------------------------------------------------
503 \fn pmcSetBatchScanReq
504 \brief Setting batch scan request in FW
505 \param hHal - The handle returned by macOpen.
506 \param sessionId - session id
507 \param callbackRoutine - Pointer to set batch scan request callback routine
508 \param calbackContext - callback context
509 \return eHalStatus
510 eHAL_STATUS_FAILURE Cannot set batch scan request
511 eHAL_STATUS_SUCCESS Request accepted.
512 -----------------------------------------------------------------------------*/
513extern eHalStatus pmcSetBatchScanReq(tHalHandle hHal, tSirSetBatchScanReq
514 *pRequest, tANI_U8 sessionId, hddSetBatchScanReqCallback callbackRoutine,
515 void *callbackContext);
516
517/* -----------------------------------------------------------------------------
518 \fn pmcTriggerBatchScanResultInd
519 \brief API to pull batch scan result from FW
520 \param hHal - The handle returned by macOpen.
521 \param sessionId - session id
522 \param callbackRoutine - Pointer to get batch scan request callback routine
523 \param calbackContext - callback context
524 \return eHalStatus
525 eHAL_STATUS_FAILURE Cannot set batch scan request
526 eHAL_STATUS_SUCCESS Request accepted.
527 -----------------------------------------------------------------------------*/
528extern eHalStatus pmcTriggerBatchScanResultInd
529(
530 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
531 hddTriggerBatchScanResultIndCallback callbackRoutine, void *callbackContext
532);
533
534
535/* -----------------------------------------------------------------------------
536 \fn pmcStopBatchScanInd
537 \brief Stoping batch scan request in FW
538 \param hHal - The handle returned by macOpen.
539 \param pInd - Pointer to stop batch scan indication
540 \return eHalStatus
541 eHAL_STATUS_FAILURE Cannot set batch scan request
542 eHAL_STATUS_SUCCESS Request accepted.
543 -----------------------------------------------------------------------------*/
544
545extern eHalStatus pmcStopBatchScanInd
546(
547 tHalHandle hHal,
548 tSirStopBatchScanInd *pInd,
549 tANI_U8 sessionId
550);
551
552#endif // FEATURE_WLAN_BATCH_SCAN
553
554
Jeff Johnson295189b2012-06-20 16:38:30 -0700555#endif
556