xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_bus.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2017, 2019-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: cdp_txrx_bus.h
22*5113495bSYour Name  *      Define the host data path bus related functions
23*5113495bSYour Name  */
24*5113495bSYour Name #ifndef _CDP_TXRX_BUS_H_
25*5113495bSYour Name #define _CDP_TXRX_BUS_H_
26*5113495bSYour Name 
27*5113495bSYour Name /**
28*5113495bSYour Name  * cdp_bus_suspend() - suspend bus
29*5113495bSYour Name  * @soc: data path soc handle
30*5113495bSYour Name  * @pdev_id: id of dp pdev handle
31*5113495bSYour Name  *
32*5113495bSYour Name  * suspend bus
33*5113495bSYour Name  *
34*5113495bSYour Name  * return QDF_STATUS_SUCCESS suspend is not implemented or suspend done
35*5113495bSYour Name  */
cdp_bus_suspend(ol_txrx_soc_handle soc,uint8_t pdev_id)36*5113495bSYour Name static inline QDF_STATUS cdp_bus_suspend(ol_txrx_soc_handle soc,
37*5113495bSYour Name 					 uint8_t pdev_id)
38*5113495bSYour Name {
39*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
40*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
41*5113495bSYour Name 			"%s invalid instance", __func__);
42*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
43*5113495bSYour Name 	}
44*5113495bSYour Name 
45*5113495bSYour Name 	if (soc->ops->bus_ops->bus_suspend)
46*5113495bSYour Name 		return soc->ops->bus_ops->bus_suspend(soc, pdev_id);
47*5113495bSYour Name 	return QDF_STATUS_E_NOSUPPORT;
48*5113495bSYour Name }
49*5113495bSYour Name 
50*5113495bSYour Name /**
51*5113495bSYour Name  * cdp_bus_resume() - resume bus
52*5113495bSYour Name  * @soc: data path soc handle
53*5113495bSYour Name  * @pdev_id: id of dp pdev handle
54*5113495bSYour Name  *
55*5113495bSYour Name  * resume bus
56*5113495bSYour Name  *
57*5113495bSYour Name  * return QDF_STATUS_SUCCESS resume is not implemented or suspend done
58*5113495bSYour Name  */
cdp_bus_resume(ol_txrx_soc_handle soc,uint8_t pdev_id)59*5113495bSYour Name static inline QDF_STATUS cdp_bus_resume(ol_txrx_soc_handle soc,
60*5113495bSYour Name 					uint8_t pdev_id)
61*5113495bSYour Name {
62*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
63*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
64*5113495bSYour Name 			"%s invalid instance", __func__);
65*5113495bSYour Name 		return QDF_STATUS_E_INVAL;
66*5113495bSYour Name 	}
67*5113495bSYour Name 
68*5113495bSYour Name 	if (soc->ops->bus_ops->bus_resume)
69*5113495bSYour Name 		return soc->ops->bus_ops->bus_resume(soc, pdev_id);
70*5113495bSYour Name 	return QDF_STATUS_E_NOSUPPORT;
71*5113495bSYour Name }
72*5113495bSYour Name 
73*5113495bSYour Name /**
74*5113495bSYour Name  * cdp_process_wow_ack_rsp() - Process wow ack response
75*5113495bSYour Name  * @soc: data path soc handle
76*5113495bSYour Name  * @pdev_id: id of dp pdev handle
77*5113495bSYour Name  *
78*5113495bSYour Name  * Do any required data path operations for target wow ack
79*5113495bSYour Name  * suspend response.
80*5113495bSYour Name  *
81*5113495bSYour Name  * Return: None
82*5113495bSYour Name  */
cdp_process_wow_ack_rsp(ol_txrx_soc_handle soc,uint8_t pdev_id)83*5113495bSYour Name static inline void cdp_process_wow_ack_rsp(ol_txrx_soc_handle soc,
84*5113495bSYour Name 					   uint8_t pdev_id)
85*5113495bSYour Name {
86*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
87*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
88*5113495bSYour Name 			  "%s invalid instance", __func__);
89*5113495bSYour Name 		return;
90*5113495bSYour Name 	}
91*5113495bSYour Name 
92*5113495bSYour Name 	if (soc->ops->bus_ops->process_wow_ack_rsp)
93*5113495bSYour Name 		return soc->ops->bus_ops->process_wow_ack_rsp(soc, pdev_id);
94*5113495bSYour Name }
95*5113495bSYour Name 
96*5113495bSYour Name /**
97*5113495bSYour Name  * cdp_process_target_suspend_req() - Process target suspend request
98*5113495bSYour Name  * @soc: data path soc handle
99*5113495bSYour Name  * @pdev_id: id of dp pdev handle
100*5113495bSYour Name  *
101*5113495bSYour Name  * Complete the datapath specific work before target suspend
102*5113495bSYour Name  *
103*5113495bSYour Name  * Return: None
104*5113495bSYour Name  */
cdp_process_target_suspend_req(ol_txrx_soc_handle soc,uint8_t pdev_id)105*5113495bSYour Name static inline void cdp_process_target_suspend_req(ol_txrx_soc_handle soc,
106*5113495bSYour Name 						  uint8_t pdev_id)
107*5113495bSYour Name {
108*5113495bSYour Name 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
109*5113495bSYour Name 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
110*5113495bSYour Name 			  "%s invalid instance", __func__);
111*5113495bSYour Name 		return;
112*5113495bSYour Name 	}
113*5113495bSYour Name 
114*5113495bSYour Name 	if (soc->ops->bus_ops->process_target_suspend_req)
115*5113495bSYour Name 		return soc->ops->bus_ops->process_target_suspend_req(soc,
116*5113495bSYour Name 								     pdev_id);
117*5113495bSYour Name }
118*5113495bSYour Name #endif /* _CDP_TXRX_BUS_H_ */
119