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