1 /* 2 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. 3 * 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 #ifndef _WLAN_SPECTRAL_TGT_API_H_ 21 #define _WLAN_SPECTRAL_TGT_API_H_ 22 23 #include <wlan_objmgr_cmn.h> 24 #include <qdf_types.h> 25 #include "../../core/spectral_cmn_api_i.h" 26 27 /** 28 * tgt_get_target_handle() - Get target_if handle 29 * @pdev: Pointer to pdev 30 * 31 * Get handle to target_if internal Spectral data 32 * 33 * Return: Handle to target_if internal Spectral data on success, NULL on 34 * failure 35 */ 36 void *tgt_get_target_handle(struct wlan_objmgr_pdev *pdev); 37 38 /** 39 * tgt_spectral_control()- handler for demultiplexing requests from higher layer 40 * @pdev: reference to global pdev object 41 * @id: spectral config command id 42 * @indata: reference to input data 43 * @insize: input data size 44 * @outdata: reference to output data 45 * @outsize: output data size 46 * 47 * This function processes the spectral config command 48 * and appropriate handlers are invoked. 49 * 50 * Return: 0 success else failure 51 */ 52 int tgt_spectral_control(struct wlan_objmgr_pdev *pdev, 53 u_int id, void *indata, u_int32_t insize, 54 void *outdata, u_int32_t *outsize); 55 56 /** 57 * tgt_pdev_spectral_init() - implementation for spectral init 58 * @pdev: Pointer to pdev 59 * 60 * Return: On success, pointer to Spectral target_if internal private data, on 61 * failure, NULL 62 */ 63 void *tgt_pdev_spectral_init(struct wlan_objmgr_pdev *pdev); 64 65 /** 66 * tgt_pdev_spectral_deinit() - implementation for spectral de-init 67 * @pdev: Pointer to pdev 68 * 69 * Return: None 70 */ 71 void tgt_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev); 72 73 /** 74 * tgt_set_spectral_config() - Set spectral config 75 * @pdev: Pointer to pdev object 76 * @threshtype: spectral parameter type 77 * @value: value to be configured for the given spectral parameter 78 * 79 * Implementation for setting spectral config 80 * 81 * Return: 0 on success else failure 82 */ 83 int tgt_set_spectral_config(struct wlan_objmgr_pdev *pdev, 84 const u_int32_t threshtype, 85 const u_int32_t value); 86 87 /** 88 * tgt_get_spectral_config() - Get spectral configuration 89 * @pdev: Pointer to pdev object 90 * @param: Pointer to spectral_config structure in which the configuration 91 * should be returned 92 * 93 * Implementation for getting the current spectral configuration 94 * 95 * Return: None 96 */ 97 void tgt_get_spectral_config(struct wlan_objmgr_pdev *pdev, 98 struct spectral_config *sptrl_config); 99 100 /** 101 * tgt_start_spectral_scan() - Start spectral scan 102 * @pdev: Pointer to pdev object 103 * 104 * Implementation for starting spectral scan 105 * 106 * Return: 0 in case of success, -1 on failure 107 */ 108 int tgt_start_spectral_scan(struct wlan_objmgr_pdev *pdev); 109 110 /** 111 * tgt_stop_spectral_scan() - Stop spectral scan 112 * @pdev: Pointer to pdev object 113 * 114 * Implementation for stop spectral scan 115 * 116 * Return: None 117 */ 118 void tgt_stop_spectral_scan(struct wlan_objmgr_pdev *pdev); 119 120 /** 121 * tgt_is_spectral_active() - Get whether Spectral is active 122 * @pdev: Pointer to pdev object 123 * 124 * Implementation to get whether Spectral is active 125 * 126 * Return: True if Spectral is active, false if Spectral is not active 127 */ 128 bool tgt_is_spectral_active(struct wlan_objmgr_pdev *pdev); 129 130 /** 131 * tgt_is_spectral_enabled() - Get whether Spectral is active 132 * @pdev: Pointer to pdev object 133 * 134 * Implementation to get whether Spectral is active 135 * 136 * Return: True if Spectral is active, false if Spectral is not active 137 */ 138 bool tgt_is_spectral_enabled(struct wlan_objmgr_pdev *pdev); 139 140 /** 141 * tgt_set_debug_level() - Set debug level for Spectral 142 * @pdev: Pointer to pdev object 143 * @debug_level: Debug level 144 * 145 * Implementation to set the debug level for Spectral 146 * 147 * Return: 0 in case of success 148 */ 149 int tgt_set_debug_level(struct wlan_objmgr_pdev *pdev, u_int32_t debug_level); 150 151 /** 152 * tgt_get_debug_level() - Get debug level for Spectral 153 * @pdev: Pointer to pdev object 154 * 155 * Implementation to get the debug level for Spectral 156 * 157 * Return: Current debug level 158 */ 159 uint32_t tgt_get_debug_level(struct wlan_objmgr_pdev *pdev); 160 161 /** 162 * tgt_get_spectral_capinfo() - Get Spectral capability information 163 * @pdev: Pointer to pdev object 164 * @outdata: Buffer into which data should be copied 165 * 166 * Implementation to get the spectral capability information 167 * 168 * Return: void 169 */ 170 void tgt_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev, void *outdata); 171 172 /** 173 * tgt_get_spectral_diagstats() - Get Spectral diagnostic statistics 174 * @pdev: Pointer to pdev object 175 * @outdata: Buffer into which data should be copied 176 * 177 * Implementation to get the spectral diagnostic statistics 178 * 179 * Return: void 180 */ 181 void tgt_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, void *outdata); 182 183 /** 184 * tgt_register_wmi_spectral_cmd_ops() - Register wmi_spectral_cmd_ops 185 * @cmd_ops: Pointer to the structure having wmi_spectral_cmd function pointers 186 * @pdev: Pointer to pdev object 187 * 188 * Implementation to register wmi_spectral_cmd_ops in spectral 189 * internal data structure 190 * 191 * Return: void 192 */ 193 void tgt_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev, 194 struct wmi_spectral_cmd_ops *cmd_ops); 195 196 /** 197 * tgt_spectral_register_nl_cb() - Register Netlink callbacks 198 * @pdev: Pointer to pdev object 199 * @nl_cb: Netlink callbacks to register 200 * 201 * Return: void 202 */ 203 void tgt_spectral_register_nl_cb(struct wlan_objmgr_pdev *pdev, 204 struct spectral_nl_cb *nl_cb); 205 206 /** 207 * tgt_spectral_use_nl_bcast() - Get whether to use broadcast/unicast while 208 * sending Netlink messages to the application layer 209 * @pdev: Pointer to pdev object 210 * 211 * Return: true for broadcast, false for unicast 212 */ 213 bool tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev); 214 215 /** 216 * tgt_spectral_deregister_nl_cb() - De-register Netlink callbacks 217 * @pdev: Pointer to pdev object 218 * 219 * Return: void 220 */ 221 void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev); 222 223 /** 224 * tgt_spectral_process_report() - Process spectral report 225 * @pdev: Pointer to pdev object 226 * @payload: Pointer to spectral report buffer 227 * 228 * Return: status 229 */ 230 int 231 tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev, 232 void *payload); 233 234 /** 235 * tgt_spectral_register_to_dbr() - Register to direct DMA 236 * @pdev: Pointer to pdev object 237 * 238 * Return: QDF_STATUS 239 */ 240 QDF_STATUS 241 tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev); 242 243 /** 244 * tgt_spectral_unregister_to_dbr() - Register to direct DMA 245 * @pdev: Pointer to pdev object 246 * 247 * Return: QDF_STATUS 248 */ 249 QDF_STATUS 250 tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev); 251 252 /** 253 * tgt_spectral_get_target_type() - Get target type 254 * @psoc: Pointer to psoc object 255 * 256 * Return: target type 257 */ 258 uint32_t 259 tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc); 260 #endif /* _WLAN_SPECTRAL_TGT_API_H_ */ 261