xref: /wlan-driver/qcacld-3.0/components/pmo/core/inc/wlan_pmo_suspend_resume.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2018, 2020-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * DOC: Declare suspend / resume related API's
21  */
22 
23 #ifndef _WLAN_PMO_SUSPEND_RESUME_H_
24 #define _WLAN_PMO_SUSPEND_RESUME_H_
25 
26 #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD
27 
28 #include "wlan_pmo_common_public_struct.h"
29 #include "wlan_pmo_wow.h"
30 
31 /**
32  * pmo_core_configure_dynamic_wake_events(): configure dynamic wake events
33  * @psoc: objmgr psoc handle
34  *
35  * Some wake events need to be enabled dynamically. Control those here.
36  *
37  * Return: none
38  */
39 void pmo_core_configure_dynamic_wake_events(struct wlan_objmgr_psoc *psoc);
40 
41 /**
42  * pmo_core_get_wow_bus_suspend(): API to get wow bus is suspended or not
43  * @psoc: objmgr psoc handle
44  *
45  * Return: True if bus suspende else false
46  */
pmo_core_get_wow_bus_suspend(struct wlan_objmgr_psoc * psoc)47 static inline bool pmo_core_get_wow_bus_suspend(struct wlan_objmgr_psoc *psoc)
48 {
49 	bool value = false;
50 	struct pmo_psoc_priv_obj *psoc_ctx;
51 
52 	pmo_psoc_with_ctx(psoc, psoc_ctx) {
53 		value = psoc_ctx->wow.is_wow_bus_suspended;
54 	}
55 
56 	return value;
57 }
58 
59 /**
60  * pmo_core_psoc_user_space_suspend_req() -  Core handle user space suspend req
61  * @psoc: objmgr psoc handle
62  * @type: type of suspend
63  *
64  * Pmo core Handles user space suspend request for psoc
65  *
66  * Return: QDF status
67  */
68 QDF_STATUS pmo_core_psoc_user_space_suspend_req(struct wlan_objmgr_psoc *psoc,
69 		enum qdf_suspend_type type);
70 
71 /**
72  * pmo_core_psoc_user_space_resume_req() - Core handle user space resume req
73  * @psoc: objmgr psoc handle
74  * @type: type of suspend from resume required
75  *
76  * Pmo core Handles user space resume request for psoc
77  *
78  * Return: QDF status
79  */
80 QDF_STATUS pmo_core_psoc_user_space_resume_req(struct wlan_objmgr_psoc *psoc,
81 		enum qdf_suspend_type type);
82 
83 /**
84  * pmo_core_psoc_bus_suspend_req(): handles bus suspend for psoc
85  * @psoc: objmgr psoc
86  * @type: is this suspend part of runtime suspend or system suspend?
87  * @wow_params: collection of wow enable override parameters
88  *
89  * Bails if a scan is in progress.
90  * Calls the appropriate handlers based on configuration and event.
91  *
92  * Return: QDF_STATUS_SUCCESS for success or error code
93  */
94 QDF_STATUS pmo_core_psoc_bus_suspend_req(struct wlan_objmgr_psoc *psoc,
95 		enum qdf_suspend_type type,
96 		struct pmo_wow_enable_params *wow_params);
97 
98 #ifdef FEATURE_RUNTIME_PM
99 /**
100  * pmo_core_psoc_bus_runtime_suspend(): handles bus runtime suspend
101  * @psoc: objmgr psoc
102  * @pld_cb: callback to do link auto suspend
103  *
104  * Suspend the wlan bus without apps suspend.
105  *
106  * Return: QDF_STATUS_SUCCESS for success or error code
107  */
108 QDF_STATUS pmo_core_psoc_bus_runtime_suspend(struct wlan_objmgr_psoc *psoc,
109 					     pmo_pld_auto_suspend_cb pld_cb);
110 
111 /**
112  * pmo_core_psoc_bus_runtime_resume(): handles bus runtime resume
113  * @psoc: objmgr psoc
114  * @pld_cb: callback to do link auto resume
115  *
116  * Resume the wlan bus from runtime suspend.
117  *
118  * Return: QDF_STATUS_SUCCESS for success or error code
119  */
120 QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc,
121 					     pmo_pld_auto_resume_cb pld_cb);
122 #endif
123 
124 /**
125  * pmo_core_psoc_suspend_target() -Send suspend target command
126  * @psoc: objmgr psoc handle
127  * @disable_target_intr: disable target interrupt
128  *
129  * Return: QDF_STATUS_SUCCESS for success or error code
130  */
131 QDF_STATUS pmo_core_psoc_suspend_target(struct wlan_objmgr_psoc *psoc,
132 		int disable_target_intr);
133 
134 /**
135  * pmo_core_psoc_bus_resume_req() - handle bus resume request for psoc
136  * @psoc: objmgr psoc handle
137  * @type: is this suspend part of runtime suspend or system suspend?
138  *
139  * Return:QDF_STATUS_SUCCESS on success else error code
140  */
141 QDF_STATUS pmo_core_psoc_bus_resume_req(struct wlan_objmgr_psoc *psoc,
142 		enum qdf_suspend_type type);
143 
144 /**
145  * pmo_core_vdev_set_restore_dtim() - vdev dtim restore setting value
146  * @vdev: objmgr vdev handle
147  * @value: dtim restore policy value
148  *
149  * Return: None
150  */
151 static inline
pmo_core_vdev_set_restore_dtim(struct wlan_objmgr_vdev * vdev,bool value)152 void pmo_core_vdev_set_restore_dtim(struct wlan_objmgr_vdev *vdev,
153 				    bool value)
154 {
155 	struct pmo_vdev_priv_obj *vdev_ctx;
156 
157 	vdev_ctx = pmo_vdev_get_priv(vdev);
158 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
159 	vdev_ctx->restore_dtim_setting = value;
160 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
161 }
162 
163 /**
164  * pmo_core_vdev_get_restore_dtim() - Get vdev restore dtim setting
165  * @vdev: objmgr vdev handle
166  *
167  * Return: dtim restore policy
168  */
169 static inline
pmo_core_vdev_get_restore_dtim(struct wlan_objmgr_vdev * vdev)170 bool pmo_core_vdev_get_restore_dtim(struct wlan_objmgr_vdev *vdev)
171 {
172 	bool value;
173 	struct pmo_vdev_priv_obj *vdev_ctx;
174 
175 	vdev_ctx = pmo_vdev_get_priv(vdev);
176 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
177 	value = vdev_ctx->restore_dtim_setting;
178 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
179 
180 	return value;
181 }
182 
183 #ifdef FEATURE_WLAN_DYNAMIC_ARP_NS_OFFLOAD
184 /**
185  * pmo_core_dynamic_arp_ns_offload_enable() - Enable vdev arp/ns offload
186  * @vdev: objmgr vdev handle
187  *
188  * Return: QDF_STATUS_E_ALREADY if arp/ns offload already enable
189  */
190 static inline QDF_STATUS
pmo_core_dynamic_arp_ns_offload_enable(struct wlan_objmgr_vdev * vdev)191 pmo_core_dynamic_arp_ns_offload_enable(struct wlan_objmgr_vdev *vdev)
192 {
193 	bool value;
194 	QDF_STATUS status = QDF_STATUS_SUCCESS;
195 	struct pmo_vdev_priv_obj *vdev_ctx;
196 
197 	vdev_ctx = pmo_vdev_get_priv(vdev);
198 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
199 	value = vdev_ctx->dyn_arp_ns_offload_disable;
200 	if (!value)
201 		status = QDF_STATUS_E_ALREADY;
202 	else
203 		vdev_ctx->dyn_arp_ns_offload_disable = false;
204 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
205 
206 	return status;
207 }
208 
209 /**
210  * pmo_core_dynamic_arp_ns_offload_disable() - Disable vdev arp/ns offload
211  * @vdev: objmgr vdev handle
212  *
213  * Return: QDF_STATUS_E_ALREADY if arp/ns offload already disable
214  */
215 static inline QDF_STATUS
pmo_core_dynamic_arp_ns_offload_disable(struct wlan_objmgr_vdev * vdev)216 pmo_core_dynamic_arp_ns_offload_disable(struct wlan_objmgr_vdev *vdev)
217 {
218 	bool value;
219 	QDF_STATUS status = QDF_STATUS_SUCCESS;
220 	struct pmo_vdev_priv_obj *vdev_ctx;
221 
222 	vdev_ctx = pmo_vdev_get_priv(vdev);
223 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
224 	value = vdev_ctx->dyn_arp_ns_offload_disable;
225 	if (value)
226 		status = QDF_STATUS_E_ALREADY;
227 	else
228 		vdev_ctx->dyn_arp_ns_offload_disable = true;
229 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
230 
231 	return status;
232 }
233 
234 /**
235  * pmo_core_get_dynamic_arp_ns_offload_disable() - Get arp/ns offload state
236  * @vdev: objmgr vdev handle
237  *
238  * Return: true if vdev arp/ns offload is disable
239  */
240 static inline bool
pmo_core_get_dynamic_arp_ns_offload_disable(struct wlan_objmgr_vdev * vdev)241 pmo_core_get_dynamic_arp_ns_offload_disable(struct wlan_objmgr_vdev *vdev)
242 {
243 	bool value;
244 	struct pmo_vdev_priv_obj *vdev_ctx;
245 
246 	vdev_ctx = pmo_vdev_get_priv(vdev);
247 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
248 	value = vdev_ctx->dyn_arp_ns_offload_disable;
249 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
250 
251 	return value;
252 }
253 
254 /**
255  * pmo_core_dynamic_arp_ns_offload_runtime_prevent() - Prevent runtime suspend
256  * @vdev: objmgr vdev handle
257  *
258  * API to prevent runtime suspend happen when arp/ns offload is disable
259  *
260  * Return: None
261  */
262 static inline void
pmo_core_dynamic_arp_ns_offload_runtime_prevent(struct wlan_objmgr_vdev * vdev)263 pmo_core_dynamic_arp_ns_offload_runtime_prevent(struct wlan_objmgr_vdev *vdev)
264 {
265 	struct pmo_vdev_priv_obj *vdev_ctx;
266 
267 	vdev_ctx = pmo_vdev_get_priv(vdev);
268 	qdf_runtime_pm_prevent_suspend(&vdev_ctx->dyn_arp_ns_offload_rt_lock);
269 }
270 
271 /**
272  * pmo_core_dynamic_arp_ns_offload_runtime_allow() - Allow runtime suspend
273  * @vdev: objmgr vdev handle
274  *
275  * API to allow runtime suspend happen when arp/ns offload is enable
276  *
277  * Return: None
278  */
279 static inline void
pmo_core_dynamic_arp_ns_offload_runtime_allow(struct wlan_objmgr_vdev * vdev)280 pmo_core_dynamic_arp_ns_offload_runtime_allow(struct wlan_objmgr_vdev *vdev)
281 {
282 	struct pmo_vdev_priv_obj *vdev_ctx;
283 
284 	vdev_ctx = pmo_vdev_get_priv(vdev);
285 	qdf_runtime_pm_allow_suspend(&vdev_ctx->dyn_arp_ns_offload_rt_lock);
286 }
287 #endif
288 
289 /**
290  * pmo_core_psoc_update_power_save_mode() - update power save mode
291  * @psoc: objmgr psoc handle
292  * @value:describe vdev power save mode
293  *
294  * Return: None
295  */
296 static inline void
pmo_core_psoc_update_power_save_mode(struct wlan_objmgr_psoc * psoc,uint8_t value)297 pmo_core_psoc_update_power_save_mode(struct wlan_objmgr_psoc *psoc,
298 				     uint8_t value)
299 {
300 	struct pmo_psoc_priv_obj *psoc_ctx;
301 
302 	pmo_psoc_with_ctx(psoc, psoc_ctx) {
303 		psoc_ctx->psoc_cfg.power_save_mode = value;
304 	}
305 }
306 
307 /**
308  * pmo_core_psoc_get_power_save_mode() - Get psoc power save mode
309  * @psoc: objmgr psoc handle
310  *
311  * Return: vdev psoc power save mode value
312  */
313 static inline uint8_t
pmo_core_psoc_get_power_save_mode(struct wlan_objmgr_psoc * psoc)314 pmo_core_psoc_get_power_save_mode(struct wlan_objmgr_psoc *psoc)
315 {
316 	uint8_t value = 0;
317 	struct pmo_psoc_priv_obj *psoc_ctx;
318 
319 	pmo_psoc_with_ctx(psoc, psoc_ctx) {
320 		value = psoc_ctx->psoc_cfg.power_save_mode;
321 	}
322 
323 	return value;
324 }
325 
326 /**
327  * pmo_core_vdev_get_pause_bitmap() - Get vdev pause bitmap
328  * @psoc_ctx: psoc priv ctx
329  * @vdev_id: vdev id
330  *
331  * Return: vdev pause bitmap
332  */
333 static inline
pmo_core_vdev_get_pause_bitmap(struct pmo_psoc_priv_obj * psoc_ctx,uint8_t vdev_id)334 uint16_t pmo_core_vdev_get_pause_bitmap(struct pmo_psoc_priv_obj *psoc_ctx,
335 		uint8_t vdev_id)
336 {
337 	uint16_t value = 0;
338 	pmo_get_pause_bitmap handler;
339 
340 	qdf_spin_lock_bh(&psoc_ctx->lock);
341 	handler = psoc_ctx->get_pause_bitmap;
342 	qdf_spin_unlock_bh(&psoc_ctx->lock);
343 
344 	if (handler)
345 		value = handler(vdev_id);
346 
347 	return value;
348 }
349 
350 /**
351  * pmo_is_vdev_in_ap_mode() - check that vdev is in ap mode or not
352  * @vdev: objmgr vdev handle
353  *
354  * Helper function to know whether given vdev is in AP mode or not.
355  *
356  * Return: True/False
357  */
358 static inline
pmo_is_vdev_in_ap_mode(struct wlan_objmgr_vdev * vdev)359 bool pmo_is_vdev_in_ap_mode(struct wlan_objmgr_vdev *vdev)
360 {
361 	enum QDF_OPMODE mode;
362 
363 	mode = pmo_get_vdev_opmode(vdev);
364 
365 	return (mode == QDF_SAP_MODE || mode == QDF_P2P_GO_MODE) == 1 ? 1 : 0;
366 }
367 
368 /**
369  * pmo_core_psoc_handle_initial_wake_up() - handle initial wake up
370  * @cb_ctx: callback context
371  *
372  * Return: None
373  */
374 void pmo_core_psoc_handle_initial_wake_up(void *cb_ctx);
375 
376 /**
377  * pmo_core_psoc_is_target_wake_up_received() - check for initial wake up
378  * @psoc: objmgr psoc handle
379  *
380  * Check if target initial wake up is received and fail PM suspend gracefully
381  *
382  * Return: -EAGAIN if initial wake up is received else 0
383  */
384 int pmo_core_psoc_is_target_wake_up_received(struct wlan_objmgr_psoc *psoc);
385 
386 /**
387  * pmo_core_psoc_clear_target_wake_up() - clear initial wake up
388  * @psoc: objmgr psoc handle
389  *
390  * Clear target initial wake up reason
391  *
392  * Return: 0 for success and negative error code for failure
393  */
394 int pmo_core_psoc_clear_target_wake_up(struct wlan_objmgr_psoc *psoc);
395 
396 /**
397  * pmo_core_psoc_target_suspend_acknowledge() - update target susspend status
398  * @context: HTC_INIT_INFO->context
399  * @wow_nack: true when wow is rejected
400  * @reason_code : WoW status reason code
401  *
402  * Return: none
403  */
404 void pmo_core_psoc_target_suspend_acknowledge(void *context, bool wow_nack,
405 					      uint16_t reason_code);
406 
407 /**
408  * pmo_core_psoc_wakeup_host_event_received() - received host wake up event
409  * @psoc: objmgr psoc handle
410  *
411  * Return: None
412  */
413 void pmo_core_psoc_wakeup_host_event_received(struct wlan_objmgr_psoc *psoc);
414 
415 /**
416  * pmo_core_config_listen_interval() - function to dynamically configure
417  * listen interval
418  * @vdev: objmgr vdev
419  * @listen_interval: new listen interval passed by user
420  *
421  * This function allows user to configure listen interval dynamically
422  *
423  * Return: QDF_STATUS
424  */
425 QDF_STATUS pmo_core_config_listen_interval(struct wlan_objmgr_vdev *vdev,
426 					   uint32_t listen_interval);
427 
428 /**
429  * pmo_core_config_modulated_dtim() - function to configure modulated dtim
430  * @vdev: objmgr vdev handle
431  * @mod_dtim: New modulated dtim value passed by user
432  *
433  * This function configures the modulated dtim in firmware
434  *
435  * Return: QDF_STATUS
436  */
437 QDF_STATUS pmo_core_config_modulated_dtim(struct wlan_objmgr_vdev *vdev,
438 					  uint32_t mod_dtim);
439 
440 /**
441  * pmo_core_txrx_suspend() - suspends TXRX
442  * @psoc: objmgr psoc handle
443  *
444  * This function disables the EXT grp irqs and drains the TX/RX pipes;
445  * this essentially suspends the TXRX activity
446  *
447  * Return: QDF_STATUS
448  */
449 QDF_STATUS pmo_core_txrx_suspend(struct wlan_objmgr_psoc *psoc);
450 
451 /**
452  * pmo_core_txrx_resume() - resumes TXRX
453  * @psoc: objmgr psoc handle
454  *
455  * This function enables the EXT grp irqs, which inturn resumes
456  * the TXRX activity
457  *
458  * Return: QDF_STATUS
459  */
460 QDF_STATUS pmo_core_txrx_resume(struct wlan_objmgr_psoc *psoc);
461 
462 /**
463  * pmo_core_config_forced_dtim() - function to configure forced dtim
464  * @vdev: objmgr vdev handle
465  * @dynamic_dtim: dynamic dtim value passed by user
466  *
467  * This function configures the forced modulated dtim in firmware
468  *
469  * Return: QDF_STATUS
470  */
471 QDF_STATUS pmo_core_config_forced_dtim(struct wlan_objmgr_vdev *vdev,
472 				       uint32_t dynamic_dtim);
473 
474 #ifdef SYSTEM_PM_CHECK
475 /**
476  * pmo_core_system_resume() - function to handle system resume notification
477  * @psoc: objmgr psoc handle
478  *
479  * Return: None
480  */
481 void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc);
482 #else
pmo_core_system_resume(struct wlan_objmgr_psoc * psoc)483 static inline void pmo_core_system_resume(struct wlan_objmgr_psoc *psoc)
484 {}
485 #endif
486 #ifdef WLAN_FEATURE_IGMP_OFFLOAD
487 /**
488  * pmo_core_enable_igmp_offload() - function to offload igmp
489  * @vdev: objmgr vdev handle
490  * @pmo_igmp_req: igmp req
491  *
492  * This function to offload igmp to fw
493  *
494  * Return: QDF_STATUS
495  */
496 QDF_STATUS
497 pmo_core_enable_igmp_offload(struct wlan_objmgr_vdev *vdev,
498 			     struct pmo_igmp_offload_req *pmo_igmp_req);
499 #else
500 static inline QDF_STATUS
pmo_core_enable_igmp_offload(struct wlan_objmgr_vdev * vdev,struct pmo_igmp_offload_req * pmo_igmp_req)501 pmo_core_enable_igmp_offload(struct wlan_objmgr_vdev *vdev,
502 			     struct pmo_igmp_offload_req *pmo_igmp_req)
503 {
504 	return QDF_STATUS_SUCCESS;
505 }
506 #endif
507 
508 /**
509  * pmo_core_vdev_get_moddtim_user_enabled() - Get vdev if mod dtim set
510  * by user
511  * @vdev: objmgr vdev handle
512  *
513  * Return: mod dtim set by user or not
514  */
515 static inline
pmo_core_vdev_get_moddtim_user_enabled(struct wlan_objmgr_vdev * vdev)516 bool pmo_core_vdev_get_moddtim_user_enabled(struct wlan_objmgr_vdev *vdev)
517 {
518 	bool value;
519 	struct pmo_vdev_priv_obj *vdev_ctx;
520 
521 	vdev_ctx = pmo_vdev_get_priv(vdev);
522 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
523 	value = vdev_ctx->dyn_modulated_dtim_enabled;
524 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
525 
526 	return value;
527 }
528 
529 /**
530  * pmo_core_vdev_set_moddtim_user_enabled() - vdev moddtim user enable setting
531  * @vdev: objmgr vdev handle
532  * @value: vdev moddtim user enable or not
533  *
534  * Return: None
535  */
536 static inline
pmo_core_vdev_set_moddtim_user_enabled(struct wlan_objmgr_vdev * vdev,bool value)537 void pmo_core_vdev_set_moddtim_user_enabled(struct wlan_objmgr_vdev *vdev,
538 					    bool value)
539 {
540 	struct pmo_vdev_priv_obj *vdev_ctx;
541 
542 	vdev_ctx = pmo_vdev_get_priv(vdev);
543 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
544 	vdev_ctx->dyn_modulated_dtim_enabled = value;
545 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
546 }
547 
548 /**
549  * pmo_core_vdev_get_moddtim_user_active() - Get vdev if moddtim user is
550  * sent to fw
551  * @vdev: objmgr vdev handle
552  *
553  * Return: moddtim user is sent to fw or not
554  */
555 static inline
pmo_core_vdev_get_moddtim_user_active(struct wlan_objmgr_vdev * vdev)556 bool pmo_core_vdev_get_moddtim_user_active(struct wlan_objmgr_vdev *vdev)
557 {
558 	bool retval;
559 	struct pmo_vdev_priv_obj *vdev_ctx;
560 
561 	vdev_ctx = pmo_vdev_get_priv(vdev);
562 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
563 	retval = vdev_ctx->is_dyn_modulated_dtim_activated;
564 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
565 
566 	return retval;
567 }
568 
569 /**
570  * pmo_core_vdev_set_moddtim_user_active() - vdev moddtim user active setting
571  * @vdev: objmgr vdev handle
572  * @value: vdev moddtim user active or not
573  *
574  * Return: None
575  */
576 static inline
pmo_core_vdev_set_moddtim_user_active(struct wlan_objmgr_vdev * vdev,bool value)577 void pmo_core_vdev_set_moddtim_user_active(struct wlan_objmgr_vdev *vdev,
578 					   bool value)
579 {
580 	struct pmo_vdev_priv_obj *vdev_ctx;
581 
582 	vdev_ctx = pmo_vdev_get_priv(vdev);
583 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
584 	vdev_ctx->is_dyn_modulated_dtim_activated = value;
585 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
586 }
587 
588 /**
589  * pmo_core_vdev_get_moddtim_user() - Get vdev moddtim set by user
590  * @vdev: objmgr vdev handle
591  *
592  * Return: moddtim value set by user
593  */
594 static inline
pmo_core_vdev_get_moddtim_user(struct wlan_objmgr_vdev * vdev)595 uint32_t pmo_core_vdev_get_moddtim_user(struct wlan_objmgr_vdev *vdev)
596 {
597 	uint32_t value;
598 	struct pmo_vdev_priv_obj *vdev_ctx;
599 
600 	vdev_ctx = pmo_vdev_get_priv(vdev);
601 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
602 	value = vdev_ctx->dyn_modulated_dtim;
603 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
604 
605 	return value;
606 }
607 
608 /**
609  * pmo_core_vdev_set_moddtim_user() - vdev moddtim user value setting
610  * @vdev: objmgr vdev handle
611  * @value: vdev moddtim value set by user
612  *
613  * Return: None
614  */
615 static inline
pmo_core_vdev_set_moddtim_user(struct wlan_objmgr_vdev * vdev,uint32_t value)616 void pmo_core_vdev_set_moddtim_user(struct wlan_objmgr_vdev *vdev,
617 				    uint32_t value)
618 {
619 	struct pmo_vdev_priv_obj *vdev_ctx;
620 
621 	vdev_ctx = pmo_vdev_get_priv(vdev);
622 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
623 	vdev_ctx->dyn_modulated_dtim = value;
624 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
625 }
626 #endif /* WLAN_POWER_MANAGEMENT_OFFLOAD */
627 
628 #endif /* end  of _WLAN_PMO_SUSPEND_RESUME_H_ */
629