1 /* 2 * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 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 /** 21 * DOC: Contains green ap north bound interface definitions 22 */ 23 24 #ifndef _WLAN_GREEN_AP_API_H_ 25 #define _WLAN_GREEN_AP_API_H_ 26 27 #include <wlan_objmgr_cmn.h> 28 #include <wlan_objmgr_pdev_obj.h> 29 #include <qdf_status.h> 30 #include "../../../global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h" 31 32 /* Green ap mode of operation */ 33 #define WLAN_GREEN_AP_MODE_NO_STA 1 /* PS if no sta connected */ 34 #define WLAN_GREEN_AP_MODE_NUM_STREAM 2 /* PS if 1x1 clients only connected */ 35 36 /** 37 * struct wlan_green_ap_egap_params - enhance green ap params 38 * @fw_egap_support: fw enhance green ap support 39 * @host_enable_egap: HOST enhance green ap support 40 * @egap_inactivity_time: inactivity time 41 * @egap_wait_time: wait time 42 * @egap_feature_flags: feature flags 43 */ 44 struct wlan_green_ap_egap_params { 45 bool fw_egap_support; 46 bool host_enable_egap; 47 uint32_t egap_inactivity_time; 48 uint32_t egap_wait_time; 49 uint32_t egap_feature_flags; 50 }; 51 52 /** 53 * struct wlan_green_ap_egap_status_info - enhance green ap params 54 * @status: egap status 55 * @mac_id: mac id 56 * @tx_chainmask: tx chainmask 57 * @rx_chainmask: rx chainmask 58 */ 59 struct wlan_green_ap_egap_status_info { 60 uint32_t status; 61 uint32_t mac_id; 62 uint32_t tx_chainmask; 63 uint32_t rx_chainmask; 64 }; 65 66 #ifdef WLAN_SUPPORT_GAP_LL_PS_MODE 67 /** 68 * struct green_ap_hdd_callback: Green AP HDD callback structure 69 * @send_event: function to send the event parameter to userspace via hdd 70 */ 71 72 struct green_ap_hdd_callback { 73 QDF_STATUS (*send_event)(struct wlan_objmgr_vdev *vdev, 74 struct wlan_green_ap_ll_ps_event_param *ll_event_param); 75 76 }; 77 #endif 78 79 /** 80 * wlan_green_ap_init() - initialize green ap component 81 * 82 * Return: Success or Failure 83 */ 84 QDF_STATUS wlan_green_ap_init(void); 85 86 /** 87 * wlan_green_ap_deinit() - De-initialize green ap component 88 * 89 * Return: Success or Failure 90 */ 91 QDF_STATUS wlan_green_ap_deinit(void); 92 93 /** 94 * wlan_green_ap_start() - Start green ap 95 * @pdev: pdev pointer 96 * 97 * Call this function when the first SAP comes up 98 * 99 * Return: Success or Failure 100 */ 101 QDF_STATUS wlan_green_ap_start(struct wlan_objmgr_pdev *pdev); 102 103 /** 104 * wlan_green_ap_stop() - Stop green ap 105 * @pdev: pdev pointer 106 * 107 * Call this function when the last SAP goes down 108 * 109 * Return: Success or Failure 110 */ 111 QDF_STATUS wlan_green_ap_stop(struct wlan_objmgr_pdev *pdev); 112 113 /** 114 * wlan_green_ap_pdev_open() - open component and update config params 115 * @pdev: pdev pointer 116 * 117 * Return: Success or Failure 118 */ 119 QDF_STATUS wlan_green_ap_pdev_open(struct wlan_objmgr_pdev *pdev); 120 121 /** 122 * wlan_green_ap_add_sta() - On association 123 * @pdev: pdev pointer 124 * 125 * Call this function when new node is associated 126 * 127 * Return: Success or Failure 128 */ 129 QDF_STATUS wlan_green_ap_add_sta(struct wlan_objmgr_pdev *pdev); 130 131 /** 132 * wlan_green_ap_add_multistream_sta() - On association 133 * @pdev: pdev pointer 134 * 135 * Call this function when new multistream node is associated 136 * 137 * Return: Success or Failure 138 */ 139 QDF_STATUS wlan_green_ap_add_multistream_sta(struct wlan_objmgr_pdev *pdev); 140 141 /** 142 * wlan_green_ap_del_sta() - On disassociation 143 * @pdev: pdev pointer 144 * 145 * Call this function when new node is disassociated 146 * 147 * Return: Success or Failure 148 */ 149 QDF_STATUS wlan_green_ap_del_sta(struct wlan_objmgr_pdev *pdev); 150 151 /** 152 * wlan_green_ap_del_multistream_sta() - On disassociation 153 * @pdev: pdev pointer 154 * 155 * Call this function when new multistream node is disassociated 156 * 157 * Return: Success or Failure 158 */ 159 QDF_STATUS wlan_green_ap_del_multistream_sta(struct wlan_objmgr_pdev *pdev); 160 161 /** 162 * wlan_green_ap_is_ps_enabled() - is power save enabled 163 * @pdev: pdev pointer 164 * 165 * Check if power save is enabled in FW 166 * 167 * Return: Success or Failure 168 */ 169 bool wlan_green_ap_is_ps_enabled(struct wlan_objmgr_pdev *pdev); 170 171 /** 172 * wlan_green_ap_suspend_handle() - handle driver suspend 173 * @pdev: pdev pointer 174 * 175 * Return: None 176 */ 177 void wlan_green_ap_suspend_handle(struct wlan_objmgr_pdev *pdev); 178 179 /** 180 * wlan_green_ap_get_capab() - get lmac capability 181 * @pdev: pdev pointer 182 * 183 * Return: Appropriate status 184 */ 185 QDF_STATUS wlan_green_ap_get_capab(struct wlan_objmgr_pdev *pdev); 186 187 /** 188 * wlan_green_ap_is_ps_waiting() - is power save in wait state 189 * @pdev: pdev pointer 190 * 191 * Check if power save is in wait state 192 * 193 * Return: Success or Failure 194 */ 195 bool wlan_green_ap_is_ps_waiting(struct wlan_objmgr_pdev *pdev); 196 #endif /* _WLAN_GREEN_AP_API_H_ */ 197