1 /* 2 * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. 3 * 4 * 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 19 /** 20 * DOC: target_if_psoc_wake_lock.h 21 * 22 * This file provides declaration for wakelock APIs 23 */ 24 25 #ifndef __TARGET_IF_PSOC_WAKE_LOCK_H__ 26 #define __TARGET_IF_PSOC_WAKE_LOCK_H__ 27 28 #ifdef FEATURE_VDEV_RSP_WAKELOCK 29 /** 30 * struct wlan_vdev_wakelock - vdev wake lock sub structure 31 * @start_wakelock: wakelock for vdev start 32 * @stop_wakelock: wakelock for vdev stop 33 * @delete_wakelock: wakelock for vdev delete 34 * @wmi_cmd_rsp_runtime_lock: run time lock 35 */ 36 struct psoc_mlme_wakelock { 37 qdf_wake_lock_t start_wakelock; 38 qdf_wake_lock_t stop_wakelock; 39 qdf_wake_lock_t delete_wakelock; 40 qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock; 41 }; 42 #endif 43 44 enum wakelock_mode { 45 START_WAKELOCK, 46 STOP_WAKELOCK, 47 DELETE_WAKELOCK 48 }; 49 50 #ifdef FEATURE_VDEV_RSP_WAKELOCK 51 52 /** 53 * target_if_wake_lock_init() - API to initialize 54 wakelocks:start, 55 stop and delete. 56 * @psoc: pointer to psoc 57 * 58 * This also initialize the runtime lock 59 * 60 * Return: None 61 */ 62 void target_if_wake_lock_init(struct wlan_objmgr_psoc *psoc); 63 64 /** 65 * target_if_wake_lock_deinit() - API to destroy 66 wakelocks:start, stop and delete. 67 * @psoc: pointer to psoc 68 * 69 * This also destroy the runtime lock 70 * 71 * Return: None 72 */ 73 void target_if_wake_lock_deinit(struct wlan_objmgr_psoc *psoc); 74 75 /** 76 * target_if_start_wake_lock_timeout_acquire() - acquire the 77 vdev start wakelock 78 * @psoc: pointer to psoc 79 * 80 * This also acquires the target_if runtime pm lock. 81 * 82 * Return: Success/Failure 83 */ 84 QDF_STATUS target_if_wake_lock_timeout_acquire(struct wlan_objmgr_psoc *psoc, 85 enum wakelock_mode mode); 86 /** 87 * target_if_start_wake_lock_timeout_release() - release the 88 start wakelock 89 * @psoc: pointer to psoc 90 * 91 * This also release the target_if runtime pm lock. 92 * 93 * Return: Success/Failure 94 */ 95 QDF_STATUS target_if_wake_lock_timeout_release(struct wlan_objmgr_psoc *psoc, 96 enum wakelock_mode mode); 97 #else 98 static inline void target_if_wake_lock_init(struct wlan_objmgr_psoc *psoc) 99 { 100 } 101 102 static inline void target_if_wake_lock_deinit(struct wlan_objmgr_psoc *psoc) 103 { 104 } 105 106 static inline QDF_STATUS target_if_wake_lock_timeout_acquire( 107 struct wlan_objmgr_psoc *psoc, 108 enum wakelock_mode mode) 109 { 110 return QDF_STATUS_SUCCESS; 111 } 112 113 static inline QDF_STATUS target_if_wake_lock_timeout_release( 114 struct wlan_objmgr_psoc *psoc, 115 enum wakelock_mode mode) 116 { 117 return QDF_STATUS_SUCCESS; 118 } 119 #endif 120 #endif 121