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