blob: 32fb41f1529c581e08877fd61548467907f21c4f [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Padma, Santhosh Kumarc88de482018-04-09 16:17:04 +05302 * Copyright (c) 2012, 2014-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080019#ifndef __WLAN_HDD_POWER_H
20#define __WLAN_HDD_POWER_H
21
22/**
23 * DOC: wlan_hdd_power.h
24 *
25 * HDD Power Management API
26 */
27
28#include "wlan_hdd_main.h"
29
Dustin Brownceed67e2017-05-26 11:57:31 -070030#define HDD_WAKELOCK_TIMEOUT_CONNECT 1000
31#define HDD_WAKELOCK_TIMEOUT_RESUME 1000
Qiwei Cai4505fc62018-05-17 18:35:19 +080032
Padma, Santhosh Kumarc88de482018-04-09 16:17:04 +053033/*
34 * HDD_WAKELOCK_CONNECT_COMPLETE = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT (3000) +
35 * WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT_STADEF (1000) +
36 * WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT_STADEF (2000)
37 */
38#define HDD_WAKELOCK_CONNECT_COMPLETE 6000
Dustin Brownceed67e2017-05-26 11:57:31 -070039
Qiwei Cai4505fc62018-05-17 18:35:19 +080040#ifdef WLAN_FEATURE_PACKET_FILTERING
41
42#define HDD_MAX_CMP_PER_PACKET_FILTER 5
43
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080044/**
45 * enum pkt_filter_protocol_layer - packet filter protocol layer
46 * @HDD_FILTER_PROTO_TYPE_INVALID: Invalid initial value
47 * @HDD_FILTER_PROTO_TYPE_MAC: MAC protocol
48 * @HDD_FILTER_PROTO_TYPE_ARP: ARP protocol
49 * @HDD_FILTER_PROTO_TYPE_IPV4: IP V4 protocol
50 * @HDD_FILTER_PROTO_TYPE_IPV6: IP V6 protocol
51 * @HDD_FILTER_PROTO_TYPE_UDP: UDP protocol
52 * @HDD_FILTER_PROTO_TYPE_INVALID: Max place holder value
53 */
54enum pkt_filter_protocol_layer {
55 HDD_FILTER_PROTO_TYPE_INVALID = 0,
56 HDD_FILTER_PROTO_TYPE_MAC = 1,
57 HDD_FILTER_PROTO_TYPE_ARP = 2,
58 HDD_FILTER_PROTO_TYPE_IPV4 = 3,
59 HDD_FILTER_PROTO_TYPE_IPV6 = 4,
60 HDD_FILTER_PROTO_TYPE_UDP = 5,
61 HDD_FILTER_PROTO_TYPE_MAX
62};
63
64/**
65 * enum pkt_filter_action - packet filter action
66 * @HDD_RCV_FILTER_INVALID: Invalid initial value
67 * @HDD_RCV_FILTER_SET: Packet filter set
68 * @HDD_RCV_FILTER_CLEAR: Packet filter clear
69 * @HDD_RCV_FILTER_MAX: Max place holder value
70 */
71enum pkt_filter_action {
72 HDD_RCV_FILTER_INVALID = 0,
73 HDD_RCV_FILTER_SET = 1,
74 HDD_RCV_FILTER_CLEAR = 2,
75 HDD_RCV_FILTER_MAX
76};
77
78/**
79 * enum pkt_filter_compare_flag - packet filter compare flag
80 * @HDD_FILTER_CMP_TYPE_INVALID: Invalid initial value
81 * @HDD_FILTER_CMP_TYPE_EQUAL: Compare if filter is equal
82 * @HDD_FILTER_CMP_TYPE_MASK_EQUAL: Compare if filter mask is equal
83 * @HDD_FILTER_CMP_TYPE_NOT_EQUAL: Compare if filter is not equal
84 * @HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL: Compare if filter mask is not equal
85 * @HDD_FILTER_CMP_TYPE_MAX: Max place holder value
86 */
87enum pkt_filter_compare_flag {
88 HDD_FILTER_CMP_TYPE_INVALID = 0,
89 HDD_FILTER_CMP_TYPE_EQUAL = 1,
90 HDD_FILTER_CMP_TYPE_MASK_EQUAL = 2,
91 HDD_FILTER_CMP_TYPE_NOT_EQUAL = 3,
92 HDD_FILTER_CMP_TYPE_MASK_NOT_EQUAL = 4,
93 HDD_FILTER_CMP_TYPE_MAX
94};
95
96/**
97 * struct pkt_filter_param_cfg - packet filter parameter config
98 * @protocol_layer: Protocol layer
99 * @compare_flag: Compare flag
100 * @data_fffset: Data offset
101 * @data_length: Data length
102 * @compare_data: Compare data
103 * @data_mask: Data mask
104 */
105struct pkt_filter_param_cfg {
106 uint8_t protocol_layer;
107 uint8_t compare_flag;
108 uint8_t data_offset;
109 uint8_t data_length;
110 uint8_t compare_data[SIR_MAX_FILTER_TEST_DATA_LEN];
111 uint8_t data_mask[SIR_MAX_FILTER_TEST_DATA_LEN];
112};
113
114/**
115 * struct pkt_filter_cfg - packet filter config received from user space
116 * @filter_action: Filter action
117 * @filter_id: Filter id
118 * @num_params: Number of parameters
119 * @params_data: Packet filter parameters detail
120 */
121struct pkt_filter_cfg {
122 uint8_t filter_action;
123 uint8_t filter_id;
124 uint8_t num_params;
125 struct pkt_filter_param_cfg params_data[HDD_MAX_CMP_PER_PACKET_FILTER];
126};
127
128#endif
129
Abhishek Singhbaea27d2016-04-27 13:29:30 +0530130/**
131 * enum suspend_resume_state - Suspend resume state
132 * @HDD_WLAN_EARLY_SUSPEND: Early suspend state.
133 * @HDD_WLAN_SUSPEND: Suspend state.
134 * @HDD_WLAN_EARLY_RESUME: Early resume state.
135 * @HDD_WLAN_RESUME: Resume state.
136 *
137 * Suspend state to indicate in diag event of suspend resume.
138 */
139enum suspend_resume_state {
140 HDD_WLAN_EARLY_SUSPEND,
141 HDD_WLAN_SUSPEND,
142 HDD_WLAN_EARLY_RESUME,
143 HDD_WLAN_RESUME
144};
145
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700146/**
147 * hdd_svc_fw_shutdown_ind() - API to send FW SHUTDOWN IND to Userspace
148 * @dev: Device Pointer
149 *
150 * Return: None
151 */
152void hdd_svc_fw_shutdown_ind(struct device *dev);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700154/**
155 * hdd_wlan_shutdown() - HDD SSR shutdown function
156 *
157 * This function is called by the HIF to shutdown the driver during SSR.
158 *
159 * Return: QDF_STATUS_SUCCESS if the driver was shut down,
160 * or an error status otherwise
161 */
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530162QDF_STATUS hdd_wlan_shutdown(void);
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700163
164/**
165 * hdd_wlan_re_init() - HDD SSR re-init function
166 *
167 * This function is called by the HIF to re-initialize the driver after SSR.
168 *
169 * Return: QDF_STATUS_SUCCESS if the driver was re-initialized,
170 * or an error status otherwise
171 */
Arun Khandavallifae92942016-08-01 13:31:08 +0530172QDF_STATUS hdd_wlan_re_init(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530174/**
175 * hdd_enable_arp_offload() - API to enable ARP offload
176 * @adapter: Adapter context for which ARP offload is to be configured
177 * @trigger: trigger reason for request
178 *
179 * Return: None
180 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700181void hdd_enable_arp_offload(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700182 enum pmo_offload_trigger trigger);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800183
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530184/**
185 * hdd_disable_arp_offload() - API to disable ARP offload
186 * @adapter: Adapter context for which ARP offload is to be configured
187 * @trigger: trigger reason for request
188 *
189 * Return: None
190 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700191void hdd_disable_arp_offload(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700192 enum pmo_offload_trigger trigger);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530193
194/**
195 * hdd_enable_host_offloads() - Central API to enable the supported offloads
196 * @adapter: pointer to the adapter
197 * @trigger: trigger reason for request
198 *
199 * Central function to enable the supported offloads
200 *
201 * Return: nothing
202 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700203void hdd_enable_host_offloads(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700204 enum pmo_offload_trigger trigger);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530205
206/**
207 * hdd_disable_host_offloads() - Central API to disable the supported offloads
208 * @adapter: pointer to the adapter
209 * @trigger: trigger reason for request
210 *
211 * Central function to disable the supported offloads
212 *
213 * Return: nothing
214 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700215void hdd_disable_host_offloads(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700216 enum pmo_offload_trigger trigger);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530217
218/**
Mukul Sharmaff2ac2e2017-01-16 15:51:29 +0530219 * hdd_enable_mc_addr_filtering() - enable MC address list in FW
220 * @adapter: adapter whose MC list is being set
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530221 * @trigger: trigger reason for request
222 *
223 * Return: nothing
224 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700225void hdd_enable_mc_addr_filtering(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700226 enum pmo_offload_trigger trigger);
Mukul Sharmaff2ac2e2017-01-16 15:51:29 +0530227
228/**
229 * hdd_disable_mc_addr_filtering() - disable MC address list in FW
230 * @adapter: adapter whose MC list is being set
231 * @trigger: trigger reason for request
232 *
233 * Return: nothing
234 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700235void hdd_disable_mc_addr_filtering(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700236 enum pmo_offload_trigger trigger);
Mukul Sharmaff2ac2e2017-01-16 15:51:29 +0530237
238/**
239 * hdd_cache_mc_addr_list() - API to cache MC address list
240 * @mc_list_config: set of mc address list configurations
241 *
242 * Return: 0 on success else error code
243 */
244int hdd_cache_mc_addr_list(struct pmo_mc_addr_list_params *mc_list_config);
245
246/**
247 * hdd_disable_and_flush_mc_addr_list() - API to Disable & Flush cached MC list
248 * @adapter: adapter whose MC list is being set
249 * @trigger: trigger reason for request
250 *
251 * Return: nothing
252 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700253void hdd_disable_and_flush_mc_addr_list(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700254 enum pmo_offload_trigger trigger);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800255
Mukul Sharma3d36c392017-01-18 18:39:12 +0530256/**
Ashish Kumar Dhanotiyacf11bae2017-04-04 03:29:47 +0530257 * wlan_hdd_cfg80211_update_replay_counter_cb() - replay counter callback
Mukul Sharma3d36c392017-01-18 18:39:12 +0530258 * @cb_ctx: Callback context as void* as PMO do not about HDD adapter type
259 * @gtk_rsp_param: Pointer to gtk offload response parameter
260 *
261 * Callback routine called upon receiving of gtk offload rsp from fwr
262 *
263 * Return: none
264 */
Ashish Kumar Dhanotiyacf11bae2017-04-04 03:29:47 +0530265void wlan_hdd_cfg80211_update_replay_counter_cb(
Mukul Sharma3d36c392017-01-18 18:39:12 +0530266 void *cb_ctx,
267 struct pmo_gtk_rsp_params *gtk_rsp_param);
268
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700269/**
270 * wlan_hdd_cfg80211_suspend_wlan() - cfg80211 suspend callback
271 * @wiphy: Pointer to wiphy
272 * @wow: Pointer to wow
273 *
274 * This API is called when cfg80211 driver suspends
275 *
276 * Return: integer status
277 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800278int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
279 struct cfg80211_wowlan *wow);
280
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700281/**
282 * wlan_hdd_cfg80211_resume_wlan() - cfg80211 resume callback
283 * @wiphy: Pointer to wiphy
284 *
285 * This API is called when cfg80211 driver resumes driver updates
286 * latest sched_scan scan result(if any) to cfg80211 database
287 *
288 * Return: integer status
289 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800290int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy);
291
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700292/**
293 * hdd_ipv4_notifier_work_queue() - IP V4 change notifier work handler
294 * @work: Pointer to work context
295 *
296 * Return: none
297 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800298void hdd_ipv4_notifier_work_queue(struct work_struct *work);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530299
Qiwei Cai1083f5b2018-07-02 19:10:11 +0800300#ifdef WLAN_NS_OFFLOAD
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530301/**
302 * hdd_enable_ns_offload() - enable NS offload
303 * @adapter: pointer to the adapter
304 *
305 * Return: nothing
306 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700307void hdd_enable_ns_offload(struct hdd_adapter *adapter,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700308 enum pmo_offload_trigger trigger);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530309
310/**
311 * hdd_disable_ns_offload() - disable NS offload
312 * @adapter: pointer to the adapter
313 *
314 * Return: nothing
315 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700316void hdd_disable_ns_offload(struct hdd_adapter *adapter,
Qiwei Cai1083f5b2018-07-02 19:10:11 +0800317 enum pmo_offload_trigger trigger);
318#else /* WLAN_NS_OFFLOAD */
319static inline
320void hdd_enable_ns_offload(struct hdd_adapter *adapter,
321 enum pmo_offload_trigger trigger)
322{
323}
324
325static inline
326void hdd_disable_ns_offload(struct hdd_adapter *adapter,
327 enum pmo_offload_trigger trigger)
328{
329}
330#endif /* WLAN_NS_OFFLOAD */
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530331
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700332/**
333 * hdd_ipv6_notifier_work_queue() - IP V6 change notifier work handler
334 * @work: Pointer to work context
335 *
336 * Return: none
337 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800338void hdd_ipv6_notifier_work_queue(struct work_struct *work);
Mukul Sharma3ba26b82017-01-12 21:59:41 +0530339
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700340/**
341 * wlan_hdd_cfg80211_get_txpower() - cfg80211 get power handler function
342 * @wiphy: Pointer to wiphy structure.
343 * @wdev: Pointer to wireless_dev structure.
344 * @dbm: dbm
345 *
346 * This is the cfg80211 get txpower handler function which invokes
347 * the internal function @__wlan_hdd_cfg80211_get_txpower with
348 * SSR protection.
349 *
350 * Return: 0 for success, error number on failure.
351 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800352int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800353 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800354 int *dbm);
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700355
356/**
357 * wlan_hdd_cfg80211_set_txpower() - set TX power
358 * @wiphy: Pointer to wiphy
359 * @wdev: Pointer to network device
360 * @type: TX power setting type
361 * @dbm: TX power in dbm
362 *
363 * Return: 0 for success, non-zero for failure
364 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800365int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800366 struct wireless_dev *wdev,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800367 enum nl80211_tx_power_setting type,
368 int dbm);
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700369
370/**
371 * wlan_hdd_cfg80211_set_power_mgmt() - set cfg80211 power management config
372 * @wiphy: Pointer to wiphy
373 * @dev: Pointer to network device
374 * @allow_power_save: is wlan allowed to go into power save mode
375 * @timeout: Timeout value
376 *
377 * Return: 0 for success, non-zero for failure
378 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800379int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy,
Dustin Brownf660fb42016-09-09 12:04:00 -0700380 struct net_device *dev,
381 bool allow_power_save,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800382 int timeout);
383
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700384/**
385 * wlan_hdd_ipv4_changed() - IPv4 change notifier callback
386 * @nb: pointer to notifier block
387 * @data: data
388 * @arg: arg
389 *
390 * This is the IPv4 notifier callback function gets invoked
391 * if any change in IP and then invoke the function @__wlan_hdd_ipv4_changed
392 * to reconfigure the offload parameters.
393 *
394 * Return: 0 on success, error number otherwise.
395 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800396int wlan_hdd_ipv4_changed(struct notifier_block *nb,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700397 unsigned long data, void *arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800398
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700399/**
400 * wlan_hdd_ipv6_changed() - IPv6 change notifier callback
401 * @nb: pointer to notifier block
402 * @data: data
403 * @arg: arg
404 *
405 * This is the IPv6 notifier callback function gets invoked
406 * if any change in IP and then invoke the function @__wlan_hdd_ipv6_changed
407 * to reconfigure the offload parameters.
408 *
409 * Return: 0 on success, error number otherwise.
410 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800411int wlan_hdd_ipv6_changed(struct notifier_block *nb,
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700412 unsigned long data, void *arg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800413
Jeff Johnson4fbee2f2017-10-03 11:19:35 -0700414/**
415 * hdd_set_qpower_config() - set qpower config to firmware
416 * @hddctx: HDD context
417 * @adapter: HDD adapter
418 * @qpower: new qpower config value
419 *
420 * Return: 0 on success; Errno on failure
421 */
422int hdd_set_qpower_config(struct hdd_context *hddctx,
423 struct hdd_adapter *adapter,
Kapil Gupta6213c012016-09-02 19:39:09 +0530424 uint8_t qpower);
425
Abhishek Singhbaea27d2016-04-27 13:29:30 +0530426#ifdef FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700427/**
428 * hdd_wlan_suspend_resume_event()- send suspend/resume state
429 * @state: suspend/resume state
430 *
431 * This Function sends suspend resume state diag event
432 *
433 * Return: void.
434 */
Abhishek Singhbaea27d2016-04-27 13:29:30 +0530435void hdd_wlan_suspend_resume_event(uint8_t state);
Jeff Johnson7b3c98f2018-07-08 20:52:37 -0700436
Abhishek Singhbaea27d2016-04-27 13:29:30 +0530437#else
438static inline
439void hdd_wlan_suspend_resume_event(uint8_t state) {}
440#endif /* FEATURE_WLAN_DIAG_SUPPORT */
441
Dustin Brown105d7902016-10-03 16:27:59 -0700442/**
Zhu Jianmin04392c42017-05-12 16:34:53 +0800443 * wlan_hdd_set_powersave() - Set powersave mode
444 * @adapter: adapter upon which the request was received
445 * @allow_power_save: is wlan allowed to go into power save mode
446 * @timeout: timeout period in ms
447 *
448 * Return: 0 on success, non-zero on any error
449 */
Jeff Johnson75b737d2017-08-29 14:24:41 -0700450int wlan_hdd_set_powersave(struct hdd_adapter *adapter,
Zhu Jianmin04392c42017-05-12 16:34:53 +0800451 bool allow_power_save, uint32_t timeout);
452
453/**
Dustin Brown105d7902016-10-03 16:27:59 -0700454 * wlan_hdd_inc_suspend_stats() - Prints, then increments, then prints suspend
455 * failed statistics.
456 * @hdd_ctx: The HDD context to operate on
457 * @reason: The suspend failed reason to increment
458 *
459 * This function prints all of the suspend failed statistics, increments the
460 * specified suspend fail reason statistic, and prints the them all again. This
461 * is for easily keeping track of the most common reasons suspend fails.
462 *
463 * Return: none
464 */
Jeff Johnsoncfb65a82017-08-28 11:45:41 -0700465void wlan_hdd_inc_suspend_stats(struct hdd_context *hdd_ctx,
Dustin Brown105d7902016-10-03 16:27:59 -0700466 enum suspend_fail_reason reason);
Abhishek Singhbaea27d2016-04-27 13:29:30 +0530467
Rajeev Kumar9bb2e852016-09-24 12:29:25 -0700468/*
469 * Unit-test suspend/resume is a testing feature that allows putting firmware
470 * into WoW suspend irrespective of Apps suspend status. It emulates the chain
471 * of events that occur durring normal system-level suspend/resume, such as
472 * initiating all of the suspend/resume stages in the correct order, and
473 * enabling/disabling appropriate copy engine irqs.
474 */
475#ifdef WLAN_SUSPEND_RESUME_TEST
Dustin Brownd53d1a82016-10-03 12:57:33 -0700476/**
Dustin Browne70fd972016-11-10 11:17:40 -0800477 * wlan_hdd_unit_test_bus_suspend() - suspend the wlan bus
Dustin Brown54096432017-02-23 13:00:44 -0800478 * @wow_params: collection of wow enable override parameters
Dustin Browne70fd972016-11-10 11:17:40 -0800479 *
480 * This function does the same as wlan_hdd_bus_suspend, but additionally passes
481 * the appropriate flags to FW, indicating this is a unit-test suspend and it
482 * should use an HTC wakeup method to resume.
483 *
484 * Return: 0 for success or error code
485 */
Dustin Brown9ef609b2017-03-15 12:19:37 -0700486int wlan_hdd_unit_test_bus_suspend(struct wow_enable_params wow_params);
Dustin Browne70fd972016-11-10 11:17:40 -0800487
488/**
Dustin Brownd53d1a82016-10-03 12:57:33 -0700489 * hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend
Dustin Brownbc81a472016-10-26 16:56:59 -0700490 * @wiphy: the kernel wiphy struct for the device being resumed
491 * @dev: the kernel net_device struct for the device being resumed
Dustin Brownd53d1a82016-10-03 12:57:33 -0700492 *
493 * Return: Zero on success, calls QDF_BUG() on failure
494 */
Dustin Brownbc81a472016-10-26 16:56:59 -0700495int hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev);
Dustin Brownd53d1a82016-10-03 12:57:33 -0700496
497/**
498 * hdd_wlan_fake_apps_suspend() - Initiate a unit-test triggered suspend
Dustin Brownbc81a472016-10-26 16:56:59 -0700499 * @wiphy: the kernel wiphy struct for the device being suspended
500 * @dev: the kernel net_device struct for the device being suspended
Dustin Brown54096432017-02-23 13:00:44 -0800501 * @pause_setting: interface pause override setting
502 * @resume_setting: resume trigger override setting
Dustin Brownd53d1a82016-10-03 12:57:33 -0700503 *
504 * Return: Zero on success, suspend related non-zero error code on failure
505 */
Dustin Brown54096432017-02-23 13:00:44 -0800506int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
507 enum wow_interface_pause pause_setting,
508 enum wow_resume_trigger resume_setting);
Rajeev Kumar9bb2e852016-09-24 12:29:25 -0700509#else
Dustin Brownbc81a472016-10-26 16:56:59 -0700510static inline int
511hdd_wlan_fake_apps_resume(struct wiphy *wiphy, struct net_device *dev)
Rajeev Kumar9bb2e852016-09-24 12:29:25 -0700512{
513 return 0;
514}
515
Dustin Brownbc81a472016-10-26 16:56:59 -0700516static inline int
Dustin Brown54096432017-02-23 13:00:44 -0800517hdd_wlan_fake_apps_suspend(struct wiphy *wiphy, struct net_device *dev,
518 enum wow_interface_pause pause_setting,
519 enum wow_resume_trigger resume_setting)
Rajeev Kumar9bb2e852016-09-24 12:29:25 -0700520{
521 return 0;
522}
523#endif /* WLAN_SUSPEND_RESUME_TEST */
524
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800525#endif /* __WLAN_HDD_POWER_H */