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_UTILS_API_H_ 21 #define _WLAN_SPECTRAL_UTILS_API_H_ 22 23 #include <wlan_objmgr_cmn.h> 24 #include <wlan_lmac_if_def.h> 25 26 /* Forward declaration */ 27 struct direct_buf_rx_data; 28 struct wmi_spectral_cmd_ops; 29 30 /** 31 * wlan_spectral_is_feature_disabled() - Check if spectral feature is disabled 32 * @psoc - the physical device object. 33 * 34 * Return : true if spectral is disabled, else false. 35 */ 36 bool wlan_spectral_is_feature_disabled(struct wlan_objmgr_psoc *psoc); 37 38 /** 39 * wlan_spectral_init() - API to init spectral component 40 * 41 * This API is invoked from dispatcher init during all component init. 42 * This API will register all required handlers for pdev and peer object 43 * create/delete notification. 44 * 45 * Return: SUCCESS, 46 * Failure 47 */ 48 QDF_STATUS wlan_spectral_init(void); 49 50 /** 51 * wlan_spectral_deinit() - API to deinit spectral component 52 * 53 * This API is invoked from dispatcher deinit during all component deinit. 54 * This API will unregister all registered handlers for pdev and peer object 55 * create/delete notification. 56 * 57 * Return: SUCCESS, 58 * Failure 59 */ 60 QDF_STATUS wlan_spectral_deinit(void); 61 62 /** 63 * wlan_lmac_if_sptrl_register_rx_ops() - Register lmac interface Rx operations 64 * @rx_ops: Pointer to lmac interface Rx operations structure 65 * 66 * API to register spectral related lmac interface Rx operations 67 * 68 * Return: None 69 */ 70 void 71 wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops); 72 73 /** 74 * wlan_register_wmi_spectral_cmd_ops() - Register operations related to wmi 75 * commands on spectral parameters 76 * @pdev - the physical device object 77 * @cmd_ops - pointer to the structure holding the operations 78 * related to wmi commands on spectral parameters 79 * 80 * API to register operations related to wmi commands on spectral parameters 81 * 82 * Return: None 83 */ 84 void 85 wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev, 86 struct wmi_spectral_cmd_ops *cmd_ops); 87 88 /** 89 * struct spectral_legacy_cbacks - Spectral legacy callbacks 90 * @vdev_get_chan_freq: Get channel frequency 91 * @vdev_get_chan_freq_seg2: Get secondary 80 center frequency 92 * @vdev_get_ch_width: Get channel width 93 * @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency 94 */ 95 struct spectral_legacy_cbacks { 96 int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev); 97 int16_t (*vdev_get_chan_freq_seg2)(struct wlan_objmgr_vdev *vdev); 98 enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev); 99 int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev, 100 uint16_t *sec20chan_freq); 101 }; 102 103 /** 104 * spectral_vdev_get_chan_freq - Get vdev channel frequency 105 * @vdev: vdev object 106 * 107 * Return: vdev operating frequency 108 */ 109 int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev); 110 111 /** 112 * spectral_vdev_get_chan_freq_seg2 - Get vdev's secondary 80 center frequency 113 * @vdev: vdev object 114 * 115 * Return: vdev secondary 80 center frequency 116 */ 117 int16_t spectral_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev); 118 119 /** 120 * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequency 121 * @vdev: vdev object 122 * @sec20chan_freq: secondary channel frequency 123 * 124 * Return: secondary channel freq 125 */ 126 int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev, 127 uint16_t *sec20chan_freq); 128 129 /** 130 * spectral_register_legacy_cb() - Register spectral legacy callbacks 131 * commands on spectral parameters 132 * @psoc - the physical device object 133 * @legacy_cbacks - Reference to struct spectral_legacy_cbacks from which 134 * function pointers need to be copied 135 * 136 * API to register spectral related legacy callbacks 137 * 138 * Return: QDF_STATUS_SUCCESS upon successful registration, 139 * QDF_STATUS_E_FAILURE upon failure 140 */ 141 QDF_STATUS spectral_register_legacy_cb( 142 struct wlan_objmgr_psoc *psoc, 143 struct spectral_legacy_cbacks *legacy_cbacks); 144 145 /** 146 * spectral_vdev_get_ch_width() - Get the channel bandwidth 147 * @vdev - Pointer to vdev 148 * 149 * API to get the channel bandwidth of a given vdev 150 * 151 * Return: Enumeration corresponding to the channel bandwidth 152 */ 153 enum phy_ch_width 154 spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev); 155 156 /** 157 * spectral_pdev_open() - Spectral pdev open handler 158 * @pdev: pointer to pdev object 159 * 160 * API to execute operations on pdev open 161 * 162 * Return: QDF_STATUS_SUCCESS upon successful registration, 163 * QDF_STATUS_E_FAILURE upon failure 164 */ 165 QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev); 166 167 /** 168 * spectral_register_dbr() - register Spectral event handler with DDMA 169 * @pdev: pointer to pdev object 170 * 171 * API to register event handler with Direct DMA 172 * 173 * Return: QDF_STATUS_SUCCESS upon successful registration, 174 * QDF_STATUS_E_FAILURE upon failure 175 */ 176 177 QDF_STATUS spectral_register_dbr(struct wlan_objmgr_pdev *pdev); 178 179 /** 180 * spectral_unregister_dbr() - unregister Spectral event handler with DDMA 181 * @pdev: pointer to pdev object 182 * 183 * API to unregister event handler with Direct DMA 184 * 185 * Return: QDF_STATUS_SUCCESS upon successful unregistration, 186 * QDF_STATUS_E_FAILURE upon failure 187 */ 188 QDF_STATUS spectral_unregister_dbr(struct wlan_objmgr_pdev *pdev); 189 190 #ifdef DIRECT_BUF_RX_ENABLE 191 /** 192 * spectral_dbr_event_handler() - Spectral dbr event handler 193 * @pdev: pointer to pdev object 194 * @payload: dbr event buffer 195 * 196 * API to handle spectral dbr event 197 * 198 * Return: true to release buf 199 */ 200 bool spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev, 201 struct direct_buf_rx_data *payload); 202 #endif 203 #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/ 204