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