blob: 50df3446338d906f604226da8397fe7c93a4e3d7 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/******************************************************************************
23
24*
25
26* Name: pmcApi.h
27
28*
29
30* Description: Power Management Control (PMC) API definitions.
31
32* Copyright 2008 (c) Qualcomm, Incorporated.
33
34* All Rights Reserved.
35
36* Qualcomm Confidential and Proprietary.
37
38*
39
40******************************************************************************/
41
42
43#ifndef __PMC_API_H__
44
45#define __PMC_API_H__
46
47//This timer value determines the default periodicity at which BMPS retries will happen
48//This default value is overwritten typicaly by OS specific registry/INI values.
49#define BMPS_TRAFFIC_TIMER_DEFAULT 5000 //unit = ms
50#define DHCP_REMAIN_POWER_ACTIVE_THRESHOLD 12 // (12 * 5) sec = 60 seconds = 1 min
51
52//This timer value is used when starting the timer right after association. This value
53//should be large enough to allow the auth, DHCP handshake to complete
54#define BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP 8000 //unit = ms
55
56#define PMC_IS_CHIP_ACCESSIBLE(pmcState) ( (IMPS != (pmcState)) && (REQUEST_IMPS != (pmcState)) && \
57 (STANDBY != (pmcState)) && (REQUEST_STANDBY != (pmcState)) )
58
59
60
61/* Power events that are signaled to PMC. */
62
63typedef enum ePmcPowerEvent
64
65{
66
67 ePMC_SYSTEM_HIBERNATE, /* host is entering hibernation */
68
69 ePMC_SYSTEM_RESUME, /* host is resuming after hibernation */
70
71 ePMC_HW_WLAN_SWITCH_OFF, /* Hardware WLAN Switch has been turned off */
72
73 ePMC_HW_WLAN_SWITCH_ON, /* Hardware WLAN Switch has been turned on */
74
75 ePMC_SW_WLAN_SWITCH_OFF, /* Software WLAN Switch has been turned off */
76
77 ePMC_SW_WLAN_SWITCH_ON, /* Software WLAN Switch has been turned on */
78
79 ePMC_BATTERY_OPERATION, /* host is now operating on battery power */
80
81 ePMC_AC_OPERATION /* host is now operating on AC power */
82
83} tPmcPowerEvent;
84
85
86
87
88/* Power saving modes. */
89
90typedef enum ePmcPowerSavingMode
91
92{
93
94 ePMC_IDLE_MODE_POWER_SAVE, /* Idle Mode Power Save (IMPS) */
95
96 ePMC_BEACON_MODE_POWER_SAVE, /* Beacon Mode Power Save (BMPS) */
97
98 ePMC_SPATIAL_MULTIPLEX_POWER_SAVE, /* Spatial Multiplexing Power Save (SMPS) */
99
100 ePMC_UAPSD_MODE_POWER_SAVE, /* Unscheduled Automatic Power Save Delivery Mode */
101
102 ePMC_STANDBY_MODE_POWER_SAVE, /* Standby Power Save Mode */
103
104 ePMC_WOWL_MODE_POWER_SAVE /* Wake-on-Wireless LAN Power Save Mode */
105
106} tPmcPowerSavingMode;
107
108
109
110
111/* Switch states. */
112
113typedef enum ePmcSwitchState
114
115{
116
117 ePMC_SWITCH_OFF, /* switch off */
118
119 ePMC_SWITCH_ON /* switch on */
120
121} tPmcSwitchState;
122
123
124
125
126/* Device power states. */
127
128typedef enum ePmcPowerState
129
130{
131
132 ePMC_FULL_POWER, /* full power */
133
134 ePMC_LOW_POWER, /* low power */
135
136} tPmcPowerState;
137
138
139
140/* PMC states. */
141
142typedef enum ePmcState
143
144{
145
146 STOPPED, /* PMC is stopped */
147
148 FULL_POWER, /* full power */
149
150 LOW_POWER, /* low power */
151
152 REQUEST_IMPS, /* requesting IMPS */
153
154 IMPS, /* in IMPS */
155
156 REQUEST_BMPS, /* requesting BMPS */
157
158 BMPS, /* in BMPS */
159
160 REQUEST_FULL_POWER, /* requesting full power */
161
162 REQUEST_START_UAPSD, /* requesting Start UAPSD */
163
164 REQUEST_STOP_UAPSD, /* requesting Stop UAPSD */
165
166 UAPSD, /* in UAPSD */
167
168 REQUEST_STANDBY, /* requesting standby mode */
169
170 STANDBY, /* in standby mode */
171
172 REQUEST_ENTER_WOWL, /* requesting enter WOWL */
173
174 REQUEST_EXIT_WOWL, /* requesting exit WOWL */
175
176 WOWL /* Chip in WOWL mode */
177
178} tPmcState;
179
180
181/* 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
214
215
216
217/* Configuration parameters for Idle Mode Power Save (IMPS). */
218
219typedef struct sPmcImpsConfigParams
220
221{
222
223 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter IMPS only when host operating
224
225 on battery power, TRUE if device should enter always */
226
227} tPmcImpsConfigParams, *tpPmcImpsConfigParams;
228
229
230
231
232/* Configuration parameters for Beacon Mode Power Save (BMPS). */
233
234typedef struct sPmcBmpsConfigParams
235
236{
237
238 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter BMPS only when host operating on
239
240 battery power, TRUE if device should enter always */
241
242 tANI_U32 txThreshold; /* transmit rate under which BMPS should be entered (frames / traffic measurement period) */
243
244 tANI_U32 rxThreshold; /* receive rate under which BMPS should be entered (frames / traffic measurement period) */
245
246 tANI_U32 trafficMeasurePeriod; /* period for BMPS traffic measurement (milliseconds) */
247
248 tANI_U32 bmpsPeriod; /* amount of time in low power (beacon intervals) */
249
250 tPmcBeaconsToForward forwardBeacons; /* which beacons should be forwarded to the host */
251
252 tANI_U32 valueOfN; /* the value of N when forwardBeacons is set to ePMC_NTH_BEACON */
253
254 tANI_BOOLEAN usePsPoll; /* TRUE if PS-POLL should be used to retrieve frames from AP, FALSE if a
255
256 null data frame with the PM bit reset should be used */
257
258 tANI_BOOLEAN setPmOnLastFrame; /* TRUE to keep device in BMPS as much as possible, FALSE otherwise, TRUE means:
259
260 1) PM bit should be set on last pending transmit data frame
261
262 2) null frame with PM bit set should be transmitted after last pending receive
263
264 frame has been processed */
265
266 tANI_BOOLEAN enableBeaconEarlyTermination; /* if TRUE, BET feature in RIVA
267 will be enabled, FALSE otherwise, TRUE means:
268 RXP will read the beacon header for the
269 TIM bit & discard the rest if set to 0,
270 while in BMPS */
271 tANI_U8 bcnEarlyTermWakeInterval; /* This specifies how often in terms
272 of LI we will disable BET in order to sync
273 up TSF*/
274
275} tPmcBmpsConfigParams, *tpPmcBmpsConfigParams;
276
277
278
279
280/* Configuration parameters for Spatial Mulitplexing Power Save (SMPS). */
281
282typedef struct sPmcSmpsConfigParams
283
284{
285
286 tPmcSmpsMode mode; /* mode to use */
287
288 tANI_BOOLEAN enterOnAc; /* FALSE if device should enter SMPS only when host operating on
289
290 battery power, TRUE if device should enter always */
291
292} tPmcSmpsConfigParams, *tpPmcSmpsConfigParams;
293
294
295/* Routine definitions. */
296
297extern eHalStatus pmcOpen (tHalHandle hHal);
298
299extern eHalStatus pmcStart (tHalHandle hHal);
300
301extern eHalStatus pmcStop (tHalHandle hHal);
302
303extern eHalStatus pmcClose (tHalHandle hHal );
304
305extern eHalStatus pmcSignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event);
306
307extern eHalStatus pmcSetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
308
309extern eHalStatus pmcGetConfigPowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode, void *pConfigParams);
310
311extern eHalStatus pmcEnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
312
313extern eHalStatus pmcStartAutoBmpsTimer (tHalHandle hHal);
314
315extern eHalStatus pmcStopAutoBmpsTimer (tHalHandle hHal);
316
317extern eHalStatus pmcDisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode);
318
319extern eHalStatus pmcQueryPowerState (tHalHandle hHal, tPmcPowerState *pPowerState, tPmcSwitchState *pHwWlanSwitchState,
320
321 tPmcSwitchState *pSwWlanSwitchState);
322
323extern tANI_BOOLEAN pmcIsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode);
324
325extern eHalStatus pmcRequestFullPower (tHalHandle hHal, void (*callbackRoutine) (void *callbackContext, eHalStatus status),
326
327 void *callbackContext, tRequestFullPowerReason fullPowerReason);
328
329extern eHalStatus pmcRequestImps (tHalHandle hHal, tANI_U32 impsPeriod,
330
331 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
332
333 void *callbackContext);
334
335extern eHalStatus pmcRegisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext),
336
337 void *checkContext);
338
339extern eHalStatus pmcDeregisterPowerSaveCheck (tHalHandle hHal, tANI_BOOLEAN (*checkRoutine) (void *checkContext));
340
341extern void pmcMessageProcessor (tHalHandle hHal, tSirSmeRsp *pMsg);
342
343
344extern eHalStatus pmcRequestBmps (
345
346 tHalHandle hHal,
347
348 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
349
350 void *callbackContext);
351
352
353extern eHalStatus pmcStartUapsd (
354
355 tHalHandle hHal,
356
357 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
358
359 void *callbackContext);
360
361
362extern eHalStatus pmcStopUapsd (tHalHandle hHal);
363
364
365extern eHalStatus pmcRequestStandby (
366
367 tHalHandle hHal,
368
369 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
370
371 void *callbackContext);
372
373
374extern eHalStatus pmcRegisterDeviceStateUpdateInd (tHalHandle hHal,
375
376 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
377
378 void *callbackContext);
379
380
381extern eHalStatus pmcDeregisterDeviceStateUpdateInd (tHalHandle hHal,
382
383 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState));
384
385
386extern eHalStatus pmcReady(tHalHandle hHal);
387
388
389void pmcDumpInit(tHalHandle hHal);
390
391
392extern eHalStatus pmcWowlAddBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700394 tpSirWowlAddBcastPtrn pattern,
395 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700396
397
398extern eHalStatus pmcWowlDelBcastPattern (
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700400 tpSirWowlDelBcastPtrn pattern,
401 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700402
403
404extern eHalStatus pmcEnterWowl (
405
406 tHalHandle hHal,
407
408 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
409
410 void *enterWowlCallbackContext,
411#ifdef WLAN_WAKEUP_EVENTS
412 void (*wakeReasonIndCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
413
414 void *wakeReasonIndCBContext,
415#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700416 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700417
418extern eHalStatus pmcExitWowl (tHalHandle hHal);
419
420
Jeff Johnsone7245742012-09-05 17:12:55 -0700421extern eHalStatus pmcSetHostOffload (tHalHandle hHal, tpSirHostOffloadReq pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700422 tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
424/* ---------------------------------------------------------------------------
425 \fn pmcSetKeepAlive
426 \brief Set the Keep Alive feature.
427 \param hHal - The handle returned by macOpen.
428 \param pRequest - Pointer to the Keep Alive.
429 \return eHalStatus
430 eHAL_STATUS_FAILURE Cannot set the keepalive.
431 eHAL_STATUS_SUCCESS Request accepted.
432 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700433extern eHalStatus pmcSetKeepAlive (tHalHandle hHal, tpSirKeepAliveReq pRequest, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700434
435extern tANI_BOOLEAN pmcValidateConnectState( tHalHandle hHal );
436
437extern tANI_BOOLEAN pmcAllowImps( tHalHandle hHal );
438
439
440#ifdef FEATURE_WLAN_SCAN_PNO
441/*Pref netw found Cb declaration*/
442typedef void(*preferredNetworkFoundIndCallback)(void *callbackContext, tpSirPrefNetworkFoundInd pPrefNetworkFoundInd);
443
444extern eHalStatus pmcSetPreferredNetworkList(tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, preferredNetworkFoundIndCallback callbackRoutine, void *callbackContext);
445extern eHalStatus pmcSetRssiFilter(tHalHandle hHal, v_U8_t rssiThreshold);
446#endif // FEATURE_WLAN_SCAN_PNO
447
448#ifdef WLAN_FEATURE_PACKET_FILTERING
449// Packet Coalescing Filter Match Count Callback declaration
450typedef void(*FilterMatchCountCallback)(void *callbackContext,
451 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700452extern eHalStatus pmcGetFilterMatchCount(tHalHandle hHal, FilterMatchCountCallback callbackRoutine,
453 void *callbackContext, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700454#endif // WLAN_FEATURE_PACKET_FILTERING
455
456#ifdef WLAN_FEATURE_GTK_OFFLOAD
457// GTK Offload Information Callback declaration
458typedef void(*GTKOffloadGetInfoCallback)(void *callbackContext, tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp);
459
460/* ---------------------------------------------------------------------------
461 \fn pmcSetGTKOffload
462 \brief Set GTK offload feature.
463 \param hHal - The handle returned by macOpen.
464 \param pGtkOffload - Pointer to the GTK offload request.
465 \return eHalStatus
466 eHAL_STATUS_FAILURE Cannot set the offload.
467 eHAL_STATUS_SUCCESS Request accepted.
468 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -0700469extern eHalStatus pmcSetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pGtkOffload, tANI_U8 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
471/* ---------------------------------------------------------------------------
472 \fn pmcGetGTKOffload
473 \brief Get GTK offload information.
474 \param hHal - The handle returned by macOpen.
475 \param callbackRoutine - Pointer to the GTK Offload Get Info response callback routine.
476 \return eHalStatus
477 eHAL_STATUS_FAILURE Cannot set the offload.
478 eHAL_STATUS_SUCCESS Request accepted.
479 ---------------------------------------------------------------------------*/
480extern eHalStatus pmcGetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine, void *callbackContext);
481#endif // WLAN_FEATURE_GTK_OFFLOAD
482
483#endif
484