xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_tx_throttle.h (revision 503663c6daafffe652fa360bde17243568cd6d2a)
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_tx_throttle.h
21  * @brief Define the host data path transmit throttle API
22  * functions called by the host control SW and the OS interface
23  * module
24  */
25 #ifndef _CDP_TXRX_TX_THROTTLE_H_
26 #define _CDP_TXRX_TX_THROTTLE_H_
27 #include <cdp_txrx_ops.h>
28 #include "cdp_txrx_handle.h"
29 /**
30  * cdp_throttle_init_period() - init tx throttle period
31  * @soc: data path soc handle
32  * @pdev_id: id of data path pdev handle
33  * @period: throttle period
34  * @dutycycle_level: duty cycle level
35  *
36  * Return: NONE
37  */
38 static inline void
39 cdp_throttle_init_period(ol_txrx_soc_handle soc, uint8_t pdev_id,
40 			 int period, uint8_t *dutycycle_level)
41 {
42 	if (!soc || !soc->ops || !soc->ops->throttle_ops) {
43 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
44 			"%s invalid instance", __func__);
45 		return;
46 	}
47 
48 	if (soc->ops->throttle_ops->throttle_init_period)
49 		return soc->ops->throttle_ops->throttle_init_period(
50 					soc, pdev_id, period, dutycycle_level);
51 	return;
52 }
53 
54 /**
55  * cdp_throttle_init_period() - init tx throttle period
56  * @soc: data path soc handle
57  * @pdev_id: id of data path pdev handle
58  * @level: throttle level
59  *
60  * Return: NONE
61  */
62 static inline void
63 cdp_throttle_set_level(ol_txrx_soc_handle soc, uint8_t pdev_id, int level)
64 {
65 	if (!soc || !soc->ops || !soc->ops->throttle_ops) {
66 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
67 			"%s invalid instance", __func__);
68 		return;
69 	}
70 
71 	if (soc->ops->throttle_ops->throttle_set_level)
72 		return soc->ops->throttle_ops->throttle_set_level(soc, pdev_id,
73 								  level);
74 	return;
75 }
76 
77 #endif /* _CDP_TXRX_TX_THROTTLE_H_ */
78