xref: /wlan-driver/qca-wifi-host-cmn/umac/regulatory/core/src/reg_callbacks.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
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 /**
21  * DOC: reg_callbks.h
22  * This file provides prototypes of reg callbacks.
23  */
24 
25 #ifndef __REG_CALLBKS_H_
26 #define __REG_CALLBKS_H_
27 
28 #ifdef CONFIG_REG_CLIENT
29 /**
30  * reg_register_chan_change_callback() - Register channel change callbacks
31  * @psoc: Pointer to psoc
32  * @cbk: Pointer to callback function
33  * @arg: List of arguments
34  */
35 void reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
36 				       reg_chan_change_callback cbk, void *arg);
37 
38 /**
39  * reg_unregister_chan_change_callback() - Unregister channel change callbacks
40  * @psoc: Pointer to psoc
41  * @cbk: Pointer to callback function
42  */
43 void reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
44 					 reg_chan_change_callback cbk);
45 
46 /**
47  * reg_register_ctry_change_callback() - Register country change callbacks
48  * @psoc: Pointer to psoc
49  * @cbk: Pointer to callback function
50  */
51 void reg_register_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
52 				       reg_ctry_change_callback cbk);
53 
54 /**
55  * reg_unregister_ctry_change_callback() - Unregister country change callbacks
56  * @psoc: Pointer to psoc
57  * @cbk: Pointer to callback function
58  */
59 void reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc *psoc,
60 					 reg_ctry_change_callback cbk);
61 
62 /**
63  * reg_notify_sap_event() - Notify regulatory domain for sap event
64  * @pdev: The physical dev to set the band for
65  * @sap_state: true for sap start else false
66  *
67  * Return: QDF_STATUS
68  */
69 QDF_STATUS reg_notify_sap_event(struct wlan_objmgr_pdev *pdev,
70 				bool sap_state);
71 
72 /**
73  * reg_send_scheduler_msg_sb() - Start scheduler to call list of south bound
74  * callbacks registered whenever current chan list changes.
75  * @psoc: Pointer to PSOC structure.
76  * @pdev: Pointer to PDEV structure.
77  *
78  * Return: QDF_STATUS
79  */
80 QDF_STATUS reg_send_scheduler_msg_sb(struct wlan_objmgr_psoc *psoc,
81 				     struct wlan_objmgr_pdev *pdev);
82 
83 /**
84  * reg_send_scheduler_msg_nb() - Start scheduler to call list of north bound
85  * @psoc: Pointer to global psoc structure.
86  * @pdev: Pointer to global pdev structure.
87  */
88 QDF_STATUS reg_send_scheduler_msg_nb(struct wlan_objmgr_psoc *psoc,
89 				     struct wlan_objmgr_pdev *pdev);
90 /**
91  * reg_register_is_chan_connected_callback() - Register callback to check if
92  *                                             channel is connected
93  * @psoc: Pointer to global psoc structure.
94  * @cbk: Pointer to callback function
95  *
96  * Return: None
97  */
98 void
99 reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
100 			reg_get_connected_chan_for_mode_callback cbk);
101 
102 /**
103  * reg_unregister_is_chan_connected_callback() - Unregister callback to check
104  *                                               if channel is connected
105  * @psoc: Pointer to global psoc structure.
106  * @cbk: Pointer to callback function
107  *
108  * Return: None
109  */
110 void
111 reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
112 			reg_get_connected_chan_for_mode_callback cbk);
113 
114 #else
reg_register_chan_change_callback(struct wlan_objmgr_psoc * psoc,reg_chan_change_callback cbk,void * arg)115 static inline void reg_register_chan_change_callback(
116 		struct wlan_objmgr_psoc *psoc, reg_chan_change_callback cbk,
117 		void *arg)
118 {
119 }
120 
reg_unregister_chan_change_callback(struct wlan_objmgr_psoc * psoc,reg_chan_change_callback cbk)121 static inline void reg_unregister_chan_change_callback(
122 		struct wlan_objmgr_psoc *psoc, reg_chan_change_callback cbk)
123 {
124 }
125 
reg_register_ctry_change_callback(struct wlan_objmgr_psoc * psoc,reg_ctry_change_callback cbk)126 static inline void reg_register_ctry_change_callback(
127 		struct wlan_objmgr_psoc *psoc, reg_ctry_change_callback cbk)
128 {
129 }
130 
reg_unregister_ctry_change_callback(struct wlan_objmgr_psoc * psoc,reg_ctry_change_callback cbk)131 static inline void reg_unregister_ctry_change_callback(
132 		struct wlan_objmgr_psoc *psoc, reg_ctry_change_callback cbk)
133 {
134 }
135 
reg_send_scheduler_msg_sb(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev)136 static inline QDF_STATUS reg_send_scheduler_msg_sb(
137 		struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_pdev *pdev)
138 {
139 	return QDF_STATUS_SUCCESS;
140 }
141 
reg_send_scheduler_msg_nb(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_pdev * pdev)142 static inline QDF_STATUS reg_send_scheduler_msg_nb(
143 		struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_pdev *pdev)
144 {
145 	return QDF_STATUS_SUCCESS;
146 }
147 
148 static inline void
reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc * psoc,reg_get_connected_chan_for_mode_callback cbk)149 reg_register_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
150 				reg_get_connected_chan_for_mode_callback cbk)
151 {
152 }
153 
154 static inline void
reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc * psoc,reg_get_connected_chan_for_mode_callback cbk)155 reg_unregister_is_chan_connected_callback(struct wlan_objmgr_psoc *psoc,
156 				reg_get_connected_chan_for_mode_callback cbk)
157 {
158 }
159 #endif
160 #endif
161