cdp_txrx_tx_throttle.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * DOC: cdp_txrx_tx_throttle.h
  21. * 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. if (soc->ops->throttle_ops->throttle_init_period)
  48. return soc->ops->throttle_ops->throttle_init_period(
  49. soc, pdev_id, period, dutycycle_level);
  50. return;
  51. }
  52. /**
  53. * cdp_throttle_set_level() - init tx throttle level
  54. * @soc: data path soc handle
  55. * @pdev_id: id of data path pdev handle
  56. * @level: throttle level
  57. *
  58. * Return: NONE
  59. */
  60. static inline void
  61. cdp_throttle_set_level(ol_txrx_soc_handle soc, uint8_t pdev_id, int level)
  62. {
  63. if (!soc || !soc->ops || !soc->ops->throttle_ops) {
  64. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  65. "%s invalid instance", __func__);
  66. return;
  67. }
  68. if (soc->ops->throttle_ops->throttle_set_level)
  69. return soc->ops->throttle_ops->throttle_set_level(soc, pdev_id,
  70. level);
  71. return;
  72. }
  73. #endif /* _CDP_TXRX_TX_THROTTLE_H_ */