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