xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_bus.h (revision 3ea9fb0844508b933f0a76c36153a857532b8bee)
1 /*
2  * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 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: cdp_txrx_bus.h
22  *      Define the host data path bus related functions
23  */
24 #ifndef _CDP_TXRX_BUS_H_
25 #define _CDP_TXRX_BUS_H_
26 
27 /**
28  * cdp_bus_suspend() - suspend bus
29  * @soc: data path soc handle
30  * @pdev_id: id of dp pdev handle
31  *
32  * suspend bus
33  *
34  * return QDF_STATUS_SUCCESS suspend is not implemented or suspend done
35  */
36 static inline QDF_STATUS cdp_bus_suspend(ol_txrx_soc_handle soc,
37 					 uint8_t pdev_id)
38 {
39 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
40 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
41 			"%s invalid instance", __func__);
42 		return QDF_STATUS_E_INVAL;
43 	}
44 
45 	if (soc->ops->bus_ops->bus_suspend)
46 		return soc->ops->bus_ops->bus_suspend(soc, pdev_id);
47 	return QDF_STATUS_E_NOSUPPORT;
48 }
49 
50 /**
51  * cdp_bus_resume() - resume bus
52  * @soc: data path soc handle
53  * @pdev_id: id of dp pdev handle
54  *
55  * resume bus
56  *
57  * return QDF_STATUS_SUCCESS resume is not implemented or suspend done
58  */
59 static inline QDF_STATUS cdp_bus_resume(ol_txrx_soc_handle soc,
60 					uint8_t pdev_id)
61 {
62 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
63 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
64 			"%s invalid instance", __func__);
65 		return QDF_STATUS_E_INVAL;
66 	}
67 
68 	if (soc->ops->bus_ops->bus_resume)
69 		return soc->ops->bus_ops->bus_resume(soc, pdev_id);
70 	return QDF_STATUS_E_NOSUPPORT;
71 }
72 
73 /**
74  * cdp_process_wow_ack_rsp() - Process wow ack response
75  * @soc: data path soc handle
76  * @pdev_id: id of dp pdev handle
77  *
78  * Do any required data path operations for target wow ack
79  * suspend response.
80  *
81  * Return: None
82  */
83 static inline void cdp_process_wow_ack_rsp(ol_txrx_soc_handle soc,
84 					   uint8_t pdev_id)
85 {
86 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
87 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
88 			  "%s invalid instance", __func__);
89 		return;
90 	}
91 
92 	if (soc->ops->bus_ops->process_wow_ack_rsp)
93 		return soc->ops->bus_ops->process_wow_ack_rsp(soc, pdev_id);
94 }
95 
96 /**
97  * cdp_process_target_suspend_req() - Process target suspend request
98  * @soc: data path soc handle
99  * @pdev_id: id of dp pdev handle
100  *
101  * Complete the datapath specific work before target suspend
102  *
103  * Return: None
104  */
105 static inline void cdp_process_target_suspend_req(ol_txrx_soc_handle soc,
106 						  uint8_t pdev_id)
107 {
108 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
109 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
110 			  "%s invalid instance", __func__);
111 		return;
112 	}
113 
114 	if (soc->ops->bus_ops->process_target_suspend_req)
115 		return soc->ops->bus_ops->process_target_suspend_req(soc,
116 								     pdev_id);
117 }
118 #endif /* _CDP_TXRX_BUS_H_ */
119