hw-ops.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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. u32 *sync_cause_p)
  45. {
  46. return ath9k_hw_ops(ah)->get_isr(ah, masked, sync_cause_p);
  47. }
  48. static inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds,
  49. struct ath_tx_info *i)
  50. {
  51. return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i);
  52. }
  53. static inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds,
  54. struct ath_tx_status *ts)
  55. {
  56. return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts);
  57. }
  58. static inline int ath9k_hw_get_duration(struct ath_hw *ah, const void *ds,
  59. int index)
  60. {
  61. return ath9k_hw_ops(ah)->get_duration(ah, ds, index);
  62. }
  63. static inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah,
  64. struct ath_hw_antcomb_conf *antconf)
  65. {
  66. ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf);
  67. }
  68. static inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah,
  69. struct ath_hw_antcomb_conf *antconf)
  70. {
  71. ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf);
  72. }
  73. static inline void ath9k_hw_tx99_start(struct ath_hw *ah, u32 qnum)
  74. {
  75. ath9k_hw_ops(ah)->tx99_start(ah, qnum);
  76. }
  77. static inline void ath9k_hw_tx99_stop(struct ath_hw *ah)
  78. {
  79. ath9k_hw_ops(ah)->tx99_stop(ah);
  80. }
  81. static inline void ath9k_hw_tx99_set_txpower(struct ath_hw *ah, u8 power)
  82. {
  83. if (ath9k_hw_ops(ah)->tx99_set_txpower)
  84. ath9k_hw_ops(ah)->tx99_set_txpower(ah, power);
  85. }
  86. #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
  87. static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
  88. {
  89. if (ath9k_hw_ops(ah)->set_bt_ant_diversity)
  90. ath9k_hw_ops(ah)->set_bt_ant_diversity(ah, enable);
  91. }
  92. #endif
  93. /* Private hardware call ops */
  94. static inline void ath9k_hw_init_hang_checks(struct ath_hw *ah)
  95. {
  96. ath9k_hw_private_ops(ah)->init_hang_checks(ah);
  97. }
  98. static inline bool ath9k_hw_detect_mac_hang(struct ath_hw *ah)
  99. {
  100. return ath9k_hw_private_ops(ah)->detect_mac_hang(ah);
  101. }
  102. static inline bool ath9k_hw_detect_bb_hang(struct ath_hw *ah)
  103. {
  104. return ath9k_hw_private_ops(ah)->detect_bb_hang(ah);
  105. }
  106. /* PHY ops */
  107. static inline int ath9k_hw_rf_set_freq(struct ath_hw *ah,
  108. struct ath9k_channel *chan)
  109. {
  110. return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan);
  111. }
  112. static inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah,
  113. struct ath9k_channel *chan)
  114. {
  115. ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan);
  116. }
  117. static inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
  118. struct ath9k_channel *chan,
  119. u16 modesIndex)
  120. {
  121. if (!ath9k_hw_private_ops(ah)->set_rf_regs)
  122. return true;
  123. return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex);
  124. }
  125. static inline void ath9k_hw_init_bb(struct ath_hw *ah,
  126. struct ath9k_channel *chan)
  127. {
  128. return ath9k_hw_private_ops(ah)->init_bb(ah, chan);
  129. }
  130. static inline void ath9k_hw_set_channel_regs(struct ath_hw *ah,
  131. struct ath9k_channel *chan)
  132. {
  133. return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan);
  134. }
  135. static inline int ath9k_hw_process_ini(struct ath_hw *ah,
  136. struct ath9k_channel *chan)
  137. {
  138. return ath9k_hw_private_ops(ah)->process_ini(ah, chan);
  139. }
  140. static inline void ath9k_olc_init(struct ath_hw *ah)
  141. {
  142. if (!ath9k_hw_private_ops(ah)->olc_init)
  143. return;
  144. return ath9k_hw_private_ops(ah)->olc_init(ah);
  145. }
  146. static inline void ath9k_hw_set_rfmode(struct ath_hw *ah,
  147. struct ath9k_channel *chan)
  148. {
  149. return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan);
  150. }
  151. static inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
  152. {
  153. return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah);
  154. }
  155. static inline void ath9k_hw_set_delta_slope(struct ath_hw *ah,
  156. struct ath9k_channel *chan)
  157. {
  158. return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan);
  159. }
  160. static inline bool ath9k_hw_rfbus_req(struct ath_hw *ah)
  161. {
  162. return ath9k_hw_private_ops(ah)->rfbus_req(ah);
  163. }
  164. static inline void ath9k_hw_rfbus_done(struct ath_hw *ah)
  165. {
  166. return ath9k_hw_private_ops(ah)->rfbus_done(ah);
  167. }
  168. static inline void ath9k_hw_restore_chainmask(struct ath_hw *ah)
  169. {
  170. if (!ath9k_hw_private_ops(ah)->restore_chainmask)
  171. return;
  172. return ath9k_hw_private_ops(ah)->restore_chainmask(ah);
  173. }
  174. static inline bool ath9k_hw_ani_control(struct ath_hw *ah,
  175. enum ath9k_ani_cmd cmd, int param)
  176. {
  177. return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param);
  178. }
  179. static inline void ath9k_hw_do_getnf(struct ath_hw *ah,
  180. int16_t nfarray[NUM_NF_READINGS])
  181. {
  182. ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray);
  183. }
  184. static inline bool ath9k_hw_init_cal(struct ath_hw *ah,
  185. struct ath9k_channel *chan)
  186. {
  187. return ath9k_hw_private_ops(ah)->init_cal(ah, chan);
  188. }
  189. static inline void ath9k_hw_setup_calibration(struct ath_hw *ah,
  190. struct ath9k_cal_list *currCal)
  191. {
  192. ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal);
  193. }
  194. static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah,
  195. struct ath9k_channel *chan,
  196. u8 *ini_reloaded)
  197. {
  198. return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan,
  199. ini_reloaded);
  200. }
  201. static inline void ath9k_hw_set_radar_params(struct ath_hw *ah)
  202. {
  203. if (!ath9k_hw_private_ops(ah)->set_radar_params)
  204. return;
  205. ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf);
  206. }
  207. static inline void ath9k_hw_init_cal_settings(struct ath_hw *ah)
  208. {
  209. ath9k_hw_private_ops(ah)->init_cal_settings(ah);
  210. }
  211. static inline u32 ath9k_hw_compute_pll_control(struct ath_hw *ah,
  212. struct ath9k_channel *chan)
  213. {
  214. return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan);
  215. }
  216. static inline void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
  217. {
  218. if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs)
  219. return;
  220. ath9k_hw_private_ops(ah)->init_mode_gain_regs(ah);
  221. }
  222. static inline void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah)
  223. {
  224. if (!ath9k_hw_private_ops(ah)->ani_cache_ini_regs)
  225. return;
  226. ath9k_hw_private_ops(ah)->ani_cache_ini_regs(ah);
  227. }
  228. #endif /* ATH9K_HW_OPS_H */