cdp_txrx_tx_throttle.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2016-2017 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: physical device instance
  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, struct cdp_pdev *pdev,
  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(pdev,
  48. period, dutycycle_level);
  49. return;
  50. }
  51. /**
  52. * cdp_throttle_init_period() - init tx throttle period
  53. * @soc: data path soc handle
  54. * @pdev: physical device instance
  55. * @level: throttle level
  56. *
  57. * Return: NONE
  58. */
  59. static inline void
  60. cdp_throttle_set_level(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, 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(pdev, level);
  69. return;
  70. }
  71. #endif /* _CDP_TXRX_TX_THROTTLE_H_ */