xref: /wlan-driver/qca-wifi-host-cmn/umac/wifi_radar/dispatcher/inc/wlan_wifi_radar_utils_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021, 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef _WLAN_WIFI_RADAR_UTILS_API_H_
18 #define _WLAN_WIFI_RADAR_UTILS_API_H_
19 
20 #include <wlan_objmgr_cmn.h>
21 #include <qdf_streamfs.h>
22 
23 #define wifi_radar_alert(format, args...) \
24 	QDF_TRACE_FATAL(QDF_MODULE_ID_WIFI_RADAR, format, ## args)
25 
26 #define wifi_radar_err(format, args...) \
27 	QDF_TRACE_ERROR(QDF_MODULE_ID_WIFI_RADAR, format, ## args)
28 
29 #define wifi_radar_warn(format, args...) \
30 	QDF_TRACE_WARN(QDF_MODULE_ID_WIFI_RADAR, format, ## args)
31 
32 #define wifi_radar_info(format, args...) \
33 	QDF_TRACE_INFO(QDF_MODULE_ID_WIFI_RADAR, format, ## args)
34 
35 #define wifi_radar_debug(format, args...) \
36 	QDF_TRACE_DEBUG(QDF_MODULE_ID_WIFI_RADAR, format, ## args)
37 
38 /**
39  * struct psoc_wifi_radar - private psoc object for WiFi Radar
40  * @psoc_obj: pointer to psoc object
41  * @is_wifi_radar_capable: flag to determine if wifi radar is enabled or not
42  */
43 struct psoc_wifi_radar {
44 	struct wlan_objmgr_psoc *psoc_obj;
45 	uint8_t is_wifi_radar_capable;
46 };
47 
48 /**
49  * struct pdev_wifi_radar - private pdev object for WiFi Radar
50  * @pdev_obj: pointer to pdev object
51  * @is_wifi_radar_capable: flag to determine if wifi radar is enabled or not
52  * @chan_ptr: Channel in relayfs
53  * @dir_ptr: Parent directory of relayfs file
54  * @num_subbufs: No. of sub-buffers used in relayfs
55  * @subbuf_size: Size of sub-buffer used in relayfs
56  */
57 struct pdev_wifi_radar {
58 	struct wlan_objmgr_pdev *pdev_obj;
59 	uint8_t is_wifi_radar_capable;
60 	qdf_streamfs_chan_t chan_ptr;
61 	qdf_dentry_t dir_ptr;
62 	uint32_t num_subbufs;
63 	uint32_t subbuf_size;
64 };
65 
66 /**
67  * struct peer_wifi_radar - private peer object for WiFi Radar
68  * @peer_obj: pointer to peer_obj
69  */
70 struct peer_wifi_radar {
71 	struct wlan_objmgr_peer *peer_obj;
72 };
73 
74 /**
75  * wlan_wifi_radar_init() - Global init for wifi radar.
76  *
77  * Return: status of global init pass/fail
78  */
79 QDF_STATUS wlan_wifi_radar_init(void);
80 
81 /**
82  * wlan_wifi_radar_deinit() - Global de-init for wifi radar.
83  *
84  * Return: status of global de-init pass/fail
85  */
86 QDF_STATUS wlan_wifi_radar_deinit(void);
87 
88 /**
89  * wlan_wifi_radar_pdev_open() - pdev_open function for wifi radar.
90  * @pdev: pointer to pdev object
91  *
92  * Return: status of pdev_open pass/fail
93  */
94 QDF_STATUS wlan_wifi_radar_pdev_open(struct wlan_objmgr_pdev *pdev);
95 
96 /**
97  * wlan_wifi_radar_pdev_close() - pdev_close function for wifi radar.
98  * @pdev: pointer to pdev object
99  *
100  * Return: status of pdev_close pass/fail
101  */
102 QDF_STATUS wlan_wifi_radar_pdev_close(struct wlan_objmgr_pdev *pdev);
103 
104 /**
105  * wifi_radar_initialize_pdev() - pdev_initialize function for wifi radar.
106  * @pdev: pointer to pdev object
107  *
108  * Return: status of pdev_initialize pass/fail
109  */
110 QDF_STATUS wifi_radar_initialize_pdev(struct wlan_objmgr_pdev *pdev);
111 
112 /**
113  * wifi_radar_deinitialize_pdev() - pdev_deinitialize function for wifi radar.
114  * @pdev: pointer to pdev object
115  *
116  * Return: status of pdev_deinitialize pass/fail
117  */
118 QDF_STATUS wifi_radar_deinitialize_pdev(struct wlan_objmgr_pdev *pdev);
119 
120 /**
121  * wlan_wifi_radar_is_feature_disabled() - Check if wifi radarfeature
122  * is disabled
123  * @pdev: the physical device object.
124  *
125  * Return : true if wifi radar is disabled, else false.
126  */
127 bool wlan_wifi_radar_is_feature_disabled(struct wlan_objmgr_pdev *pdev);
128 
129 #endif
130