cdp_txrx_tx_throttle.h 2.3 KB

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