18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (c) 2010-2011 Atheros Communications Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any 58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above 68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies. 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#ifndef ATH9K_HW_OPS_H 188c2ecf20Sopenharmony_ci#define ATH9K_HW_OPS_H 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "hw.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* Hardware core and driver accessible callbacks */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_cistatic inline void ath9k_hw_configpcipowersave(struct ath_hw *ah, 258c2ecf20Sopenharmony_ci bool power_off) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci if (!ah->aspm_enabled) 288c2ecf20Sopenharmony_ci return; 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->config_pci_powersave(ah, power_off); 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic inline void ath9k_hw_rxena(struct ath_hw *ah) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->rx_enable(ah); 368c2ecf20Sopenharmony_ci} 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_desc_link(struct ath_hw *ah, void *ds, 398c2ecf20Sopenharmony_ci u32 link) 408c2ecf20Sopenharmony_ci{ 418c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->set_desc_link(ds, link); 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic inline int ath9k_hw_calibrate(struct ath_hw *ah, 458c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 468c2ecf20Sopenharmony_ci u8 rxchainmask, bool longcal) 478c2ecf20Sopenharmony_ci{ 488c2ecf20Sopenharmony_ci return ath9k_hw_ops(ah)->calibrate(ah, chan, rxchainmask, longcal); 498c2ecf20Sopenharmony_ci} 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked, 528c2ecf20Sopenharmony_ci u32 *sync_cause_p) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci return ath9k_hw_ops(ah)->get_isr(ah, masked, sync_cause_p); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_txdesc(struct ath_hw *ah, void *ds, 588c2ecf20Sopenharmony_ci struct ath_tx_info *i) 598c2ecf20Sopenharmony_ci{ 608c2ecf20Sopenharmony_ci return ath9k_hw_ops(ah)->set_txdesc(ah, ds, i); 618c2ecf20Sopenharmony_ci} 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cistatic inline int ath9k_hw_txprocdesc(struct ath_hw *ah, void *ds, 648c2ecf20Sopenharmony_ci struct ath_tx_status *ts) 658c2ecf20Sopenharmony_ci{ 668c2ecf20Sopenharmony_ci return ath9k_hw_ops(ah)->proc_txdesc(ah, ds, ts); 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistatic inline int ath9k_hw_get_duration(struct ath_hw *ah, const void *ds, 708c2ecf20Sopenharmony_ci int index) 718c2ecf20Sopenharmony_ci{ 728c2ecf20Sopenharmony_ci return ath9k_hw_ops(ah)->get_duration(ah, ds, index); 738c2ecf20Sopenharmony_ci} 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistatic inline void ath9k_hw_antdiv_comb_conf_get(struct ath_hw *ah, 768c2ecf20Sopenharmony_ci struct ath_hw_antcomb_conf *antconf) 778c2ecf20Sopenharmony_ci{ 788c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->antdiv_comb_conf_get(ah, antconf); 798c2ecf20Sopenharmony_ci} 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic inline void ath9k_hw_antdiv_comb_conf_set(struct ath_hw *ah, 828c2ecf20Sopenharmony_ci struct ath_hw_antcomb_conf *antconf) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->antdiv_comb_conf_set(ah, antconf); 858c2ecf20Sopenharmony_ci} 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic inline void ath9k_hw_tx99_start(struct ath_hw *ah, u32 qnum) 888c2ecf20Sopenharmony_ci{ 898c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->tx99_start(ah, qnum); 908c2ecf20Sopenharmony_ci} 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_cistatic inline void ath9k_hw_tx99_stop(struct ath_hw *ah) 938c2ecf20Sopenharmony_ci{ 948c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->tx99_stop(ah); 958c2ecf20Sopenharmony_ci} 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic inline void ath9k_hw_tx99_set_txpower(struct ath_hw *ah, u8 power) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci if (ath9k_hw_ops(ah)->tx99_set_txpower) 1008c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->tx99_set_txpower(ah, power); 1018c2ecf20Sopenharmony_ci} 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable) 1068c2ecf20Sopenharmony_ci{ 1078c2ecf20Sopenharmony_ci if (ath9k_hw_ops(ah)->set_bt_ant_diversity) 1088c2ecf20Sopenharmony_ci ath9k_hw_ops(ah)->set_bt_ant_diversity(ah, enable); 1098c2ecf20Sopenharmony_ci} 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_is_aic_enabled(struct ath_hw *ah) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci if (ath9k_hw_private_ops(ah)->is_aic_enabled) 1148c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->is_aic_enabled(ah); 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci return false; 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#endif 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* Private hardware call ops */ 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_cistatic inline void ath9k_hw_init_hang_checks(struct ath_hw *ah) 1248c2ecf20Sopenharmony_ci{ 1258c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->init_hang_checks(ah); 1268c2ecf20Sopenharmony_ci} 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_detect_mac_hang(struct ath_hw *ah) 1298c2ecf20Sopenharmony_ci{ 1308c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->detect_mac_hang(ah); 1318c2ecf20Sopenharmony_ci} 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_detect_bb_hang(struct ath_hw *ah) 1348c2ecf20Sopenharmony_ci{ 1358c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->detect_bb_hang(ah); 1368c2ecf20Sopenharmony_ci} 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci/* PHY ops */ 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistatic inline int ath9k_hw_rf_set_freq(struct ath_hw *ah, 1418c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1428c2ecf20Sopenharmony_ci{ 1438c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->rf_set_freq(ah, chan); 1448c2ecf20Sopenharmony_ci} 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cistatic inline void ath9k_hw_spur_mitigate_freq(struct ath_hw *ah, 1478c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1488c2ecf20Sopenharmony_ci{ 1498c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->spur_mitigate_freq(ah, chan); 1508c2ecf20Sopenharmony_ci} 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_set_rf_regs(struct ath_hw *ah, 1538c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 1548c2ecf20Sopenharmony_ci u16 modesIndex) 1558c2ecf20Sopenharmony_ci{ 1568c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->set_rf_regs) 1578c2ecf20Sopenharmony_ci return true; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->set_rf_regs(ah, chan, modesIndex); 1608c2ecf20Sopenharmony_ci} 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_cistatic inline void ath9k_hw_init_bb(struct ath_hw *ah, 1638c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1648c2ecf20Sopenharmony_ci{ 1658c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->init_bb(ah, chan); 1668c2ecf20Sopenharmony_ci} 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_channel_regs(struct ath_hw *ah, 1698c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1708c2ecf20Sopenharmony_ci{ 1718c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->set_channel_regs(ah, chan); 1728c2ecf20Sopenharmony_ci} 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistatic inline int ath9k_hw_process_ini(struct ath_hw *ah, 1758c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1768c2ecf20Sopenharmony_ci{ 1778c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->process_ini(ah, chan); 1788c2ecf20Sopenharmony_ci} 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_cistatic inline void ath9k_olc_init(struct ath_hw *ah) 1818c2ecf20Sopenharmony_ci{ 1828c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->olc_init) 1838c2ecf20Sopenharmony_ci return; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->olc_init(ah); 1868c2ecf20Sopenharmony_ci} 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_rfmode(struct ath_hw *ah, 1898c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 1908c2ecf20Sopenharmony_ci{ 1918c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->set_rfmode(ah, chan); 1928c2ecf20Sopenharmony_ci} 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistatic inline void ath9k_hw_mark_phy_inactive(struct ath_hw *ah) 1958c2ecf20Sopenharmony_ci{ 1968c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->mark_phy_inactive(ah); 1978c2ecf20Sopenharmony_ci} 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_delta_slope(struct ath_hw *ah, 2008c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 2018c2ecf20Sopenharmony_ci{ 2028c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->set_delta_slope(ah, chan); 2038c2ecf20Sopenharmony_ci} 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_rfbus_req(struct ath_hw *ah) 2068c2ecf20Sopenharmony_ci{ 2078c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->rfbus_req(ah); 2088c2ecf20Sopenharmony_ci} 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_cistatic inline void ath9k_hw_rfbus_done(struct ath_hw *ah) 2118c2ecf20Sopenharmony_ci{ 2128c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->rfbus_done(ah); 2138c2ecf20Sopenharmony_ci} 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_cistatic inline void ath9k_hw_restore_chainmask(struct ath_hw *ah) 2168c2ecf20Sopenharmony_ci{ 2178c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->restore_chainmask) 2188c2ecf20Sopenharmony_ci return; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->restore_chainmask(ah); 2218c2ecf20Sopenharmony_ci} 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_ani_control(struct ath_hw *ah, 2248c2ecf20Sopenharmony_ci enum ath9k_ani_cmd cmd, int param) 2258c2ecf20Sopenharmony_ci{ 2268c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->ani_control(ah, cmd, param); 2278c2ecf20Sopenharmony_ci} 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_cistatic inline void ath9k_hw_do_getnf(struct ath_hw *ah, 2308c2ecf20Sopenharmony_ci int16_t nfarray[NUM_NF_READINGS]) 2318c2ecf20Sopenharmony_ci{ 2328c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->do_getnf(ah, nfarray); 2338c2ecf20Sopenharmony_ci} 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_cistatic inline bool ath9k_hw_init_cal(struct ath_hw *ah, 2368c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 2378c2ecf20Sopenharmony_ci{ 2388c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->init_cal(ah, chan); 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_cistatic inline void ath9k_hw_setup_calibration(struct ath_hw *ah, 2428c2ecf20Sopenharmony_ci struct ath9k_cal_list *currCal) 2438c2ecf20Sopenharmony_ci{ 2448c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->setup_calibration(ah, currCal); 2458c2ecf20Sopenharmony_ci} 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistatic inline int ath9k_hw_fast_chan_change(struct ath_hw *ah, 2488c2ecf20Sopenharmony_ci struct ath9k_channel *chan, 2498c2ecf20Sopenharmony_ci u8 *ini_reloaded) 2508c2ecf20Sopenharmony_ci{ 2518c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan, 2528c2ecf20Sopenharmony_ci ini_reloaded); 2538c2ecf20Sopenharmony_ci} 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_cistatic inline void ath9k_hw_set_radar_params(struct ath_hw *ah) 2568c2ecf20Sopenharmony_ci{ 2578c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->set_radar_params) 2588c2ecf20Sopenharmony_ci return; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf); 2618c2ecf20Sopenharmony_ci} 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistatic inline void ath9k_hw_init_cal_settings(struct ath_hw *ah) 2648c2ecf20Sopenharmony_ci{ 2658c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->init_cal_settings(ah); 2668c2ecf20Sopenharmony_ci} 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_cistatic inline u32 ath9k_hw_compute_pll_control(struct ath_hw *ah, 2698c2ecf20Sopenharmony_ci struct ath9k_channel *chan) 2708c2ecf20Sopenharmony_ci{ 2718c2ecf20Sopenharmony_ci return ath9k_hw_private_ops(ah)->compute_pll_control(ah, chan); 2728c2ecf20Sopenharmony_ci} 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_cistatic inline void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah) 2758c2ecf20Sopenharmony_ci{ 2768c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->init_mode_gain_regs) 2778c2ecf20Sopenharmony_ci return; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->init_mode_gain_regs(ah); 2808c2ecf20Sopenharmony_ci} 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistatic inline void ath9k_hw_ani_cache_ini_regs(struct ath_hw *ah) 2838c2ecf20Sopenharmony_ci{ 2848c2ecf20Sopenharmony_ci if (!ath9k_hw_private_ops(ah)->ani_cache_ini_regs) 2858c2ecf20Sopenharmony_ci return; 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci ath9k_hw_private_ops(ah)->ani_cache_ini_regs(ah); 2888c2ecf20Sopenharmony_ci} 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci#endif /* ATH9K_HW_OPS_H */ 291