xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_bus.h (revision bea437e2293c3d4fb1b5704fcf633aedac996962)
1 /*
2  * Copyright (c) 2016-2017, 2019 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  * @file cdp_txrx_bus.h
21  * @brief Define the host data path bus related functions
22  */
23 #ifndef _CDP_TXRX_BUS_H_
24 #define _CDP_TXRX_BUS_H_
25 
26 /**
27  * cdp_bus_suspend() - suspend bus
28  * @soc: data path soc handle
29  * @pdev_id: id of dp pdev handle
30  *
31  * suspend bus
32  *
33  * return QDF_STATUS_SUCCESS suspend is not implemented or suspend done
34  */
35 static inline QDF_STATUS cdp_bus_suspend(ol_txrx_soc_handle soc,
36 					 uint8_t pdev_id)
37 {
38 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
39 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
40 			"%s invalid instance", __func__);
41 		return QDF_STATUS_E_INVAL;
42 	}
43 
44 	if (soc->ops->bus_ops->bus_suspend)
45 		return soc->ops->bus_ops->bus_suspend(soc, pdev_id);
46 	return QDF_STATUS_E_NOSUPPORT;
47 }
48 
49 /**
50  * cdp_bus_resume() - resume bus
51  * @soc: data path soc handle
52  * @pdev_id: id of dp pdev handle
53  *
54  * resume bus
55  *
56  * return QDF_STATUS_SUCCESS resume is not implemented or suspend done
57  */
58 static inline QDF_STATUS cdp_bus_resume(ol_txrx_soc_handle soc,
59 					uint8_t pdev_id)
60 {
61 	if (!soc || !soc->ops || !soc->ops->bus_ops) {
62 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
63 			"%s invalid instance", __func__);
64 		return QDF_STATUS_E_INVAL;
65 	}
66 
67 	if (soc->ops->bus_ops->bus_resume)
68 		return soc->ops->bus_ops->bus_resume(soc, pdev_id);
69 	return QDF_STATUS_E_NOSUPPORT;
70 }
71 
72 #endif /* _CDP_TXRX_BUS_H_ */
73