1  /*
2   * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
3   *
4   * Permission to use, copy, modify, and/or distribute this software for
5   * any purpose with or without fee is hereby granted, provided that the
6   * above copyright notice and this permission notice appear in all
7   * copies.
8   *
9   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16   * PERFORMANCE OF THIS SOFTWARE.
17   */
18  
19  #ifndef _WLAN_TWT_CFG_H
20  #define _WLAN_TWT_CFG_H
21  
22  #include <wlan_objmgr_psoc_obj.h>
23  
24  #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
25  /**
26   * wlan_twt_cfg_init() - Initialize twt config params
27   * @psoc: Pointer to global psoc
28   *
29   * This function initializes the twt private cfg params
30   *
31   * Return: QDF_STATUS
32   */
33  QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc);
34  
35  /**
36   * wlan_twt_cfg_deinit() - De-initialize twt config params
37   * @psoc: Pointer to global psoc
38   *
39   * This function de-initializes the twt private cfg params
40   *
41   * Return: QDF_STATUS
42   */
43  QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc);
44  
45  /**
46   * wlan_twt_cfg_update() - Update twt config params
47   * @psoc: Pointer to global psoc
48   *
49   * This function updates the cfg param structure based on the
50   * intersection of target capabilities and other cfg params
51   *
52   * Return: QDF_STATUS
53   */
54  QDF_STATUS wlan_twt_cfg_update(struct wlan_objmgr_psoc *psoc);
55  
56  /**
57   * wlan_twt_cfg_get_requestor() - get cfg requestor
58   * @psoc: Pointer to global psoc
59   * @val: pointer to output variable
60   *
61   * Return: QDF_STATUS
62   */
63  QDF_STATUS
64  wlan_twt_cfg_get_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
65  
66  /**
67   * wlan_twt_cfg_get_responder() - get cfg responder
68   * @psoc: Pointer to global psoc
69   * @val: pointer to output variable
70   *
71   * Return: QDF_STATUS
72   */
73  QDF_STATUS
74  wlan_twt_cfg_get_responder(struct wlan_objmgr_psoc *psoc, bool *val);
75  
76  /**
77   * wlan_twt_cfg_set_responder() - set cfg responder
78   * @psoc: Pointer to global psoc
79   * @val: value to be set
80   *
81   * Return: QDF_STATUS
82   */
83  QDF_STATUS
84  wlan_twt_cfg_set_responder(struct wlan_objmgr_psoc *psoc, bool val);
85  
86  /**
87   * wlan_twt_cfg_is_twt_enabled() - API to check if TWT is enabled
88   * @psoc: Pointer to PSOC object
89   *
90   * Return: True if TWT is enabled else false
91   */
92  bool wlan_twt_cfg_is_twt_enabled(struct wlan_objmgr_psoc *psoc);
93  
94  /**
95   * wlan_twt_cfg_get_congestion_timeout() - get congestion timeout
96   * @psoc: Pointer to global psoc
97   * @val: pointer to output variable
98   *
99   * Return: QDF_STATUS
100   */
101  QDF_STATUS
102  wlan_twt_cfg_get_congestion_timeout(struct wlan_objmgr_psoc *psoc,
103  				    uint32_t *val);
104  
105  /**
106   * wlan_twt_cfg_set_congestion_timeout() - set congestion timeout
107   * @psoc: Pointer to global psoc
108   * @val: value to be set
109   *
110   * Return: QDF_STATUS
111   */
112  QDF_STATUS
113  wlan_twt_cfg_set_congestion_timeout(struct wlan_objmgr_psoc *psoc,
114  				    uint32_t val);
115  
116  /**
117   * wlan_twt_cfg_get_requestor_flag() - get requestor flag
118   * @psoc: Pointer to global psoc
119   * @val: pointer to output variable
120   *
121   * Return: QDF_STATUS
122   */
123  QDF_STATUS
124  wlan_twt_cfg_get_requestor_flag(struct wlan_objmgr_psoc *psoc, bool *val);
125  
126  /**
127   * wlan_twt_cfg_set_requestor_flag() - set requestor flag
128   * @psoc: Pointer to global psoc
129   * @val: value to be set
130   *
131   * Return: QDF_STATUS
132   */
133  QDF_STATUS
134  wlan_twt_cfg_set_requestor_flag(struct wlan_objmgr_psoc *psoc, bool val);
135  
136  /**
137   * wlan_twt_cfg_get_responder_flag() - get responder flag
138   * @psoc: Pointer to global psoc
139   * @val: pointer to output variable
140   *
141   * Return: QDF_STATUS
142   */
143  QDF_STATUS
144  wlan_twt_cfg_get_responder_flag(struct wlan_objmgr_psoc *psoc, bool *val);
145  
146  /**
147   * wlan_twt_cfg_set_responder_flag() - set responder flag
148   * @psoc: Pointer to global psoc
149   * @val: value to be set
150   *
151   * Return: QDF_STATUS
152   */
153  QDF_STATUS
154  wlan_twt_cfg_set_responder_flag(struct wlan_objmgr_psoc *psoc, bool val);
155  
156  /**
157   * wlan_twt_cfg_get_flex_sched() - get flex scheduling
158   * @psoc: Pointer to global psoc
159   * @val: pointer to output variable
160   *
161   * Return: QDF_STATUS
162   */
163  QDF_STATUS
164  wlan_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc *psoc, bool *val);
165  
166  /**
167   * wlan_twt_cfg_get_24ghz_enabled() - get 24ghz enable
168   * @psoc: Pointer to global psoc
169   * @val: pointer to output variable
170   *
171   * Return: QDF_STATUS
172   */
173  QDF_STATUS
174  wlan_twt_cfg_get_24ghz_enabled(struct wlan_objmgr_psoc *psoc, bool *val);
175  
176  /**
177   * wlan_twt_cfg_get_bcast_requestor() - get bcast requestor
178   * @psoc: Pointer to global psoc
179   * @val: pointer to output variable
180   *
181   * Return: QDF_STATUS
182   */
183  QDF_STATUS
184  wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
185  
186  /**
187   * wlan_twt_cfg_get_bcast_responder() - get bcast responder
188   * @psoc: Pointer to global psoc
189   * @val: pointer to output variable
190   *
191   * Return: QDF_STATUS
192   */
193  QDF_STATUS
194  wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val);
195  
196  /**
197   * wlan_twt_cfg_get_rtwt_requestor() - get rtwt requestor
198   * @psoc: Pointer to global psoc
199   * @val: pointer to output variable
200   *
201   * Return: QDF_STATUS
202   */
203  QDF_STATUS
204  wlan_twt_cfg_get_rtwt_requestor(struct wlan_objmgr_psoc *psoc, bool *val);
205  
206  /**
207   * wlan_twt_cfg_get_rtwt_responder() - get rtwt responder
208   * @psoc: Pointer to global psoc
209   * @val: pointer to output variable
210   *
211   * Return: QDF_STATUS
212   */
213  QDF_STATUS
214  wlan_twt_cfg_get_rtwt_responder(struct wlan_objmgr_psoc *psoc, bool *val);
215  
216  /**
217   * wlan_twt_cfg_get_support_in_11n_mode() - Get TWT support in 11n mode
218   * @psoc: Pointer to global psoc
219   * @val: pointer to output variable
220   *
221   * Return: QDF_STATUS
222   */
223  QDF_STATUS
224  wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
225  				     bool *val);
226  /**
227   * wlan_twt_get_restricted_support() - Get rTWT support
228   * @psoc: Pointer to global psoc
229   * @val: pointer to output variable
230   *
231   * Return: QDF_STATUS
232   */
233  QDF_STATUS
234  wlan_twt_get_restricted_support(struct wlan_objmgr_psoc *psoc, bool *val);
235  
236  /**
237   * wlan_twt_get_pmo_allowed() - Get pmo allowed
238   * @psoc: psoc handler
239   *
240   * Return: True if twt pmo is allowed otherwise false
241   */
242  bool
243  wlan_twt_get_pmo_allowed(struct wlan_objmgr_psoc *psoc);
244  #else
245  
wlan_twt_cfg_init(struct wlan_objmgr_psoc * psoc)246  static inline QDF_STATUS wlan_twt_cfg_init(struct wlan_objmgr_psoc *psoc)
247  {
248  	return QDF_STATUS_SUCCESS;
249  }
250  
wlan_twt_cfg_deinit(struct wlan_objmgr_psoc * psoc)251  static inline QDF_STATUS wlan_twt_cfg_deinit(struct wlan_objmgr_psoc *psoc)
252  {
253  	return QDF_STATUS_SUCCESS;
254  }
255  
wlan_twt_cfg_update(struct wlan_objmgr_psoc * psoc)256  static inline QDF_STATUS wlan_twt_cfg_update(struct wlan_objmgr_psoc *psoc)
257  {
258  	return QDF_STATUS_SUCCESS;
259  }
260  
261  static inline QDF_STATUS
wlan_twt_cfg_get_requestor(struct wlan_objmgr_psoc * psoc,bool * val)262  wlan_twt_cfg_get_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
263  {
264  	return QDF_STATUS_SUCCESS;
265  }
266  
267  static inline QDF_STATUS
wlan_twt_cfg_get_responder(struct wlan_objmgr_psoc * psoc,bool * val)268  wlan_twt_cfg_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
269  {
270  	return QDF_STATUS_SUCCESS;
271  }
272  
273  static inline QDF_STATUS
wlan_twt_cfg_set_responder(struct wlan_objmgr_psoc * psoc,bool val)274  wlan_twt_cfg_set_responder(struct wlan_objmgr_psoc *psoc, bool val)
275  {
276  	return QDF_STATUS_SUCCESS;
277  }
278  
279  static inline bool
wlan_twt_cfg_is_twt_enabled(struct wlan_objmgr_psoc * psoc)280  wlan_twt_cfg_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
281  {
282  	return QDF_STATUS_SUCCESS;
283  }
284  
285  static inline QDF_STATUS
wlan_twt_cfg_get_congestion_timeout(struct wlan_objmgr_psoc * psoc,uint32_t * val)286  wlan_twt_cfg_get_congestion_timeout(struct wlan_objmgr_psoc *psoc,
287  				    uint32_t *val)
288  {
289  	return QDF_STATUS_SUCCESS;
290  }
291  
292  static inline QDF_STATUS
wlan_twt_cfg_set_congestion_timeout(struct wlan_objmgr_psoc * psoc,uint32_t val)293  wlan_twt_cfg_set_congestion_timeout(struct wlan_objmgr_psoc *psoc,
294  				    uint32_t val)
295  {
296  	return QDF_STATUS_SUCCESS;
297  }
298  
299  static inline QDF_STATUS
wlan_twt_cfg_get_requestor_flag(struct wlan_objmgr_psoc * psoc,bool * val)300  wlan_twt_cfg_get_requestor_flag(struct wlan_objmgr_psoc *psoc, bool *val)
301  {
302  	return QDF_STATUS_SUCCESS;
303  }
304  
305  static inline QDF_STATUS
wlan_twt_cfg_set_requestor_flag(struct wlan_objmgr_psoc * psoc,bool val)306  wlan_twt_cfg_set_requestor_flag(struct wlan_objmgr_psoc *psoc, bool val)
307  {
308  	return QDF_STATUS_SUCCESS;
309  }
310  
311  static inline QDF_STATUS
wlan_twt_cfg_get_responder_flag(struct wlan_objmgr_psoc * psoc,bool * val)312  wlan_twt_cfg_get_responder_flag(struct wlan_objmgr_psoc *psoc, bool *val)
313  {
314  	return QDF_STATUS_SUCCESS;
315  }
316  
317  static inline QDF_STATUS
wlan_twt_cfg_set_responder_flag(struct wlan_objmgr_psoc * psoc,bool val)318  wlan_twt_cfg_set_responder_flag(struct wlan_objmgr_psoc *psoc, bool val)
319  {
320  	return QDF_STATUS_SUCCESS;
321  }
322  
323  static inline QDF_STATUS
wlan_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc * psoc,bool * val)324  wlan_twt_cfg_get_flex_sched(struct wlan_objmgr_psoc *psoc, bool *val)
325  {
326  	return QDF_STATUS_SUCCESS;
327  }
328  
329  static inline QDF_STATUS
wlan_twt_cfg_get_24ghz_enabled(struct wlan_objmgr_psoc * psoc,bool * val)330  wlan_twt_cfg_get_24ghz_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
331  {
332  	return QDF_STATUS_SUCCESS;
333  }
334  
335  static inline QDF_STATUS
wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc * psoc,bool * val)336  wlan_twt_cfg_get_bcast_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
337  {
338  	return QDF_STATUS_SUCCESS;
339  }
340  
341  static inline QDF_STATUS
wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc * psoc,bool * val)342  wlan_twt_cfg_get_bcast_responder(struct wlan_objmgr_psoc *psoc, bool *val)
343  {
344  	return QDF_STATUS_SUCCESS;
345  }
346  
347  static inline QDF_STATUS
wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc * psoc,bool * val)348  wlan_twt_cfg_get_support_in_11n_mode(struct wlan_objmgr_psoc *psoc,
349  				     bool *val)
350  {
351  	return QDF_STATUS_SUCCESS;
352  }
353  
354  static inline QDF_STATUS
wlan_twt_get_restricted_support(struct wlan_objmgr_psoc * psoc,bool * val)355  wlan_twt_get_restricted_support(struct wlan_objmgr_psoc *psoc, bool *val)
356  {
357  	return QDF_STATUS_SUCCESS;
358  }
359  
360  static inline bool
wlan_twt_get_pmo_allowed(struct wlan_objmgr_psoc * psoc)361  wlan_twt_get_pmo_allowed(struct wlan_objmgr_psoc *psoc)
362  {
363  	return true;
364  }
365  #endif
366  
367  #endif /* End of _WLAN_TWT_CFG_H */
368