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