hw-ops.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (c) 2010 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ATH9K_HW_OPS_H
  17. #define ATH9K_HW_OPS_H
  18. #include "hw.h"
  19. /* Hardware core and driver accessible callbacks */
  20. static inline void ath9k_hw_configpcipowersave(struct ath_hw *ah,
  21. int restore,
  22. int power_off)
  23. {
  24. ath9k_hw_ops(ah)->config_pci_powersave(ah, restore, power_off);
  25. }
  26. /* Private hardware call ops */
  27. /* PHY ops */
  28. static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
  29. struct ath9k_channel *chan)
  30. {
  31. return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
  32. }
  33. static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
  34. struct ath9k_channel *chan)
  35. {
  36. ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
  37. }
  38. static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  39. {
  40. if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
  41. return 0;
  42. return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
  43. }
  44. static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  45. {
  46. if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
  47. return;
  48. ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
  49. }
  50. static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
  51. struct ath9k_channel *chan,
  52. u16 modesIndex)
  53. {
  54. if (!ath9k_hw_private_ops(ah)->set_rf_regs)
  55. return true;
  56. return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
  57. }
  58. static inline void ath9k_hw_init_bb(struct ath_hw *ah,
  59. struct ath9k_channel *chan)
  60. {
  61. return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
  62. }
  63. static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
  64. struct ath9k_channel *chan)
  65. {
  66. return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
  67. }
  68. static inline int ath9k_hw_process_ini(struct ath_hw *ah,
  69. struct ath9k_channel *chan)
  70. {
  71. return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
  72. }
  73. static inline void ath9k_olc_init(struct ath_hw *ah)
  74. {
  75. if (!ath9k_hw_private_ops(ah)->olc_init)
  76. return;
  77. return ath9k_hw_private_ops(ah)->olc_init(ah);
  78. }
  79. static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
  80. struct ath9k_channel *chan)
  81. {
  82. return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
  83. }
  84. static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
  85. {
  86. return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
  87. }
  88. static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
  89. struct ath9k_channel *chan)
  90. {
  91. return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
  92. }
  93. static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
  94. {
  95. return ath9k_hw_private_ops(ah)->rfbus_req(ah);
  96. }
  97. static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
  98. {
  99. return ath9k_hw_private_ops(ah)->rfbus_done(ah);
  100. }
  101. static inline void ath9k_enable_rfkill(struct ath_hw *ah)
  102. {
  103. return ath9k_hw_private_ops(ah)->enable_rfkill(ah);
  104. }
  105. static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
  106. {
  107. if (!ath9k_hw_private_ops(ah)->restore_chainmask)
  108. return;
  109. return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
  110. }
  111. static inline void ath9k_hw_set_diversity(struct ath_hw *ah, bool value)
  112. {
  113. return ath9k_hw_private_ops(ah)->set_diversity(ah, value);
  114. }
  115. #endif /* ATH9K_HW_OPS_H */