hw-ops.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * Copyright (c) 2010-2011 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. bool power_off)
  22. {
  23. if (!ah->aspm_enabled)
  24. return;
  25. ath9k_hw_ops(ah)->config_pci_powersave(ah, power_off);
  26. }
  27. static inline void ath9k_hw_rxena(struct ath_hw *ah)
  28. {
  29. ath9k_hw_ops(ah)->rx_enable(ah);
  30. }
  31. static inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds,
  32. u32 link)
  33. {
  34. ath9k_hw_ops(ah)->set_desc_link(ds, link);
  35. }
  36. static inline bool ath9k_hw_calibrate(struct ath_hw *ah,
  37. struct ath9k_channel *chan,
  38. u8 rxchainmask,
  39. bool longcal)
  40. {
  41. return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal);
  42. }
  43. static inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
  44. {
  45. return ath9k_hw_ops(ah)->get_isr(ah, masked);
  46. }
  47. static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds,
  48. struct ath_tx_info *i)
  49. {
  50. return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i);
  51. }
  52. static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds,
  53. struct ath_tx_status *ts)
  54. {
  55. return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
  56. }
  57. static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
  58. struct ath_hw_antcomb_conf *antconf)
  59. {
  60. ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
  61. }
  62. static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
  63. struct ath_hw_antcomb_conf *antconf)
  64. {
  65. ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
  66. }
  67. static inline void ath9k_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah,
  68. bool enable)
  69. {
  70. if (ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv)
  71. ath9k_hw_ops(ah)->antctrl_shared_chain_lnadiv(ah, enable);
  72. }
  73. /* Private hardware call ops */
  74. /* PHY ops */
  75. static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
  76. struct ath9k_channel *chan)
  77. {
  78. return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
  79. }
  80. static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
  81. struct ath9k_channel *chan)
  82. {
  83. ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
  84. }
  85. static inline int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah)
  86. {
  87. if (!ath9k_hw_private_ops(ah)->rf_alloc_ext_banks)
  88. return 0;
  89. return ath9k_hw_private_ops(ah)->rf_alloc_ext_banks(ah);
  90. }
  91. static inline void ath9k_hw_rf_free_ext_banks(struct ath_hw *ah)
  92. {
  93. if (!ath9k_hw_private_ops(ah)->rf_free_ext_banks)
  94. return;
  95. ath9k_hw_private_ops(ah)->rf_free_ext_banks(ah);
  96. }
  97. static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
  98. struct ath9k_channel *chan,
  99. u16 modesIndex)
  100. {
  101. if (!ath9k_hw_private_ops(ah)->set_rf_regs)
  102. return true;
  103. return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
  104. }
  105. static inline void ath9k_hw_init_bb(struct ath_hw *ah,
  106. struct ath9k_channel *chan)
  107. {
  108. return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
  109. }
  110. static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
  111. struct ath9k_channel *chan)
  112. {
  113. return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
  114. }
  115. static inline int ath9k_hw_process_ini(struct ath_hw *ah,
  116. struct ath9k_channel *chan)
  117. {
  118. return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
  119. }
  120. static inline void ath9k_olc_init(struct ath_hw *ah)
  121. {
  122. if (!ath9k_hw_private_ops(ah)->olc_init)
  123. return;
  124. return ath9k_hw_private_ops(ah)->olc_init(ah);
  125. }
  126. static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
  127. struct ath9k_channel *chan)
  128. {
  129. return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
  130. }
  131. static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
  132. {
  133. return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
  134. }
  135. static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
  136. struct ath9k_channel *chan)
  137. {
  138. return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
  139. }
  140. static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
  141. {
  142. return ath9k_hw_private_ops(ah)->rfbus_req(ah);
  143. }
  144. static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
  145. {
  146. return ath9k_hw_private_ops(ah)->rfbus_done(ah);
  147. }
  148. static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
  149. {
  150. if (!ath9k_hw_private_ops(ah)->restore_chainmask)
  151. return;
  152. return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
  153. }
  154. static inline bool ath9k_hw_ani_control(struct ath_hw *ah,
  155. enum ath9k_ani_cmd cmd, int param)
  156. {
  157. return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param);
  158. }
  159. static inline void ath9k_hw_do_getnf(struct ath_hw *ah,
  160. int16_t nfarray[NUM_NF_READINGS])
  161. {
  162. ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray);
  163. }
  164. static inline bool ath9k_hw_init_cal(struct ath_hw *ah,
  165. struct ath9k_channel *chan)
  166. {
  167. return ath9k_hw_private_ops(ah)->init_cal(ah, chan);
  168. }
  169. static inline void ath9k_hw_setup_calibration(struct ath_hw *ah,
  170. struct ath9k_cal_list *currCal)
  171. {
  172. ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
  173. }
  174. static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah,
  175. struct ath9k_channel *chan,
  176. u8 *ini_reloaded)
  177. {
  178. return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan,
  179. ini_reloaded);
  180. }
  181. static inline void ath9k_hw_set_radar_params(struct ath_hw *ah)
  182. {
  183. if (!ath9k_hw_private_ops(ah)->set_radar_params)
  184. return;
  185. ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf);
  186. }
  187. #endif /* ATH9K_HW_OPS_H */