1 /* 2 * Copyright (c) 2016-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 * @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 /** 73 * cdp_process_wow_ack() - Process wow ack response 74 * @soc: data path soc handle 75 * @pdev_id: id of dp pdev handle 76 * 77 * Do any required data path operations for target wow ack 78 * suspend response. 79 * 80 * Return: None 81 */ 82 static inline void cdp_process_wow_ack_rsp(ol_txrx_soc_handle soc, 83 uint8_t pdev_id) 84 { 85 if (!soc || !soc->ops || !soc->ops->bus_ops) { 86 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 87 "%s invalid instance", __func__); 88 return; 89 } 90 91 if (soc->ops->bus_ops->process_wow_ack_rsp) 92 return soc->ops->bus_ops->process_wow_ack_rsp(soc, pdev_id); 93 } 94 95 /** 96 * cdp_process_target_suspend_req() - Process target suspend request 97 * @soc: data path soc handle 98 * @pdev_id: id of dp pdev handle 99 * 100 * Complete the datapath specific work before target suspend 101 * 102 * Return: None 103 */ 104 static inline void cdp_process_target_suspend_req(ol_txrx_soc_handle soc, 105 uint8_t pdev_id) 106 { 107 if (!soc || !soc->ops || !soc->ops->bus_ops) { 108 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, 109 "%s invalid instance", __func__); 110 return; 111 } 112 113 if (soc->ops->bus_ops->process_target_suspend_req) 114 return soc->ops->bus_ops->process_target_suspend_req(soc, 115 pdev_id); 116 } 117 #endif /* _CDP_TXRX_BUS_H_ */ 118