1 /*
2 * Copyright (c) 2020, 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 any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 /*
19 * DOC: contains coex north bound interface declarations
20 */
21
22 #ifndef _WLAN_COEX_UCFG_API_H_
23 #define _WLAN_COEX_UCFG_API_H_
24
25 #include "qdf_status.h"
26 #include <wlan_objmgr_vdev_obj.h>
27 #include <wlan_objmgr_psoc_obj.h>
28 #include "wlan_coex_public_structs.h"
29
30 /**
31 * enum coex_btc_chain_mode - btc chain mode definitions
32 * @WLAN_COEX_BTC_CHAIN_MODE_SHARED: chains of BT and WLAN 2.4 GHz are shared.
33 * @WLAN_COEX_BTC_CHAIN_MODE_FDD: chains of BT and WLAN 2.4 GHz are
34 * separated, FDD mode.
35 * @WLAN_COEX_BTC_CHAIN_MODE_HYBRID: chains of BT and WLAN 2.4 GHz are
36 * separated, hybrid mode.
37 * @WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED: chain mode is not set.
38 */
39 enum coex_btc_chain_mode {
40 WLAN_COEX_BTC_CHAIN_MODE_SHARED = 0,
41 WLAN_COEX_BTC_CHAIN_MODE_FDD,
42 WLAN_COEX_BTC_CHAIN_MODE_HYBRID,
43 WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED = 0xFF,
44 };
45
46 /**
47 * enum coex_config_type - coex config type definitions
48 * @COEX_CONFIG_BTC_CHAIN_MODE: config BT coex chain mode
49 * @COEX_CONFIG_TYPE_MAX: max value
50 */
51 enum coex_config_type {
52 COEX_CONFIG_BTC_CHAIN_MODE,
53 /* keep last */
54 COEX_CONFIG_TYPE_MAX,
55 };
56
57 /**
58 * typedef update_coex_cb() - cb to inform coex config
59 * @vdev: vdev pointer
60 *
61 * Return: void
62 */
63 typedef QDF_STATUS (*update_coex_cb)(struct wlan_objmgr_vdev *vdev);
64
65 #ifdef FEATURE_COEX
66 /**
67 * ucfg_coex_register_cfg_updated_handler() - API to register coex config
68 * updated handler.
69 * @psoc: pointer to psoc object
70 * @type: type of coex config
71 * @handler: handler to be registered
72 *
73 * Return: status of operation
74 */
75 QDF_STATUS
76 ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
77 enum coex_config_type type,
78 update_coex_cb handler);
79
80 /**
81 * ucfg_coex_psoc_set_btc_chain_mode() - API to set BT coex chain mode for psoc
82 * @psoc: pointer to psoc object
83 * @val: BT coex chain mode
84 *
85 * Return : status of operation
86 */
87 QDF_STATUS
88 ucfg_coex_psoc_set_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
89 enum coex_btc_chain_mode val);
90
91 /**
92 * ucfg_coex_psoc_get_btc_chain_mode() - API to get BT coex chain mode from psoc
93 * @psoc: pointer to psoc object
94 * @val: pointer to BT coex chain mode
95 *
96 * Return : status of operation
97 */
98 QDF_STATUS
99 ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
100 enum coex_btc_chain_mode *val);
101
102 /**
103 * ucfg_coex_send_btc_chain_mode() - API to send BT coex config to target if
104 * @vdev: pointer to vdev object
105 * @mode: BT coex chain mode
106 *
107 * Return: status of operation
108 */
109 QDF_STATUS
110 ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
111 enum coex_btc_chain_mode mode);
112
113 /**
114 * ucfg_coex_send_multi_config() - API to send coex multiple config to target
115 * @vdev: pointer to vdev object
116 * @param: pointer to coex multiple config parameters
117 *
118 * Return: status of operation
119 */
120 QDF_STATUS
121 ucfg_coex_send_multi_config(struct wlan_objmgr_vdev *vdev,
122 struct coex_multi_config *param);
123
124 /**
125 * ucfg_coex_send_logging_config() - API to send BT coex logging config to
126 * target if
127 * @psoc: pointer to psoc object
128 * @apps_args: pointer to argument
129 *
130 * Return : status of operation
131 */
132 QDF_STATUS
133 ucfg_coex_send_logging_config(struct wlan_objmgr_psoc *psoc,
134 uint32_t *apps_args);
135 #else
136 static inline QDF_STATUS
ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc * psoc,enum coex_config_type type,update_coex_cb handler)137 ucfg_coex_register_cfg_updated_handler(struct wlan_objmgr_psoc *psoc,
138 enum coex_config_type type,
139 update_coex_cb handler)
140 {
141 return QDF_STATUS_SUCCESS;
142 }
143
144 static inline QDF_STATUS
ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc * psoc,enum coex_btc_chain_mode * val)145 ucfg_coex_psoc_get_btc_chain_mode(struct wlan_objmgr_psoc *psoc,
146 enum coex_btc_chain_mode *val)
147 {
148 if (val)
149 *val = WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED;
150
151 return QDF_STATUS_SUCCESS;
152 }
153
154 static inline QDF_STATUS
ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev * vdev,enum coex_btc_chain_mode mode)155 ucfg_coex_send_btc_chain_mode(struct wlan_objmgr_vdev *vdev,
156 enum coex_btc_chain_mode mode)
157 {
158 return QDF_STATUS_SUCCESS;
159 }
160
161 static inline QDF_STATUS
ucfg_coex_send_multi_config(struct wlan_objmgr_vdev * vdev,struct coex_multi_config * param)162 ucfg_coex_send_multi_config(struct wlan_objmgr_vdev *vdev,
163 struct coex_multi_config *param)
164 {
165 return QDF_STATUS_E_NOSUPPORT;
166 }
167
168 static inline QDF_STATUS
ucfg_coex_send_logging_config(struct wlan_objmgr_psoc * psoc,uint32_t * apps_args)169 ucfg_coex_send_logging_config(struct wlan_objmgr_psoc *psoc,
170 uint32_t *apps_args)
171 {
172 return QDF_STATUS_E_NOSUPPORT;
173 }
174 #endif
175 #ifdef WLAN_FEATURE_DBAM_CONFIG
176 /**
177 * ucfg_coex_send_dbam_config() - API to send dbam config to target if
178 * @vdev: pointer to vdev object
179 * @param: DBAM config mode params
180 * @clbk: dbam config response callback
181 * @context: request manager context
182 *
183 * Return: QDF_STATUS_SUCCESS on success
184 */
185 QDF_STATUS
186 ucfg_coex_send_dbam_config(struct wlan_objmgr_vdev *vdev,
187 struct coex_dbam_config_params *param,
188 void (*clbk)(void *ctx,
189 enum coex_dbam_comp_status *rsp),
190 void *context);
191 #else
192 static inline QDF_STATUS
ucfg_coex_send_dbam_config(void)193 ucfg_coex_send_dbam_config(void)
194 {
195 return QDF_STATUS_E_NOSUPPORT;
196 }
197 #endif
198 #endif
199