hw-ops.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. static inline void ath9k_hw_rxena(struct ath_hw *ah)
  27. {
  28. ath9k_hw_ops(ah)->rx_enable(ah);
  29. }
  30. /* Private hardware call ops */
  31. /* PHY ops */
  32. static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
  33. struct ath9k_channel *chan)
  34. {
  35. return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
  36. }
  37. static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
  38. struct ath9k_channel *chan)
  39. {
  40. ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
  41. }
  42. static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  43. {
  44. if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
  45. return 0;
  46. return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
  47. }
  48. static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  49. {
  50. if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
  51. return;
  52. ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
  53. }
  54. static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
  55. struct ath9k_channel *chan,
  56. u16 modesIndex)
  57. {
  58. if (!ath9k_hw_private_ops(ah)->set_rf_regs)
  59. return true;
  60. return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
  61. }
  62. static inline void ath9k_hw_init_bb(struct ath_hw *ah,
  63. struct ath9k_channel *chan)
  64. {
  65. return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
  66. }
  67. static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
  68. struct ath9k_channel *chan)
  69. {
  70. return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
  71. }
  72. static inline int ath9k_hw_process_ini(struct ath_hw *ah,
  73. struct ath9k_channel *chan)
  74. {
  75. return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
  76. }
  77. static inline void ath9k_olc_init(struct ath_hw *ah)
  78. {
  79. if (!ath9k_hw_private_ops(ah)->olc_init)
  80. return;
  81. return ath9k_hw_private_ops(ah)->olc_init(ah);
  82. }
  83. static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
  84. struct ath9k_channel *chan)
  85. {
  86. return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
  87. }
  88. static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
  89. {
  90. return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
  91. }
  92. static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
  93. struct ath9k_channel *chan)
  94. {
  95. return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
  96. }
  97. static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
  98. {
  99. return ath9k_hw_private_ops(ah)->rfbus_req(ah);
  100. }
  101. static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
  102. {
  103. return ath9k_hw_private_ops(ah)->rfbus_done(ah);
  104. }
  105. static inline void ath9k_enable_rfkill(struct ath_hw *ah)
  106. {
  107. return ath9k_hw_private_ops(ah)->enable_rfkill(ah);
  108. }
  109. static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
  110. {
  111. if (!ath9k_hw_private_ops(ah)->restore_chainmask)
  112. return;
  113. return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
  114. }
  115. static inline void ath9k_hw_set_diversity(struct ath_hw *ah, bool value)
  116. {
  117. return ath9k_hw_private_ops(ah)->set_diversity(ah, value);
  118. }
  119. #endif /* ATH9K_HW_OPS_H */