1 /* 2 * Copyright (c) 2017-2018 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 29 /** 30 * wlan_spectral_init() - API to init spectral component 31 * 32 * This API is invoked from dispatcher init during all component init. 33 * This API will register all required handlers for pdev and peer object 34 * create/delete notification. 35 * 36 * Return: SUCCESS, 37 * Failure 38 */ 39 QDF_STATUS wlan_spectral_init(void); 40 41 /** 42 * wlan_spectral_deinit() - API to deinit spectral component 43 * 44 * This API is invoked from dispatcher deinit during all component deinit. 45 * This API will unregister all registered handlers for pdev and peer object 46 * create/delete notification. 47 * 48 * Return: SUCCESS, 49 * Failure 50 */ 51 QDF_STATUS wlan_spectral_deinit(void); 52 53 /** 54 * wlan_lmac_if_sptrl_register_rx_ops() - Register lmac interface Rx operations 55 * @rx_ops: Pointer to lmac interface Rx operations structure 56 * 57 * API to register spectral related lmac interface Rx operations 58 * 59 * Return: None 60 */ 61 void 62 wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops); 63 64 /** 65 * wlan_register_wmi_spectral_cmd_ops() - Register operations related to wmi 66 * commands on spectral parameters 67 * @pdev - the physical device object 68 * @cmd_ops - pointer to the structure holding the operations 69 * related to wmi commands on spectral parameters 70 * 71 * API to register operations related to wmi commands on spectral parameters 72 * 73 * Return: None 74 */ 75 void 76 wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev, 77 struct wmi_spectral_cmd_ops *cmd_ops); 78 79 /** 80 * struct spectral_legacy_cbacks - Spectral legacy callbacks 81 * @vdev_get_chan_freq: Get channel frequency 82 * @vdev_get_ch_width: Get channel width 83 * @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency 84 */ 85 struct spectral_legacy_cbacks { 86 int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev); 87 enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev); 88 int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev, 89 uint16_t *sec20chan_freq); 90 }; 91 92 /** 93 * spectral_vdev_get_chan_freq - Get vdev channel frequency 94 * @vdev: vdev object 95 * 96 * Return: vdev operating frequency 97 */ 98 int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev); 99 100 /** 101 * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequncy 102 * @vdev: vdev object 103 * @sec20chan_freq: secondary channel frequency 104 * 105 * Return: secondary channel freq 106 */ 107 int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev, 108 uint16_t *sec20chan_freq); 109 110 /** 111 * spectral_register_legacy_cb() - Register spectral legacy callbacks 112 * commands on spectral parameters 113 * @psoc - the physical device object 114 * @legacy_cbacks - Reference to struct spectral_legacy_cbacks from which 115 * function pointers need to be copied 116 * 117 * API to register spectral related legacy callbacks 118 * 119 * Return: QDF_STATUS_SUCCESS upon successful registration, 120 * QDF_STATUS_E_FAILURE upon failure 121 */ 122 QDF_STATUS spectral_register_legacy_cb( 123 struct wlan_objmgr_psoc *psoc, 124 struct spectral_legacy_cbacks *legacy_cbacks); 125 126 /** 127 * spectral_vdev_get_ch_width() - Get the channel bandwidth 128 * @vdev - Pointer to vdev 129 * 130 * API to get the channel bandwidth of a given vdev 131 * 132 * Return: Enumeration corresponding to the channel bandwidth 133 */ 134 enum phy_ch_width 135 spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev); 136 137 /** 138 * spectral_pdev_open() - Spectral pdev open handler 139 * @pdev: pointer to pdev object 140 * 141 * API to execute operations on pdev open 142 * 143 * Return: QDF_STATUS_SUCCESS upon successful registration, 144 * QDF_STATUS_E_FAILURE upon failure 145 */ 146 QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev); 147 148 #ifdef DIRECT_BUF_RX_ENABLE 149 /** 150 * spectral_dbr_event_handler() - Spectral dbr event handler 151 * @pdev: pointer to pdev object 152 * @payload: dbr event buffer 153 * 154 * API to handle spectral dbr event 155 * 156 * Return: status 157 */ 158 int spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev, 159 struct direct_buf_rx_data *payload); 160 #endif 161 #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/ 162