hw-ops.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,
  31. u32 link)
  32. {
  33. ath9k_hw_ops(ah)->set_desc_link(ds, link);
  34. }
  35. static inline void ath9k_hw_get_desc_link(struct ath_hw *ah, void *ds,
  36. u32 **link)
  37. {
  38. ath9k_hw_ops(ah)->get_desc_link(ds, link);
  39. }
  40. static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
  41. struct ath9k_channel *chan,
  42. u8 rxchainmask,
  43. bool longcal)
  44. {
  45. return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
  46. }
  47. static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
  48. {
  49. return ath9k_hw_ops(ah)->get_isr(ah, masked);
  50. }
  51. /* Private hardware call ops */
  52. /* PHY ops */
  53. static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
  54. struct ath9k_channel *chan)
  55. {
  56. return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
  57. }
  58. static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
  59. struct ath9k_channel *chan)
  60. {
  61. ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
  62. }
  63. static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  64. {
  65. if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
  66. return 0;
  67. return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
  68. }
  69. static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  70. {
  71. if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
  72. return;
  73. ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
  74. }
  75. static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
  76. struct ath9k_channel *chan,
  77. u16 modesIndex)
  78. {
  79. if (!ath9k_hw_private_ops(ah)->set_rf_regs)
  80. return true;
  81. return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
  82. }
  83. static inline void ath9k_hw_init_bb(struct ath_hw *ah,
  84. struct ath9k_channel *chan)
  85. {
  86. return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
  87. }
  88. static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
  89. struct ath9k_channel *chan)
  90. {
  91. return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
  92. }
  93. static inline int ath9k_hw_process_ini(struct ath_hw *ah,
  94. struct ath9k_channel *chan)
  95. {
  96. return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
  97. }
  98. static inline void ath9k_olc_init(struct ath_hw *ah)
  99. {
  100. if (!ath9k_hw_private_ops(ah)->olc_init)
  101. return;
  102. return ath9k_hw_private_ops(ah)->olc_init(ah);
  103. }
  104. static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
  105. struct ath9k_channel *chan)
  106. {
  107. return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
  108. }
  109. static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
  110. {
  111. return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
  112. }
  113. static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
  114. struct ath9k_channel *chan)
  115. {
  116. return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
  117. }
  118. static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
  119. {
  120. return ath9k_hw_private_ops(ah)->rfbus_req(ah);
  121. }
  122. static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
  123. {
  124. return ath9k_hw_private_ops(ah)->rfbus_done(ah);
  125. }
  126. static inline void ath9k_enable_rfkill(struct ath_hw *ah)
  127. {
  128. return ath9k_hw_private_ops(ah)->enable_rfkill(ah);
  129. }
  130. static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
  131. {
  132. if (!ath9k_hw_private_ops(ah)->restore_chainmask)
  133. return;
  134. return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
  135. }
  136. static inline void ath9k_hw_set_diversity(struct ath_hw *ah, bool value)
  137. {
  138. return ath9k_hw_private_ops(ah)->set_diversity(ah, value);
  139. }
  140. static inline bool ath9k_hw_ani_control(struct ath_hw *ah,
  141. enum ath9k_ani_cmd cmd, int param)
  142. {
  143. return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param);
  144. }
  145. static inline void ath9k_hw_do_getnf(struct ath_hw *ah,
  146. int16_t nfarray[NUM_NF_READINGS])
  147. {
  148. ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray);
  149. }
  150. static inline bool ath9k_hw_init_cal(struct ath_hw *ah,
  151. struct ath9k_channel *chan)
  152. {
  153. return ath9k_hw_private_ops(ah)->init_cal(ah, chan);
  154. }
  155. static inline void ath9k_hw_setup_calibration(struct ath_hw *ah,
  156. struct ath9k_cal_list *currCal)
  157. {
  158. ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
  159. }
  160. static inline bool ath9k_hw_iscal_supported(struct ath_hw *ah,
  161. enum ath9k_cal_types calType)
  162. {
  163. return ath9k_hw_private_ops(ah)->iscal_supported(ah, calType);
  164. }
  165. #endif /* ATH9K_HW_OPS_H */