xref: /wlan-dirver/qca-wifi-host-cmn/target_if/wifi_pos/inc/target_if_wifi_pos.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2017, 2019-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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: target_if_wifi_pos.h
22  * This file declares the functions pertinent to wifi positioning component's
23  * target if layer.
24  */
25 #ifndef _WIFI_POS_TGT_IF_H_
26 #define _WIFI_POS_TGT_IF_H_
27 
28 #include "qdf_types.h"
29 #include "qdf_status.h"
30 #include "wlan_cmn.h"
31 #include "wmi_unified_api.h"
32 #include "wifi_pos_utils_i.h"
33 
34 struct oem_data_req;
35 struct oem_data_rsp;
36 struct wlan_objmgr_psoc;
37 struct wlan_soc_southbound_cb;
38 struct wlan_lmac_if_tx_ops;
39 struct wlan_lmac_if_rx_ops;
40 
41 #ifdef WLAN_FEATURE_CIF_CFR
42 /**
43  * target_if_wifi_pos_get_indirect_data  - Get the indirect data from the
44  * response
45  * @priv_obj: Wifi Pos private object
46  * @indirect: Indirect data
47  * @rsp: Oem data response
48  * @cookie: Cookie
49  *
50  * Return: QDF_STATUS
51  */
52 QDF_STATUS target_if_wifi_pos_get_indirect_data(
53 			struct wifi_pos_psoc_priv_obj *priv_obj,
54 			struct wmi_host_oem_indirect_data *indirect,
55 			struct oem_data_rsp *rsp, uint32_t *cookie);
56 /**
57  * target_if_wifi_pos_replenish_ring() - Replenish the CFR DMA ring
58  * @priv: Pointer to Wifi Pos psoc private object
59  * @ring_idx: Ring Index
60  * @vaddr: Virtual address
61  * @cookie: Cookie
62  *
63  * Return: QDF_STATUS
64  */
65 QDF_STATUS
66 target_if_wifi_pos_replenish_ring(struct wifi_pos_psoc_priv_obj *priv,
67 				  uint8_t ring_idx,
68 				  void *vaddr, uint32_t cookie);
69 #else
70 static inline
71 QDF_STATUS target_if_wifi_pos_get_indirect_data(
72 			struct wifi_pos_psoc_priv_obj *priv_obj,
73 			struct wmi_host_oem_indirect_data *indirect,
74 			struct oem_data_rsp *rsp, uint32_t *cookie)
75 {
76 	return QDF_STATUS_SUCCESS;
77 }
78 
79 static inline QDF_STATUS
80 target_if_wifi_pos_replenish_ring(struct wifi_pos_psoc_priv_obj *priv,
81 				  uint8_t ring_idx,
82 				  void *vaddr, uint32_t cookie)
83 {
84 	return QDF_STATUS_SUCCESS;
85 }
86 #endif
87 
88 #ifdef WIFI_POS_CONVERGED
89 /**
90  * target_if_wifi_pos_get_vht_ch_width: function to get vht channel width
91  * @psoc: pointer to psoc object
92  * @ch_width: pointer to the variable in which output value needs to be filled
93  *
94  * Return: status of operation
95  */
96 QDF_STATUS target_if_wifi_pos_get_vht_ch_width(struct wlan_objmgr_psoc *psoc,
97 					       enum phy_ch_width *ch_width);
98 #endif
99 
100 #if defined(WLAN_FEATURE_CIF_CFR) && defined(WIFI_POS_CONVERGED)
101 /**
102  * target_if_wifi_pos_init_cir_cfr_rings: set DMA ring cap in psoc private
103  * object
104  * @psoc: pointer to psoc object
105  * @hal_soc: pointer to hal soc
106  * @num_mac: number of mac
107  * @buf: buffer containing DMA ring cap
108  *
109  * Return: status of operation
110  */
111 QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc,
112 					     void *hal_soc, uint8_t num_mac,
113 					     void *buf);
114 /**
115  * target_if_wifi_pos_deinit_dma_rings: frees up DMA rings
116  * @psoc: pointer to psoc
117  *
118  * Return: status of operation
119  */
120 QDF_STATUS target_if_wifi_pos_deinit_dma_rings(struct wlan_objmgr_psoc *psoc);
121 #else
122 static inline QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(
123 				struct wlan_objmgr_psoc *psoc, void *hal_soc,
124 				uint8_t num_mac, void *buf)
125 {
126 	return QDF_STATUS_SUCCESS;
127 }
128 
129 static inline QDF_STATUS target_if_wifi_pos_deinit_dma_rings(
130 				struct wlan_objmgr_psoc *psoc)
131 {
132 	return QDF_STATUS_SUCCESS;
133 }
134 #endif
135 
136 #ifndef CNSS_GENL
137 /**
138  * target_if_wifi_pos_convert_pdev_id_host_to_target: function to get target
139  * pdev_id from host pdev_id
140  * @psoc: pointer to psoc object
141  * @host_pdev_id: host pdev id
142  * @target_pdev_id: target pdev id
143  *
144  * Return: QDF_STATUS_SUCCESS in case of success, error codes in
145  * case of failure
146  */
147 QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target(
148 		struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
149 		uint32_t *target_pdev_id);
150 
151 /**
152  * target_if_wifi_pos_convert_pdev_id_target_to_host: function to get host
153  * pdev_id from target pdev_id
154  * @psoc: pointer to psoc object
155  * @target_pdev_id: target pdev id
156  * @host_pdev_id: host pdev id
157  *
158  * Return: QDF_STATUS_SUCCESS in case of success, error codes in
159  * case of failure
160  */
161 QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host(
162 		struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id,
163 		uint32_t *host_pdev_id);
164 
165 #else
166 
167 static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target(
168 		struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
169 		uint32_t *target_pdev_id)
170 {
171 	return QDF_STATUS_SUCCESS;
172 }
173 
174 static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host(
175 		struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id,
176 		uint32_t *host_pdev_id)
177 {
178 	return QDF_STATUS_SUCCESS;
179 }
180 #endif /* CNSS_GENL */
181 #endif /* _WIFI_POS_TGT_IF_H_ */
182