xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_tx_throttle.h (revision 928e3ecad0fabf5320100a0d8fbde785757aa071)
1 /*
2  * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27  /**
28  * @file cdp_txrx_tx_throttle.h
29  * @brief Define the host data path transmit throttle API
30  * functions called by the host control SW and the OS interface
31  * module
32  */
33 #ifndef _CDP_TXRX_TX_THROTTLE_H_
34 #define _CDP_TXRX_TX_THROTTLE_H_
35 #include <cdp_txrx_ops.h>
36 #include "cdp_txrx_handle.h"
37 /**
38  * cdp_throttle_init_period() - init tx throttle period
39  * @soc: data path soc handle
40  * @pdev: physical device instance
41  * @period: throttle period
42  * @dutycycle_level: duty cycle level
43  *
44  * Return: NONE
45  */
46 static inline void
47 cdp_throttle_init_period(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
48 		int period, uint8_t *dutycycle_level)
49 {
50 	if (!soc || !soc->ops || !soc->ops->throttle_ops) {
51 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
52 			"%s invalid instance", __func__);
53 		return;
54 	}
55 
56 	if (soc->ops->throttle_ops->throttle_init_period)
57 		return soc->ops->throttle_ops->throttle_init_period(pdev,
58 				period, dutycycle_level);
59 	return;
60 }
61 
62 /**
63  * cdp_throttle_init_period() - init tx throttle period
64  * @soc: data path soc handle
65  * @pdev: physical device instance
66  * @level: throttle level
67  *
68  * Return: NONE
69  */
70 static inline void
71 cdp_throttle_set_level(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int level)
72 {
73 	if (!soc || !soc->ops || !soc->ops->throttle_ops) {
74 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
75 			"%s invalid instance", __func__);
76 		return;
77 	}
78 
79 	if (soc->ops->throttle_ops->throttle_set_level)
80 		return soc->ops->throttle_ops->throttle_set_level(pdev, level);
81 	return;
82 }
83 
84 #endif /* _CDP_TXRX_TX_THROTTLE_H_ */
85