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