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 #include <wlan_twt_cfg_ext_api.h>
19 #include "twt/core/src/wlan_twt_cfg.h"
20 #include "wlan_mlme_api.h"
21 
22 QDF_STATUS
wlan_twt_cfg_get_req_flag(struct wlan_objmgr_psoc * psoc,bool * val)23 wlan_twt_cfg_get_req_flag(struct wlan_objmgr_psoc *psoc, bool *val)
24 {
25 	return wlan_twt_cfg_get_requestor_flag(psoc, val);
26 }
27 
28 QDF_STATUS
wlan_twt_cfg_get_res_flag(struct wlan_objmgr_psoc * psoc,bool * val)29 wlan_twt_cfg_get_res_flag(struct wlan_objmgr_psoc *psoc, bool *val)
30 {
31 	return wlan_twt_cfg_get_responder_flag(psoc, val);
32 }
33 
34 QDF_STATUS
wlan_twt_cfg_get_support_in_11n(struct wlan_objmgr_psoc * psoc,bool * val)35 wlan_twt_cfg_get_support_in_11n(struct wlan_objmgr_psoc *psoc, bool *val)
36 {
37 	return wlan_twt_cfg_get_support_in_11n_mode(psoc, val);
38 }
39 
40 QDF_STATUS
wlan_twt_get_requestor_cfg(struct wlan_objmgr_psoc * psoc,bool * val)41 wlan_twt_get_requestor_cfg(struct wlan_objmgr_psoc *psoc, bool *val)
42 {
43 	return wlan_twt_cfg_get_requestor(psoc, val);
44 }
45 
46 QDF_STATUS
wlan_twt_get_responder_cfg(struct wlan_objmgr_psoc * psoc,bool * val)47 wlan_twt_get_responder_cfg(struct wlan_objmgr_psoc *psoc, bool *val)
48 {
49 	return wlan_twt_cfg_get_responder(psoc, val);
50 }
51 
52 QDF_STATUS
wlan_twt_cfg_get_support_requestor(struct wlan_objmgr_psoc * psoc,bool * val)53 wlan_twt_cfg_get_support_requestor(struct wlan_objmgr_psoc *psoc, bool *val)
54 {
55 	return wlan_twt_cfg_get_requestor(psoc, val);
56 }
57 
58 QDF_STATUS
wlan_twt_get_rtwt_support(struct wlan_objmgr_psoc * psoc,bool * val)59 wlan_twt_get_rtwt_support(struct wlan_objmgr_psoc *psoc, bool *val)
60 {
61 	return wlan_twt_get_restricted_support(psoc, val);
62 }
63 
64 QDF_STATUS
wlan_twt_get_bcast_requestor_cfg(struct wlan_objmgr_psoc * psoc,bool * val)65 wlan_twt_get_bcast_requestor_cfg(struct wlan_objmgr_psoc *psoc, bool *val)
66 {
67 	return wlan_twt_cfg_get_bcast_requestor(psoc, val);
68 }
69 
70 QDF_STATUS
wlan_twt_get_bcast_responder_cfg(struct wlan_objmgr_psoc * psoc,bool * val)71 wlan_twt_get_bcast_responder_cfg(struct wlan_objmgr_psoc *psoc, bool *val)
72 {
73 	return wlan_twt_cfg_get_bcast_responder(psoc, val);
74 }
75 
76 #ifdef FEATURE_SET
wlan_twt_get_feature_info(struct wlan_objmgr_psoc * psoc,struct wlan_twt_features * twt_feature_set)77 void wlan_twt_get_feature_info(struct wlan_objmgr_psoc *psoc,
78 			       struct wlan_twt_features *twt_feature_set)
79 {
80 	twt_feature_set->enable_twt = wlan_twt_cfg_is_twt_enabled(psoc);
81 	if (twt_feature_set->enable_twt) {
82 		wlan_twt_cfg_get_bcast_requestor(
83 					psoc,
84 					&twt_feature_set->enable_twt_broadcast);
85 		wlan_twt_cfg_get_requestor(
86 					psoc,
87 					&twt_feature_set->enable_twt_requester);
88 		twt_feature_set->enable_twt_flexible = true;
89 	}
90 }
91 #endif
92