ath9k: cleanups to help other core drivers
cover ath9k: cleanups to help other core drivers
We want the common hardware access stuff to not rely on a specific driver core. We want this so that different driver cores can share the same hw code, both for ath9k_htc and perhaps ath5k. I've spotted a few places where we do use ath_softc internally on hw code, and have strated to move core-specific code out and kept hw-related code apart. This series addreses DPRINTF() usage and btcoex changes.
There'll be more of these, until we can bring up ath9k_htc with shared code.
Luis R. Rodriguez (15):
ath9k: use ath_hw for DPRINTF() and debug init/exit
ath9k: move btcoex core driver info to its own struct
ath9k: move hw specific btcoex info to ath_hw
ath9k: split bluetooth hardware coex init into two helpers
ath9k: move driver core helpers to main.c
ath9k: split ath9k_hw_btcoex_enable() into two helpers
ath9k: replaces SC_OP_BTCOEX_ENABLED with a bool
ath9k: move bt_stomp_type to driver core
ath9k: remove unused bt_duty_cycle
ath9k: rename btcoex_scheme to just scheme
ath9k: rename ath_btcoex_info to ath_btcoex_hw
ath9k: simplify ath_btcoex_bt_stomp()
ath9k: now move ath9k_hw_btcoex_set_weight() to btcoex.c
ath9k: move ath_btcoex_config and ath_bt_mode to btcoex.c
ath9k: rename ath_btcoex_supported() to ath9k_hw_btcoex_supported()
drivers/net/wireless/ath/ath9k/ahb.c | 2 +- drivers/net/wireless/ath/ath9k/ani.c | 44 ++-- drivers/net/wireless/ath/ath9k/ath9k.h | 24 ++- drivers/net/wireless/ath/ath9k/beacon.c | 32 +- drivers/net/wireless/ath/ath9k/btcoex.c | 375 ++++++++---------------- drivers/net/wireless/ath/ath9k/btcoex.h | 64 +---- drivers/net/wireless/ath/ath9k/calib.c | 102 ++++---- drivers/net/wireless/ath/ath9k/debug.c | 16 +- drivers/net/wireless/ath/ath9k/debug.h | 15 +- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 24 +- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 24 +- drivers/net/wireless/ath/ath9k/eeprom_def.c | 24 +- drivers/net/wireless/ath/ath9k/hw.c | 139 +++++----- drivers/net/wireless/ath/ath9k/hw.h | 4 + drivers/net/wireless/ath/ath9k/mac.c | 48 ++-- drivers/net/wireless/ath/ath9k/main.c | 399 +++++++++++++++++++------- drivers/net/wireless/ath/ath9k/phy.c | 10 +- drivers/net/wireless/ath/ath9k/rc.c | 15 +- drivers/net/wireless/ath/ath9k/recv.c | 18 +- drivers/net/wireless/ath/ath9k/xmit.c | 46 ++-- 20 files changed, 750 insertions(+), 675 deletions(-)
PATCH 1/15 ath9k: use ath_hw for DPRINTF() and debug init/exit
DPRINTF() is used in hw specific related code, as such ensure we don't rely on the private driver core ath_softc struct when calling it. Drivers can then implement their own DPRINTF() as they see fit.
--- drivers/net/wireless/ath/ath9k/ahb.c | 2 +- drivers/net/wireless/ath/ath9k/ani.c | 44 ++++---- drivers/net/wireless/ath/ath9k/beacon.c | 32 +++--- drivers/net/wireless/ath/ath9k/btcoex.c | 8 +- drivers/net/wireless/ath/ath9k/calib.c | 102 +++++++++--------- drivers/net/wireless/ath/ath9k/debug.c | 16 ++- drivers/net/wireless/ath/ath9k/debug.h | 15 ++- drivers/net/wireless/ath/ath9k/eeprom_4k.c | 24 ++-- drivers/net/wireless/ath/ath9k/eeprom_9287.c | 24 ++-- drivers/net/wireless/ath/ath9k/eeprom_def.c | 24 ++-- drivers/net/wireless/ath/ath9k/hw.c | 120 +++++++++++----------- drivers/net/wireless/ath/ath9k/mac.c | 48 ++++---- drivers/net/wireless/ath/ath9k/main.c | 148 +++++++++++++------------- drivers/net/wireless/ath/ath9k/phy.c | 10 +- drivers/net/wireless/ath/ath9k/rc.c | 15 ++- drivers/net/wireless/ath/ath9k/recv.c | 18 ++-- drivers/net/wireless/ath/ath9k/xmit.c | 46 ++++---- 17 files changed, 356 insertions(+), 340 deletions(-)
drivers/net/wireless/ath/ath9k/ahb.c +1 -1
@@ -40,7 +40,7 @@ static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data) pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;if (off >= (ARRAY_SIZE (pdata->eeprom_data))) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"%s: flash read failed, offset %08x is out of range\n" , __func__, off);return false;
drivers/net/wireless/ath/ath9k/ani.c +22 -22
159 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/beacon.c +16 -16
@@ -42,7 +42,7 @@ static int ath_beaconq_config(struct ath_softc *sc) }if (!ath9k_hw_set_txq_props (ah, sc->beacon.beaconq, &qi)) { -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Unable to update h/w beacon queue parameters\n" );return 0 ; }else {
@@ -172,7 +172,7 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,if (unlikely (dma_mapping_error (sc->dev, bf->bf_buf_addr))) {dev_kfree_skb_any (skb); bf->bf_mpdu =NULL ; -DPRINTF (sc,ATH_DBG_FATAL ,"dma_mapping_error on beaconing\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"dma_mapping_error on beaconing\n" );return NULL ; }
@@ -192,7 +192,7 @@ static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,if (skb && cabq_depth) {if (sc->nvifs >1 ) { -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"Flushing previous cabq traffic\n" );ath_draintxq (sc, cabq, false); }
@@ -233,7 +233,7 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc,/* NB: caller is known to have already stopped tx dma */ ath9k_hw_puttxbuf (ah, sc->beacon.beaconq, bf->bf_daddr);ath9k_hw_txstart (ah, sc->beacon.beaconq); -DPRINTF (sc,ATH_DBG_BEACON ,"TXDP%u = %llx (%p)\n" , +DPRINTF (ah,ATH_DBG_BEACON ,"TXDP%u = %llx (%p)\n" , sc->beacon.beaconq,ito64 (bf->bf_daddr), bf->bf_desc); }
@@ -309,7 +309,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)/* NB: the beacon data buffer must be 32-bit aligned. */ skb =ieee80211_beacon_get (sc->hw, vif);if (skb ==NULL ) { -DPRINTF (sc,ATH_DBG_BEACON ,"cannot get skb\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"cannot get skb\n" );return -ENOMEM ; }
@@ -333,7 +333,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) tsfadjust = intval * avp->av_bslot /ATH_BCBUF ; avp->tsf_adjust =cpu_to_le64 (TU_TO_USEC (tsfadjust)); -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"stagger beacons, bslot %d intval %u tsfadjust %llu\n" , avp->av_bslot, intval, (unsigned long long )tsfadjust);
@@ -349,7 +349,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)if (unlikely (dma_mapping_error (sc->dev, bf->bf_buf_addr))) {dev_kfree_skb_any (skb); bf->bf_mpdu =NULL ; -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"dma_mapping_error on beacon alloc\n" );return -ENOMEM ; }
@@ -405,11 +405,11 @@ void ath_beacon_tasklet(unsigned long data) sc->beacon.bmisscnt++;if (sc->beacon.bmisscnt <BSTUCK_THRESH ) { -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"missed %u consecutive beacons\n" , sc->beacon.bmisscnt); }else if (sc->beacon.bmisscnt >=BSTUCK_THRESH ) { -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"beacon is officially stuck\n" ); sc->sc_flags |=SC_OP_TSF_RESET ;ath_reset (sc, false);
@@ -419,7 +419,7 @@ void ath_beacon_tasklet(unsigned long data) }if (sc->beacon.bmisscnt !=0 ) { -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"resume beacon xmit after %u misses\n" , sc->beacon.bmisscnt); sc->beacon.bmisscnt =0 ;
@@ -447,7 +447,7 @@ void ath_beacon_tasklet(unsigned long data) vif = sc->beacon.bslot[slot]; aphy = sc->beacon.bslot_aphy[slot]; -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"slot %d [tsf %llu tsftu %u intval %u] vif %p\n" , slot, tsf, tsftu, intval, vif);
@@ -490,7 +490,7 @@ void ath_beacon_tasklet(unsigned long data)* are still pending on the queue. */ if (!ath9k_hw_stoptxdma (ah, sc->beacon.beaconq)) { -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"beacon queue %u did not stop?\n" , sc->beacon.beaconq); }
@@ -651,8 +651,8 @@ static void ath_beacon_config_sta(struct ath_softc *sc,/* TSF out of range threshold fixed at 1 second */ bs.bs_tsfoor_threshold =ATH9K_TSFOOR_THRESHOLD ; -DPRINTF (sc,ATH_DBG_BEACON ,"tsf: %llu tsftu: %u\n" , tsf, tsftu); -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"tsf: %llu tsftu: %u\n" , tsf, tsftu); +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"bmiss: %u sleep: %u cfp-period: %u maxdur: %u next: %u\n" , bs.bs_bmissthreshold, bs.bs_sleepduration, bs.bs_cfpperiod, bs.bs_cfpmaxduration, bs.bs_cfpnext);
@@ -689,7 +689,7 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc, nexttbtt += intval; }while (nexttbtt < tsftu); -DPRINTF (sc,ATH_DBG_BEACON , +DPRINTF (sc->sc_ah,ATH_DBG_BEACON ,"IBSS nexttbtt %u intval %u (%u)\n" , nexttbtt, intval, conf->beacon_interval);
@@ -759,7 +759,7 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)ath_beacon_config_sta (sc, cur_conf);break ;default : -DPRINTF (sc,ATH_DBG_CONFIG , +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG ,"Unsupported beaconing mode\n" );return ; }
drivers/net/wireless/ath/ath9k/btcoex.c +4 -4
@@ -56,7 +56,7 @@ static void ath_detect_bt_priority(struct ath_softc *sc)if (time_after (jiffies, btinfo->bt_priority_time +msecs_to_jiffies (ATH_BT_PRIORITY_TIME_THRESHOLD ))) {if (btinfo->bt_priority_cnt >=ATH_BT_CNT_THRESHOLD ) { -DPRINTF (sc,ATH_DBG_BTCOEX , +DPRINTF (sc->sc_ah,ATH_DBG_BTCOEX ,"BT priority traffic detected" ); sc->sc_flags |=SC_OP_BT_PRIORITY_DETECTED ; }else {
@@ -90,7 +90,7 @@ static void ath_btcoex_bt_stomp(struct ath_softc *sc, AR_STOMP_NONE_WLAN_WGHT);break ;default : -DPRINTF (sc,ATH_DBG_BTCOEX ,"Invalid Stomptype\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_BTCOEX ,"Invalid Stomptype\n" );break ; }
@@ -142,7 +142,7 @@ static void ath_btcoex_no_stomp_timer(void *arg)struct ath_softc *sc = (struct ath_softc *)arg;struct ath_btcoex_info *btinfo = &sc->btcoex_info; -DPRINTF (sc,ATH_DBG_BTCOEX ,"no stomp timer running \n" ); +DPRINTF (sc->sc_ah,ATH_DBG_BTCOEX ,"no stomp timer running \n" );spin_lock_bh (&btinfo->btcoex_lock);
@@ -326,7 +326,7 @@ void ath_btcoex_timer_resume(struct ath_softc *sc, struct ath_btcoex_info *btinfo) { -DPRINTF (sc,ATH_DBG_BTCOEX ,"Starting btcoex timers" ); +DPRINTF (sc->sc_ah,ATH_DBG_BTCOEX ,"Starting btcoex timers" );/* make sure duty cycle timer is also stopped when resuming */ if (btinfo->hw_timer_enabled)
drivers/net/wireless/ath/ath9k/calib.c +51 -51
339 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/debug.c +10 -6
@@ -23,12 +23,12 @@ module_param_named(debug, ath9k_debug, uint, 0);static struct dentry *ath9k_debugfs_root; -void DPRINTF (struct ath_softc *sc,int dbg_mask,const char *fmt, ...) +void DPRINTF (struct ath_hw *ah,int dbg_mask,const char *fmt, ...) { -if (!sc) +if (!ah->ah_sc)return ; -if (sc->debug.debug_mask & dbg_mask) { +if (ah->ah_sc->debug.debug_mask & dbg_mask) {va_list args;va_start (args, fmt);
@@ -568,8 +568,10 @@ static const struct file_operations fops_xmit = { .owner = THIS_MODULE }; -int ath9k_init_debug (struct ath_softc *sc) +int ath9k_init_debug (struct ath_hw *ah) { +struct ath_softc *sc = ah->ah_sc; + sc->debug.debug_mask = ath9k_debug;if (!ath9k_debugfs_root)
@@ -619,12 +621,14 @@ int ath9k_init_debug(struct ath_softc *sc)return 0 ; err: -ath9k_exit_debug (sc); +ath9k_exit_debug (ah);return -ENOMEM ; } -void ath9k_exit_debug (struct ath_softc *sc) +void ath9k_exit_debug (struct ath_hw *ah) { +struct ath_softc *sc = ah->ah_sc; +debugfs_remove (sc->debug.debugfs_xmit);debugfs_remove (sc->debug.debugfs_wiphy);debugfs_remove (sc->debug.debugfs_rcstat);
drivers/net/wireless/ath/ath9k/debug.h +9 -6
@@ -17,6 +17,8 @@#ifndef DEBUG_H #define DEBUG_H +#include "hw.h" +enum ATH_DEBUG {ATH_DBG_RESET =0x00000001 , ATH_DBG_QUEUE = 0x00000002,
@@ -151,9 +153,10 @@ struct ath9k_debug {struct ath_stats stats; }; -void DPRINTF (struct ath_softc *sc,int dbg_mask,const char *fmt, ...); -int ath9k_init_debug (struct ath_softc *sc); -void ath9k_exit_debug (struct ath_softc *sc); +void DPRINTF (struct ath_hw *ah,int dbg_mask,const char *fmt, ...); +int ath9k_init_debug (struct ath_hw *ah); +void ath9k_exit_debug (struct ath_hw *ah); +int ath9k_debug_create_root (void );void ath9k_debug_remove_root (void );void ath_debug_stat_interrupt (struct ath_softc *sc,enum ath9k_int status);
@@ -165,17 +168,17 @@ void ath_debug_stat_retries(struct ath_softc *sc, int rix,#else -static inline void DPRINTF (struct ath_softc *sc,int dbg_mask, +static inline void DPRINTF (struct ath_hw *ah,int dbg_mask,const char *fmt, ...) { } -static inline int ath9k_init_debug (struct ath_softc *sc) +static inline int ath9k_init_debug (struct ath_hw *ah) {return 0 ; } -static inline void ath9k_exit_debug (struct ath_softc *sc) +static inline void ath9k_exit_debug (struct ath_hw *ah) { }
drivers/net/wireless/ath/ath9k/eeprom_4k.c +12 -12
@@ -35,13 +35,13 @@ static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah) eep_start_loc =64 ;if (!ath9k_hw_use_flash (ah)) { -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Reading from EEPROM, not flash\n" ); }for (addr =0 ; addr <SIZE_EEPROM_4K ; addr++) {if (!ath9k_hw_nvram_read (ah, addr + eep_start_loc, eep_data)) { -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Unable to read eeprom region \n" );return false; }
@@ -66,12 +66,12 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)if (!ath9k_hw_use_flash (ah)) {if (!ath9k_hw_nvram_read (ah,AR5416_EEPROM_MAGIC_OFFSET , &magic)) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Reading Magic # failed\n" );return false; } -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Read Magic = 0x%04X\n" , magic);if (magic !=AR5416_EEPROM_MAGIC ) {
@@ -87,7 +87,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) eepdata++; } }else { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Invalid EEPROM Magic. " "endianness mismatch.\n" );return -EINVAL ;
@@ -95,7 +95,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) } } -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM ,"need_swap = %s.\n" , +DPRINTF (ah,ATH_DBG_EEPROM ,"need_swap = %s.\n" , need_swap ?"True" :"False" );if (need_swap)
@@ -117,7 +117,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)u32 integer;u16 word; -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"EEPROM Endianness is not native.. Changing\n" ); word =swab16 (eep->baseEepHeader.length);
@@ -160,7 +160,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)if (sum !=0xffff || ah->eep_ops->get_eeprom_ver (ah) !=AR5416_EEP_VER || ah->eep_ops->get_eeprom_rev (ah) <AR5416_EEP_NO_BACK_VER ) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Bad EEPROM checksum 0x%x or revision 0x%04x\n" , sum, ah->eep_ops->get_eeprom_ver (ah));return -EINVAL ;
@@ -470,11 +470,11 @@ static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, ((pdadcValues[4 * j +3 ] &0xFF ) <<24 );REG_WRITE (ah, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC (%d,%4x): %4.4x %8.8x\n" , i, regChainOffset, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC: Chain %d | " "PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
@@ -1151,7 +1151,7 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)u16 spur_val =AR_NO_SPUR ; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur idx %d is2Ghz. %d val %x\n" , i, is2GHz, ah->config.spurchans[i][is2GHz]);
@@ -1160,7 +1160,7 @@ static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)break ;case SPUR_ENABLE_IOCTL : spur_val = ah->config.spurchans[i][is2GHz]; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur val from new loc. %d\n" , spur_val);break ;case SPUR_ENABLE_EEPROM :
drivers/net/wireless/ath/ath9k/eeprom_9287.c +12 -12
@@ -34,14 +34,14 @@ static bool ath9k_hw_AR9287_fill_eeprom(struct ath_hw *ah) eep_data = (u16 *)eep;if (!ath9k_hw_use_flash (ah)) { -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Reading from EEPROM, not flash\n" ); }for (addr =0 ; addr <sizeof (struct ar9287_eeprom ) /sizeof (u16); addr++) {if (!ath9k_hw_nvram_read (ah, addr + eep_start_loc, eep_data)) { -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Unable to read eeprom region \n" );return false; }
@@ -61,12 +61,12 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)if (!ath9k_hw_use_flash (ah)) {if (!ath9k_hw_nvram_read (ah,AR5416_EEPROM_MAGIC_OFFSET , &magic)) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Reading Magic # failed\n" );return false; } -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Read Magic = 0x%04X\n" , magic);if (magic !=AR5416_EEPROM_MAGIC ) { magic2 =swab16 (magic);
@@ -83,14 +83,14 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah) eepdata++; } }else { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Invalid EEPROM Magic. " "endianness mismatch.\n" );return -EINVAL ; } } } -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM ,"need_swap = %s.\n" , need_swap ? +DPRINTF (ah,ATH_DBG_EEPROM ,"need_swap = %s.\n" , need_swap ?"True" :"False" );if (need_swap)
@@ -148,7 +148,7 @@ static int ath9k_hw_AR9287_check_eeprom(struct ath_hw *ah)if (sum !=0xffff || ah->eep_ops->get_eeprom_ver (ah) !=AR9287_EEP_VER || ah->eep_ops->get_eeprom_rev (ah) <AR5416_EEP_NO_BACK_VER ) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Bad EEPROM checksum 0x%x or revision 0x%04x\n" , sum, ah->eep_ops->get_eeprom_ver (ah));return -EINVAL ;
@@ -564,12 +564,12 @@ static void ath9k_hw_set_AR9287_power_cal_table(struct ath_hw *ah, & 0xFF) << 24) ;REG_WRITE (ah, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC (%d,%4x): %4.4x %8.8x\n" , i, regChainOffset, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC: Chain %d | " "PDADC %3d Value %3d | " "PDADC %3d Value %3d | "
@@ -966,7 +966,7 @@ static void ath9k_hw_AR9287_set_txpower(struct ath_hw *ah,INCREASE_MAXPOW_BY_THREE_CHAIN ;break ;default : -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Invalid chainmask configuration\n" );break ; }
@@ -1140,7 +1140,7 @@ static u16 ath9k_hw_AR9287_get_spur_channel(struct ath_hw *ah, (ah->eeprom.map9287.modalHeader.spurChans[i].spurChan)u16 spur_val =AR_NO_SPUR ; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur idx %d is2Ghz. %d val %x\n" , i, is2GHz, ah->config.spurchans[i][is2GHz]);
@@ -1149,7 +1149,7 @@ static u16 ath9k_hw_AR9287_get_spur_channel(struct ath_hw *ah,break ;case SPUR_ENABLE_IOCTL : spur_val = ah->config.spurchans[i][is2GHz]; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur val from new loc. %d\n" , spur_val);break ;case SPUR_ENABLE_EEPROM :
drivers/net/wireless/ath/ath9k/eeprom_def.c +12 -12
@@ -95,7 +95,7 @@ static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah)for (addr =0 ; addr <SIZE_EEPROM_DEF ; addr++) {if (!ath9k_hw_nvram_read (ah, addr + ar5416_eep_start_loc, eep_data)) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Unable to read eeprom region\n" );return false; }
@@ -115,12 +115,12 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)int i, addr, size;if (!ath9k_hw_nvram_read (ah,AR5416_EEPROM_MAGIC_OFFSET , &magic)) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL ,"Reading Magic # failed\n" ); +DPRINTF (ah,ATH_DBG_FATAL ,"Reading Magic # failed\n" );return false; }if (!ath9k_hw_use_flash (ah)) { -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Read Magic = 0x%04X\n" , magic);if (magic !=AR5416_EEPROM_MAGIC ) {
@@ -137,7 +137,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) eepdata++; } }else { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Invalid EEPROM Magic. " "Endianness mismatch.\n" );return -EINVAL ;
@@ -145,7 +145,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah) } } -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM ,"need_swap = %s.\n" , +DPRINTF (ah,ATH_DBG_EEPROM ,"need_swap = %s.\n" , need_swap ?"True" :"False" );if (need_swap)
@@ -167,7 +167,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)u32 integer, j;u16 word; -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"EEPROM Endianness is not native.. Changing.\n" ); word =swab16 (eep->baseEepHeader.length);
@@ -214,7 +214,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)if (sum !=0xffff || ah->eep_ops->get_eeprom_ver (ah) !=AR5416_EEP_VER || ah->eep_ops->get_eeprom_rev (ah) <AR5416_EEP_NO_BACK_VER ) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Bad EEPROM checksum 0x%x or revision 0x%04x\n" , sum, ah->eep_ops->get_eeprom_ver (ah));return -EINVAL ;
@@ -868,11 +868,11 @@ static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, ((pdadcValues[4 * j +3 ] &0xFF ) <<24 );REG_WRITE (ah, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC (%d,%4x): %4.4x %8.8x\n" , i, regChainOffset, regOffset, reg32); -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"PDADC: Chain %d | PDADC %3d " "Value %3d | PDADC %3d Value %3d | " "PDADC %3d Value %3d | PDADC %3d "
@@ -1309,7 +1309,7 @@ static void ath9k_hw_def_set_txpower(struct ath_hw *ah, regulatory->max_power_level +=INCREASE_MAXPOW_BY_THREE_CHAIN ;break ;default : -DPRINTF (ah->ah_sc,ATH_DBG_EEPROM , +DPRINTF (ah,ATH_DBG_EEPROM ,"Invalid chainmask configuration\n" );break ; }
@@ -1350,7 +1350,7 @@ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)u16 spur_val =AR_NO_SPUR ; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur idx %d is2Ghz. %d val %x\n" , i, is2GHz, ah->config.spurchans[i][is2GHz]);
@@ -1359,7 +1359,7 @@ static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)break ;case SPUR_ENABLE_IOCTL : spur_val = ah->config.spurchans[i][is2GHz]; -DPRINTF (ah->ah_sc,ATH_DBG_ANI , +DPRINTF (ah,ATH_DBG_ANI ,"Getting spur val from new loc. %d\n" , spur_val);break ;case SPUR_ENABLE_EEPROM :
drivers/net/wireless/ath/ath9k/hw.c +60 -60
443 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/mac.c +24 -24
179 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/main.c +76 -72
540 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/phy.c +5 -5
@@ -46,7 +46,7 @@ ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) channelSel = ((freq -704 ) *2 -3040 ) /10 ; bModeSynth =1 ; }else { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Invalid channel %u MHz\n" , freq);return false; }
@@ -79,7 +79,7 @@ ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan) channelSel =ath9k_hw_reverse_bits ((freq -4800 ) /5 ,8 ); aModeRefSel =ath9k_hw_reverse_bits (1 ,2 ); }else { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Invalid channel %u MHz\n" , freq);return false; }
@@ -315,7 +315,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) || ah->analogBank6Data == NULL || ah->analogBank6TPCData == NULL || ah->analogBank7Data == NULL) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Cannot allocate RF banks\n" ); *status = -ENOMEM ;return false;
@@ -326,7 +326,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status) ah->iniAddac.ia_rows * ah->iniAddac.ia_columns), GFP_KERNEL);if (ah->addac5416_21 ==NULL ) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Cannot allocate addac5416_21\n" ); *status = -ENOMEM ;return false;
@@ -336,7 +336,7 @@ bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)kzalloc ((sizeof (u32) * ah->iniBank6.ia_rows),GFP_KERNEL );if (ah->bank6Temp ==NULL ) { -DPRINTF (ah->ah_sc,ATH_DBG_FATAL , +DPRINTF (ah,ATH_DBG_FATAL ,"Cannot allocate bank6Temp\n" ); *status = -ENOMEM ;return false;
drivers/net/wireless/ath/ath9k/rc.c +9 -6
@@ -1177,13 +1177,14 @@ struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, mode =ATH9K_MODE_11NA_HT40PLUS ;break ;default : -DPRINTF (sc,ATH_DBG_CONFIG ,"Invalid band\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG ,"Invalid band\n" );return NULL ; }BUG_ON (mode >=ATH9K_MODE_MAX ); -DPRINTF (sc,ATH_DBG_CONFIG ,"Choosing rate table for mode: %d\n" , mode); +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG , +"Choosing rate table for mode: %d\n" , mode);return sc->hw_rate_table[mode]; }
@@ -1198,7 +1199,8 @@ static void ath_rc_init(struct ath_softc *sc,u8 i, j, k, hi =0 , hthi =0 ;if (!rate_table) { -DPRINTF (sc,ATH_DBG_FATAL ,"Rate table not initialized\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_FATAL , +"Rate table not initialized\n" );return ; }
@@ -1261,7 +1263,8 @@ static void ath_rc_init(struct ath_softc *sc, ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4 ]; sc->cur_rate_table = rate_table; -DPRINTF (sc,ATH_DBG_CONFIG ,"RC Initialized with capabilities: 0x%x\n" , +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG , +"RC Initialized with capabilities: 0x%x\n" , ath_rc_priv->ht_cap); }
@@ -1438,7 +1441,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, oper_cw40, oper_sgi40);ath_rc_init (sc, priv_sta, sband, sta, rate_table); -DPRINTF (sc,ATH_DBG_CONFIG , +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG ,"Operating HT Bandwidth changed to: %d\n" , sc->hw->conf.channel_type); }
@@ -1463,7 +1466,7 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp rate_priv =kzalloc (sizeof (struct ath_rate_priv ), gfp);if (!rate_priv) { -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"Unable to allocate private rc structure\n" );return NULL ; }
drivers/net/wireless/ath/ath9k/recv.c +9 -9
@@ -306,7 +306,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) sc->rx.bufsize =roundup (IEEE80211_MAX_MPDU_LEN ,min (sc->common.cachelsz, (u16 )64 )); -DPRINTF (sc,ATH_DBG_CONFIG ,"cachelsz %u rxbufsize %u\n" , +DPRINTF (sc->sc_ah,ATH_DBG_CONFIG ,"cachelsz %u rxbufsize %u\n" , sc->common.cachelsz, sc->rx.bufsize);/* Initialize rx descriptors */
@@ -314,7 +314,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) error =ath_descdma_setup (sc, &sc->rx.rxdma, &sc->rx.rxbuf,"rx" , nbufs,1 );if (error !=0 ) { -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"failed to allocate rx descriptors: %d\n" , error); goto err; }
@@ -334,7 +334,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) bf->bf_buf_addr))) {dev_kfree_skb_any (skb); bf->bf_mpdu =NULL ; -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"dma_mapping_error() on RX init\n" ); error = -ENOMEM ; goto err;
@@ -539,7 +539,7 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)if (sc->sc_flags &SC_OP_BEACON_SYNC ) { sc->sc_flags &= ~SC_OP_BEACON_SYNC ; -DPRINTF (sc,ATH_DBG_PS ,"Reconfigure Beacon timers based on " +DPRINTF (sc->sc_ah,ATH_DBG_PS ,"Reconfigure Beacon timers based on " "timestamp from the AP\n" );ath_beacon_config (sc,NULL ); }
@@ -552,7 +552,7 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)* a backup trigger for returning into NETWORK SLEEP state, * so we are waiting for it as well. */ -DPRINTF (sc,ATH_DBG_PS ,"Received DTIM beacon indicating " +DPRINTF (sc->sc_ah,ATH_DBG_PS ,"Received DTIM beacon indicating " "buffered broadcast/multicast frame(s)\n" ); sc->sc_flags |=SC_OP_WAIT_FOR_CAB |SC_OP_WAIT_FOR_BEACON ;return ;
@@ -565,7 +565,7 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)* been delivered. */ sc->sc_flags &= ~SC_OP_WAIT_FOR_CAB ; -DPRINTF (sc,ATH_DBG_PS ,"PS wait for CAB frames timed out\n" ); +DPRINTF (sc->sc_ah,ATH_DBG_PS ,"PS wait for CAB frames timed out\n" ); } }
@@ -589,13 +589,13 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb)* point. */ sc->sc_flags &= ~SC_OP_WAIT_FOR_CAB ; -DPRINTF (sc,ATH_DBG_PS ,"All PS CAB frames received, back to " +DPRINTF (sc->sc_ah,ATH_DBG_PS ,"All PS CAB frames received, back to " "sleep\n" ); }else if ((sc->sc_flags &SC_OP_WAIT_FOR_PSPOLL_DATA ) && !is_multicast_ether_addr (hdr->addr1) && !ieee80211_has_morefrags (hdr->frame_control)) { sc->sc_flags &= ~SC_OP_WAIT_FOR_PSPOLL_DATA ; - DPRINTF(sc, ATH_DBG_PS, "Going back to sleep after having " + DPRINTF(sc->sc_ah, ATH_DBG_PS, "Going back to sleep after having " "received PS-Poll data (0x%x)\n", sc->sc_flags & (SC_OP_WAIT_FOR_BEACON | SC_OP_WAIT_FOR_CAB |
@@ -811,7 +811,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) bf->bf_buf_addr))) {dev_kfree_skb_any (requeue_skb); bf->bf_mpdu =NULL ; -DPRINTF (sc,ATH_DBG_FATAL , +DPRINTF (sc->sc_ah,ATH_DBG_FATAL ,"dma_mapping_error() on RX\n" );ath_rx_send_to_mac80211 (sc, skb, &rx_status);break ;
drivers/net/wireless/ath/ath9k/xmit.c +24 -22
168 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 2/15 ath9k: move btcoex core driver info to its own struct
In reply to Luis R. RodriguezThere is some bluetooth coexistance data which is driver specific, stuff that into its own structure.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 11 +++++ drivers/net/wireless/ath/ath9k/btcoex.c | 73 ++++++++++++++++--------------- drivers/net/wireless/ath/ath9k/btcoex.h | 16 ++----- drivers/net/wireless/ath/ath9k/main.c | 4 +- 4 files changed, 55 insertions(+), 49 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +11 -0
@@ -451,6 +451,16 @@ struct ath_ani {struct timer_list timer; }; +struct ath_btcoex { +bool hw_timer_enabled; +spinlock_t btcoex_lock; +struct timer_list period_timer;/* Timer for BT period */ +u32 bt_priority_cnt; +unsigned long bt_priority_time; +u32 btcoex_no_stomp;/* in usec */ +u32 btcoex_period;/* in usec */ +}; +/********************/ /* LED Control */ /********************/
@@ -613,6 +623,7 @@ struct ath_softc {struct ath_beacon_config cur_beacon_conf;struct delayed_work tx_complete_work;struct ath_btcoex_info btcoex_info; +struct ath_btcoex btcoex; };struct ath_wiphy {
drivers/net/wireless/ath/ath9k/btcoex.c +38 -35
168 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/btcoex.h +4 -12
@@ -70,13 +70,6 @@ struct ath_btcoex_info {u32 bt_coex_mode;/* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_mode2;/* Register setting for AR_BT_COEX_MODE2 */ -u32 btcoex_no_stomp;/* in usec */ -u32 btcoex_period;/* in usec */ -u32 bt_priority_cnt; -unsigned long bt_priority_time; -bool hw_timer_enabled; -spinlock_t btcoex_lock; -struct timer_list period_timer;/* Timer for BT period */ struct ath_gen_timer *no_stomp_timer;/*Timer for no BT stomping*/ };
@@ -84,16 +77,15 @@ bool ath_btcoex_supported(u16 subsysid);int ath9k_hw_btcoex_init (struct ath_hw *ah);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah); -void ath_btcoex_timer_resume (struct ath_softc *sc, -struct ath_btcoex_info *btinfo); -void ath_btcoex_timer_pause (struct ath_softc *sc, -struct ath_btcoex_info *btinfo); + +void ath_btcoex_timer_resume (struct ath_softc *sc); +void ath_btcoex_timer_pause (struct ath_softc *sc);static inline void ath_btcoex_set_weight (struct ath_btcoex_info *btcoex_info,u32 bt_weight,u32 wlan_weight) { - btcoex_info->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) | + btcoex_info->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) |SM (wlan_weight,AR_BTCOEX_WL_WGHT ); }
drivers/net/wireless/ath/ath9k/main.c +2 -2
@@ -2017,7 +2017,7 @@ static int ath9k_start(struct ieee80211_hw *hw)ath_pcie_aspm_disable (sc);if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) -ath_btcoex_timer_resume (sc, &sc->btcoex_info); +ath_btcoex_timer_resume (sc); } mutex_unlock:
@@ -2156,7 +2156,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)if (sc->sc_flags &SC_OP_BTCOEX_ENABLED ) {ath9k_hw_btcoex_disable (sc->sc_ah);if (sc->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) -ath_btcoex_timer_pause (sc, &sc->btcoex_info); +ath_btcoex_timer_pause (sc); }/* make sure h/w will not generate any interrupt
Signature · 1 line
1.6.3.3
PATCH 3/15 ath9k: move hw specific btcoex info to ath_hw
In reply to Luis R. RodriguezSince we now access it via the ath_hw declare the ath_hw pointer at the header of some routines and se it. ath9k.h no longer needs to access btcoex.h and to adjust for this move ath_btcoex_set_weight() into btcoex.h and instead give main.c a helper for setting initial values upon drv_start()
--- drivers/net/wireless/ath/ath9k/ath9k.h | 2 - drivers/net/wireless/ath/ath9k/btcoex.c | 57 +++++++++++++++++-------- drivers/net/wireless/ath/ath9k/btcoex.h | 14 +----- drivers/net/wireless/ath/ath9k/hw.c | 3 +- drivers/net/wireless/ath/ath9k/hw.h | 7 +++ drivers/net/wireless/ath/ath9k/main.c | 70 +++++++++++++++++-------------- 6 files changed, 88 insertions(+), 65 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -2
@@ -26,7 +26,6 @@#include "rc.h" #include "debug.h" #include "../ath.h" -#include "btcoex.h" struct ath_node ;
@@ -622,7 +621,6 @@ struct ath_softc {struct ath_bus_ops *bus_ops;struct ath_beacon_config cur_beacon_conf;struct delayed_work tx_complete_work; -struct ath_btcoex_info btcoex_info;struct ath_btcoex btcoex; };
drivers/net/wireless/ath/ath9k/btcoex.c +38 -19
152 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/btcoex.h +3 -11
@@ -17,6 +17,8 @@#ifndef BTCOEX_H #define BTCOEX_H +#include "hw.h" +#define ATH_WLANACTIVE_GPIO 5#define ATH_BTACTIVE_GPIO 6#define ATH_BTPRIORITY_GPIO 7
@@ -74,19 +76,9 @@ struct ath_btcoex_info { };bool ath_btcoex_supported (u16 subsysid); +void ath9k_hw_btcoex_init_weight (struct ath_hw *ah);int ath9k_hw_btcoex_init (struct ath_hw *ah);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah); -void ath_btcoex_timer_resume (struct ath_softc *sc); -void ath_btcoex_timer_pause (struct ath_softc *sc); - -static inline void ath_btcoex_set_weight (struct ath_btcoex_info *btcoex_info, -u32 bt_weight, -u32 wlan_weight) -{ - btcoex_info->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) | -SM (wlan_weight,AR_BTCOEX_WL_WGHT ); -} -#endif
drivers/net/wireless/ath/ath9k/hw.c +2 -1
@@ -18,6 +18,7 @@#include <asm/unaligned.h> #include <linux/pci.h> +#include "hw.h" #include "ath9k.h" #include "initvals.h"
@@ -3510,7 +3511,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) {struct ath9k_hw_capabilities *pCap = &ah->caps;struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah); -struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info; +struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;u16 capField =0 , eeval;
drivers/net/wireless/ath/ath9k/hw.h +7 -0
@@ -27,6 +27,7 @@#include "calib.h" #include "reg.h" #include "phy.h" +#include "btcoex.h" #include "../regd.h"
@@ -553,6 +554,9 @@ struct ath_hw {int firpwr[5 ];enum ath9k_ani_cmd ani_function; +/* Bluetooth coexistance */ +struct ath_btcoex_info btcoex_info; +u32 intr_txqs;enum ath9k_ht_extprotspacing extprotspacing;u8 txchainmask;
@@ -675,4 +679,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);#define ATH_PCIE_CAP_LINK_L1 2void ath_pcie_aspm_disable (struct ath_softc *sc); + +void ath_btcoex_timer_resume (struct ath_softc *sc); +void ath_btcoex_timer_pause (struct ath_softc *sc);#endif
drivers/net/wireless/ath/ath9k/main.c +38 -32
211 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 4/15 ath9k: split bluetooth hardware coex init into two helpers
In reply to Luis R. RodriguezUse a helper for 2-wire and another for 3-wire.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 75 ++++++++++++++++++------------- 1 files changed, 44 insertions(+), 31 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +44 -31
@@ -225,48 +225,61 @@ static int ath_init_btcoex_info(struct ath_hw *ah,return 0 ; } -int ath9k_hw_btcoex_init (struct ath_hw *ah) +static void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah) {struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; -int ret =0 ; -if (btcoex_info->btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) { -/* connect bt_active to baseband */ -REG_CLR_BIT (ah,AR_GPIO_INPUT_EN_VAL , - (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | -AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF )); +/* connect bt_active to baseband */ +REG_CLR_BIT (ah,AR_GPIO_INPUT_EN_VAL , + (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF | +AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF )); -REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , -AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB ); +REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , +AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB ); -/* Set input mux for bt_active to gpio pin */ -REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , -AR_GPIO_INPUT_MUX1_BT_ACTIVE , - btcoex_info->btactive_gpio); +/* Set input mux for bt_active to gpio pin */ +REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , +AR_GPIO_INPUT_MUX1_BT_ACTIVE , + btcoex_info->btactive_gpio); -/* Configure the desired gpio port for input */ -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); - }else { -/* btcoex 3-wire */ -REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , - (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | -AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB )); +/* Configure the desired gpio port for input */ +ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); +} + +static void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah) +{ +struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; -/* Set input mux for bt_prority_async and -* bt_active_async to GPIO pins */ -REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , -AR_GPIO_INPUT_MUX1_BT_ACTIVE , - btcoex_info->btactive_gpio); +/* btcoex 3-wire */ +REG_SET_BIT (ah,AR_GPIO_INPUT_EN_VAL , + (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB | +AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB )); -REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , -AR_GPIO_INPUT_MUX1_BT_PRIORITY , - btcoex_info->btpriority_gpio); +/* Set input mux for bt_prority_async and +* bt_active_async to GPIO pins */ +REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , +AR_GPIO_INPUT_MUX1_BT_ACTIVE , + btcoex_info->btactive_gpio); -/* Configure the desired GPIO ports for input */ +REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 , +AR_GPIO_INPUT_MUX1_BT_PRIORITY , + btcoex_info->btpriority_gpio); -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btpriority_gpio); +/* Configure the desired GPIO ports for input */ + +ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); +ath9k_hw_cfg_gpio_input (ah, btcoex_info->btpriority_gpio); +} + +int ath9k_hw_btcoex_init (struct ath_hw *ah) +{ +struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +int ret =0 ; +if (btcoex_info->btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) +ath9k_hw_btcoex_init_2wire (ah); +else { +ath9k_hw_btcoex_init_3wire (ah); ret =ath_init_btcoex_info (ah, btcoex_info); }
Signature · 1 line
1.6.3.3
PATCH 5/15 ath9k: move driver core helpers to main.c
In reply to Luis R. RodriguezKeep on btcoex.c only hardware access helpers, move the driver core specific code to main.c. To accomplish this we had to split ath_init_btcoex_info() into two parts, the driver core part -- ath_init_btcoex_timer() and the hw specific part -- ath9k_hw_init_btcoex_hw_info(). This highlights how ath_gen_timer is part of the driver core, not hw related, so stuff that into ath_btcoex struct.
The ath9k_hw_btcoex_init() code is now put inline on ath_init_softc() through a switch to it easier to follow, since we did that we can now call ath_tx_get_qnum() from the main.c instead of btcoex.c
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/btcoex.c | 214 +------------------------------ drivers/net/wireless/ath/ath9k/btcoex.h | 7 +- drivers/net/wireless/ath/ath9k/hw.h | 3 - drivers/net/wireless/ath/ath9k/main.c | 215 ++++++++++++++++++++++++++++++- 5 files changed, 218 insertions(+), 222 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -458,6 +458,7 @@ struct ath_btcoex {unsigned long bt_priority_time;u32 btcoex_no_stomp;/* in usec */ u32 btcoex_period;/* in usec */ +struct ath_gen_timer *no_stomp_timer;/* Timer for no BT stomping */ };/********************/
drivers/net/wireless/ath/ath9k/btcoex.c +4 -210
247 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/btcoex.h +4 -3
@@ -72,13 +72,14 @@ struct ath_btcoex_info {u32 bt_coex_mode;/* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_mode2; /* Register setting for AR_BT_COEX_MODE2 */ - struct ath_gen_timer *no_stomp_timer; /*Timer for no BT stomping*/ };bool ath_btcoex_supported (u16 subsysid); -void ath9k_hw_btcoex_init_weight (struct ath_hw *ah); -int ath9k_hw_btcoex_init (struct ath_hw *ah); +void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah); +void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah); +void ath9k_hw_init_btcoex_hw_info (struct ath_hw *ah,int qnum);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah); +#endif
drivers/net/wireless/ath/ath9k/hw.h +0 -3
@@ -679,7 +679,4 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);#define ATH_PCIE_CAP_LINK_L1 2void ath_pcie_aspm_disable (struct ath_softc *sc); - -void ath_btcoex_timer_resume (struct ath_softc *sc); -void ath_btcoex_timer_pause (struct ath_softc *sc);#endif
drivers/net/wireless/ath/ath9k/main.c +209 -6
266 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 6/15 ath9k: split ath9k_hw_btcoex_enable() into two helpers
In reply to Luis R. RodriguezOne for 2-wire and another for 3-wire.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 57 ++++++++++++++++++++----------- 1 files changed, 37 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +37 -20
@@ -117,30 +117,47 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)ath9k_hw_cfg_gpio_input (ah, btcoex_info->btpriority_gpio); } +static void ath9k_hw_btcoex_enable_2wire (struct ath_hw *ah) +{ +struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; + +/* Configure the desired GPIO port for TX_FRAME output */ +ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, +AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ); +} + +static void ath9k_hw_btcoex_enable_3wire (struct ath_hw *ah) +{ +struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; + +/* +* Program coex mode and weight registers to +* enable coex 3-wire +*/ +REG_WRITE (ah,AR_BT_COEX_MODE , btcoex_info->bt_coex_mode); +REG_WRITE (ah,AR_BT_COEX_WEIGHT , btcoex_info->bt_coex_weights); +REG_WRITE (ah,AR_BT_COEX_MODE2 , btcoex_info->bt_coex_mode2); + +REG_RMW_FIELD (ah,AR_QUIET1 ,AR_QUIET1_QUIET_ACK_CTS_ENABLE ,1 ); +REG_RMW_FIELD (ah,AR_PCU_MISC ,AR_PCU_BT_ANT_PREVENT_RX ,0 ); + +ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, +AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL ); +} +void ath9k_hw_btcoex_enable (struct ath_hw *ah) {struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; -if (btcoex_info->btcoex_scheme ==ATH_BTCOEX_CFG_2WIRE ) { -/* Configure the desired GPIO port for TX_FRAME output */ -ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, -AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ); - }else { -/* -* Program coex mode and weight registers to -* enable coex 3-wire -*/ -REG_WRITE (ah,AR_BT_COEX_MODE , btcoex_info->bt_coex_mode); -REG_WRITE (ah,AR_BT_COEX_WEIGHT , btcoex_info->bt_coex_weights); -REG_WRITE (ah,AR_BT_COEX_MODE2 , btcoex_info->bt_coex_mode2); - -REG_RMW_FIELD (ah,AR_QUIET1 , -AR_QUIET1_QUIET_ACK_CTS_ENABLE ,1 ); -REG_RMW_FIELD (ah,AR_PCU_MISC , -AR_PCU_BT_ANT_PREVENT_RX ,0 ); - -ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, -AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL ); +switch (btcoex_info->btcoex_scheme) { +case ATH_BTCOEX_CFG_NONE : +break ; +case ATH_BTCOEX_CFG_2WIRE : +ath9k_hw_btcoex_enable_2wire (ah); +break ; +case ATH_BTCOEX_CFG_3WIRE : +ath9k_hw_btcoex_enable_3wire (ah); +break ; } REG_RMW(ah, AR_GPIO_PDPU,
Signature · 1 line
1.6.3.3
PATCH 7/15 ath9k: replaces SC_OP_BTCOEX_ENABLED with a bool
In reply to Luis R. RodriguezWhether or not bluetooth coex has been enabled is a hardware state and only the hardware helpers will be able to set this.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 - drivers/net/wireless/ath/ath9k/btcoex.c | 4 ++-- drivers/net/wireless/ath/ath9k/btcoex.h | 1 + drivers/net/wireless/ath/ath9k/hw.c | 2 +- drivers/net/wireless/ath/ath9k/main.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
@@ -532,7 +532,6 @@ struct ath_led {#define SC_OP_WAIT_FOR_PSPOLL_DATA BIT(17)#define SC_OP_WAIT_FOR_TX_ACK BIT(18)#define SC_OP_BEACON_SYNC BIT(19) -#define SC_OP_BTCOEX_ENABLED BIT(20)#define SC_OP_BT_PRIORITY_DETECTED BIT(21)struct ath_bus_ops {
drivers/net/wireless/ath/ath9k/btcoex.c +2 -2
@@ -164,7 +164,7 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah) (0x2 << (btcoex_info->btactive_gpio *2 )), (0x3 << (btcoex_info->btactive_gpio * 2))); - ah->ah_sc->sc_flags |=SC_OP_BTCOEX_ENABLED ; + ah->btcoex_info.enabled = true; }void ath9k_hw_btcoex_disable (struct ath_hw *ah)
@@ -182,5 +182,5 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)REG_WRITE (ah,AR_BT_COEX_MODE2 ,0 ); } - ah->ah_sc->sc_flags &= ~SC_OP_BTCOEX_ENABLED ; + ah->btcoex_info.enabled = false; }
drivers/net/wireless/ath/ath9k/btcoex.h +1 -0
@@ -64,6 +64,7 @@ struct ath_btcoex_config {struct ath_btcoex_info {enum ath_btcoex_scheme btcoex_scheme; +bool enabled;u8 wlanactive_gpio;u8 btactive_gpio;u8 btpriority_gpio;
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -2560,7 +2560,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,#endif } -if (ah->ah_sc->sc_flags &SC_OP_BTCOEX_ENABLED ) +if (ah->btcoex_info.enabled)ath9k_hw_btcoex_enable (ah);return 0 ;
drivers/net/wireless/ath/ath9k/main.c +2 -2
@@ -2203,7 +2203,7 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 );if ((ah->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE ) && - !(sc->sc_flags &SC_OP_BTCOEX_ENABLED )) { + !ah->btcoex_info.enabled) {ath9k_hw_btcoex_init_weight (ah);ath9k_hw_btcoex_enable (ah);
@@ -2362,7 +2362,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)return ;/* another wiphy still in use */ } -if (sc->sc_flags &SC_OP_BTCOEX_ENABLED ) { +if (ah->btcoex_info.enabled) {ath9k_hw_btcoex_disable (ah);if (ah->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE )ath9k_btcoex_timer_pause (sc);
Signature · 1 line
1.6.3.3
PATCH 8/15 ath9k: move bt_stomp_type to driver core
In reply to Luis R. RodriguezThe bt_stomp_type defines the bt coex weight, it has a one-to-one mapping. In the future we may want to just use the weight directly.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 9 +++++++++ drivers/net/wireless/ath/ath9k/btcoex.c | 2 -- drivers/net/wireless/ath/ath9k/btcoex.h | 8 -------- drivers/net/wireless/ath/ath9k/main.c | 7 ++++--- 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +9 -0
@@ -450,12 +450,21 @@ struct ath_ani {struct timer_list timer; }; +/* Defines the BT AR_BT_COEX_WGHT used */ +enum ath_stomp_type { +ATH_BTCOEX_NO_STOMP , +ATH_BTCOEX_STOMP_ALL , +ATH_BTCOEX_STOMP_LOW , +ATH_BTCOEX_STOMP_NONE +}; +struct ath_btcoex {bool hw_timer_enabled;spinlock_t btcoex_lock;struct timer_list period_timer;/* Timer for BT period */ u32 bt_priority_cnt;unsigned long bt_priority_time; +int bt_stomp_type;/* Types of BT stomping */ u32 btcoex_no_stomp;/* in usec */ u32 btcoex_period;/* in usec */ struct ath_gen_timer *no_stomp_timer;/* Timer for no BT stomping */
drivers/net/wireless/ath/ath9k/btcoex.c +0 -2
@@ -65,8 +65,6 @@ void ath9k_hw_init_btcoex_hw_info(struct ath_hw *ah, int qnum)SM (ATH_BTCOEX_BMISS_THRESH ,AR_BT_BCN_MISS_THRESH ) |AR_BT_DISABLE_BT_ANT ; - btcoex_info->bt_stomp_type =ATH_BTCOEX_STOMP_LOW ; -for (i =0 ; i <32 ; i++) ah->hw_gen_timers.gen_timer_index[(debruijn32 << i) >>27 ] = i; }
drivers/net/wireless/ath/ath9k/btcoex.h +0 -8
@@ -36,13 +36,6 @@ enum ath_btcoex_scheme { ATH_BTCOEX_CFG_3WIRE, }; -enum ath_stomp_type { -ATH_BTCOEX_NO_STOMP , -ATH_BTCOEX_STOMP_ALL , -ATH_BTCOEX_STOMP_LOW , -ATH_BTCOEX_STOMP_NONE -}; -enum ath_bt_mode {ATH_BT_COEX_MODE_LEGACY ,/* legacy rx_clear mode */ ATH_BT_COEX_MODE_UNSLOTTED ,/* untimed/unslotted mode */
@@ -69,7 +62,6 @@ struct ath_btcoex_info {u8 btactive_gpio;u8 btpriority_gpio;u8 bt_duty_cycle;/* BT duty cycle in percentage */ -int bt_stomp_type;/* Types of BT stomping */ u32 bt_coex_mode;/* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_mode2;/* Register setting for AR_BT_COEX_MODE2 */
drivers/net/wireless/ath/ath9k/main.c +4 -3
@@ -1395,7 +1395,7 @@ static void ath_btcoex_period_timer(unsigned long data)spin_lock_bh (&btcoex->btcoex_lock); -ath_btcoex_bt_stomp (sc, btinfo, btinfo->bt_stomp_type); +ath_btcoex_bt_stomp (sc, btinfo, btcoex->bt_stomp_type);spin_unlock_bh (&btcoex->btcoex_lock);
@@ -1430,9 +1430,9 @@ static void ath_btcoex_no_stomp_timer(void *arg)spin_lock_bh (&btcoex->btcoex_lock); -if (btinfo->bt_stomp_type ==ATH_BTCOEX_STOMP_LOW ) +if (btcoex->bt_stomp_type ==ATH_BTCOEX_STOMP_LOW )ath_btcoex_bt_stomp (sc, btinfo,ATH_BTCOEX_STOMP_NONE ); -else if (btinfo->bt_stomp_type ==ATH_BTCOEX_STOMP_ALL ) +else if (btcoex->bt_stomp_type ==ATH_BTCOEX_STOMP_ALL )ath_btcoex_bt_stomp (sc, btinfo,ATH_BTCOEX_STOMP_LOW );spin_unlock_bh (&btcoex->btcoex_lock);
@@ -1691,6 +1691,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) goto bad2; qnum =ath_tx_get_qnum (sc,ATH9K_TX_QUEUE_DATA ,ATH9K_WME_AC_BE );ath9k_hw_init_btcoex_hw_info (ah, qnum); + sc->btcoex.bt_stomp_type =ATH_BTCOEX_STOMP_LOW ;break ;default :WARN_ON (1 );
Signature · 1 line
1.6.3.3
PATCH 9/15 ath9k: remove unused bt_duty_cycle
In reply to Luis R. Rodriguez--- drivers/net/wireless/ath/ath9k/btcoex.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.h +0 -1
@@ -61,7 +61,6 @@ struct ath_btcoex_info {u8 wlanactive_gpio;u8 btactive_gpio;u8 btpriority_gpio; -u8 bt_duty_cycle;/* BT duty cycle in percentage */ u32 bt_coex_mode;/* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_mode2;/* Register setting for AR_BT_COEX_MODE2 */
Signature · 1 line
1.6.3.3
PATCH 9/15 ath9k: remove unused bt_duty_cycle
Quoted 10 lines · Luis Rodriguez
Signed-off-by Luis R. Rodriguez <[email protected]>--- drivers/net/wireless/ath/ath9k/btcoex.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)drivers/net/wireless/ath/ath9k/btcoex.h +0
-0
drivers/net/wireless/ath/ath9k/btcoex.h struct ath_btcoex_info {
Quoted 8 lines
drivers/net/wireless/ath/ath9k/btcoex.h +0
-2@@ -61,7 +61,6 @@ struct ath_btcoex_info {u8 wlanactive_gpio;u8 btactive_gpio;u8 btpriority_gpio; -u8 bt_duty_cycle;/* BT duty cycle in percentage */ u32 bt_coex_mode;/* Register setting for AR_BT_COEX_MODE */ u32 bt_coex_weights;/* Register setting for AR_BT_COEX_WEIGHT */ u32 bt_coex_mode2;/* Register setting for AR_BT_COEX_MODE2 */ --
thanks.
Vasanth
PATCH 10/15 ath9k: rename btcoex_scheme to just scheme
In reply to Luis R. Rodriguezbtcoex_scheme is already part of a btcoex struct, its implied this is btcoex related.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 4 ++-- drivers/net/wireless/ath/ath9k/btcoex.h | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 6 +++--- drivers/net/wireless/ath/ath9k/main.c | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +2 -2
@@ -147,7 +147,7 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah) {struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; -switch (btcoex_info->btcoex_scheme) { +switch (btcoex_info->scheme) {case ATH_BTCOEX_CFG_NONE :break ;case ATH_BTCOEX_CFG_2WIRE :
@@ -174,7 +174,7 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_OUTPUT ); -if (btcoex_info->btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) { +if (btcoex_info->scheme ==ATH_BTCOEX_CFG_3WIRE ) {REG_WRITE (ah,AR_BT_COEX_MODE ,AR_BT_QUIET |AR_BT_MODE );REG_WRITE (ah,AR_BT_COEX_WEIGHT ,0 );REG_WRITE (ah,AR_BT_COEX_MODE2 ,0 );
drivers/net/wireless/ath/ath9k/btcoex.h +1 -1
@@ -56,7 +56,7 @@ struct ath_btcoex_config { };struct ath_btcoex_info { -enum ath_btcoex_scheme btcoex_scheme; +enum ath_btcoex_scheme scheme;bool enabled;u8 wlanactive_gpio;u8 btactive_gpio;
drivers/net/wireless/ath/ath9k/hw.c +3 -3
@@ -3693,13 +3693,13 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) btcoex_info->wlanactive_gpio =ATH_WLANACTIVE_GPIO ;if (AR_SREV_9285 (ah)) { - btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_3WIRE ; + btcoex_info->scheme =ATH_BTCOEX_CFG_3WIRE ; btcoex_info->btpriority_gpio =ATH_BTPRIORITY_GPIO ; }else { - btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_2WIRE ; + btcoex_info->scheme =ATH_BTCOEX_CFG_2WIRE ; } }else { - btcoex_info->btcoex_scheme =ATH_BTCOEX_CFG_NONE ; + btcoex_info->scheme =ATH_BTCOEX_CFG_NONE ; } }
drivers/net/wireless/ath/ath9k/main.c +7 -7
@@ -443,7 +443,7 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht)struct ath_hw *ah = sc->sc_ah;if ((sc->sc_flags &SC_OP_SCANNING ) || is_ht || - (ah->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE )) { + (ah->btcoex_info.scheme !=ATH_BTCOEX_CFG_NONE )) { sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask; sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask; }else {
@@ -511,7 +511,7 @@ static void ath9k_tasklet(unsigned long data) sc->sc_flags |=SC_OP_WAIT_FOR_BEACON |SC_OP_BEACON_SYNC ; } -if (ah->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +if (ah->btcoex_info.scheme ==ATH_BTCOEX_CFG_3WIRE )if (status &ATH9K_INT_GENTIMER )ath_gen_timer_isr (sc->sc_ah);
@@ -1291,7 +1291,7 @@ void ath_detach(struct ath_softc *sc)ath_tx_cleanupq (sc, &sc->tx.txq[i]);if ((sc->btcoex.no_stomp_timer) && - ah->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) + ah->btcoex_info.scheme ==ATH_BTCOEX_CFG_3WIRE )ath_gen_timer_free (ah, sc->btcoex.no_stomp_timer);ath9k_hw_detach (ah);
@@ -1678,7 +1678,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)ARRAY_SIZE (ath9k_5ghz_chantable); } -switch (ah->btcoex_info.btcoex_scheme) { +switch (ah->btcoex_info.scheme) {case ATH_BTCOEX_CFG_NONE :break ;case ATH_BTCOEX_CFG_2WIRE :
@@ -2203,13 +2203,13 @@ static int ath9k_start(struct ieee80211_hw *hw)ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 ); -if ((ah->btcoex_info.btcoex_scheme !=ATH_BTCOEX_CFG_NONE ) && +if ((ah->btcoex_info.scheme !=ATH_BTCOEX_CFG_NONE ) && !ah->btcoex_info.enabled) {ath9k_hw_btcoex_init_weight (ah);ath9k_hw_btcoex_enable (ah);ath_pcie_aspm_disable (sc); -if (ah->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +if (ah->btcoex_info.scheme ==ATH_BTCOEX_CFG_3WIRE )ath9k_btcoex_timer_resume (sc); }
@@ -2365,7 +2365,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)if (ah->btcoex_info.enabled) {ath9k_hw_btcoex_disable (ah); -if (ah->btcoex_info.btcoex_scheme ==ATH_BTCOEX_CFG_3WIRE ) +if (ah->btcoex_info.scheme ==ATH_BTCOEX_CFG_3WIRE )ath9k_btcoex_timer_pause (sc); }
Signature · 1 line
1.6.3.3
PATCH 11/15 ath9k: rename ath_btcoex_info to ath_btcoex_hw
In reply to Luis R. Rodriguez--- drivers/net/wireless/ath/ath9k/btcoex.c | 60 +++++++++++++++--------------- drivers/net/wireless/ath/ath9k/btcoex.h | 4 +- drivers/net/wireless/ath/ath9k/hw.c | 16 ++++---- drivers/net/wireless/ath/ath9k/hw.h | 2 +- drivers/net/wireless/ath/ath9k/main.c | 46 ++++++++++++------------ 5 files changed, 64 insertions(+), 64 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +30 -30
@@ -43,13 +43,13 @@ bool ath_btcoex_supported(u16 subsysid)return false; } -void ath9k_hw_init_btcoex_hw_info (struct ath_hw *ah,int qnum) +void ath9k_hw_init_btcoex_hw (struct ath_hw *ah,int qnum) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;u32 i; - btcoex_info->bt_coex_mode = - (btcoex_info->bt_coex_mode &AR_BT_QCU_THRESH ) | + btcoex_hw->bt_coex_mode = + (btcoex_hw->bt_coex_mode &AR_BT_QCU_THRESH ) |SM (ath_bt_config.bt_time_extend,AR_BT_TIME_EXTEND ) |SM (ath_bt_config.bt_txstate_extend,AR_BT_TXSTATE_EXTEND ) | SM(ath_bt_config.bt_txframe_extend, AR_BT_TX_FRAME_EXTEND) |
@@ -60,7 +60,7 @@ void ath9k_hw_init_btcoex_hw_info(struct ath_hw *ah, int qnum)SM (ath_bt_config.bt_first_slot_time,AR_BT_FIRST_SLOT_TIME ) |SM (qnum,AR_BT_QCU_THRESH ); - btcoex_info->bt_coex_mode2 = + btcoex_hw->bt_coex_mode2 =SM (ath_bt_config.bt_hold_rx_clear,AR_BT_HOLD_RX_CLEAR ) |SM (ATH_BTCOEX_BMISS_THRESH ,AR_BT_BCN_MISS_THRESH ) |AR_BT_DISABLE_BT_ANT ;
@@ -71,7 +71,7 @@ void ath9k_hw_init_btcoex_hw_info(struct ath_hw *ah, int qnum)void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;/* connect bt_active to baseband */ REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
@@ -84,15 +84,15 @@ void ath9k_hw_btcoex_init_2wire(struct ath_hw *ah)/* Set input mux for bt_active to gpio pin */ REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 ,AR_GPIO_INPUT_MUX1_BT_ACTIVE , - btcoex_info->btactive_gpio); + btcoex_hw->btactive_gpio);/* Configure the desired gpio port for input */ -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); +ath9k_hw_cfg_gpio_input (ah, btcoex_hw->btactive_gpio); }void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;/* btcoex 3-wire */ REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
@@ -103,51 +103,51 @@ void ath9k_hw_btcoex_init_3wire(struct ath_hw *ah)* bt_active_async to GPIO pins */ REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 ,AR_GPIO_INPUT_MUX1_BT_ACTIVE , - btcoex_info->btactive_gpio); + btcoex_hw->btactive_gpio);REG_RMW_FIELD (ah,AR_GPIO_INPUT_MUX1 ,AR_GPIO_INPUT_MUX1_BT_PRIORITY , - btcoex_info->btpriority_gpio); + btcoex_hw->btpriority_gpio);/* Configure the desired GPIO ports for input */ -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btactive_gpio); -ath9k_hw_cfg_gpio_input (ah, btcoex_info->btpriority_gpio); +ath9k_hw_cfg_gpio_input (ah, btcoex_hw->btactive_gpio); +ath9k_hw_cfg_gpio_input (ah, btcoex_hw->btpriority_gpio); }static void ath9k_hw_btcoex_enable_2wire (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;/* Configure the desired GPIO port for TX_FRAME output */ -ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, +ath9k_hw_cfg_output (ah, btcoex_hw->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_TX_FRAME ); }static void ath9k_hw_btcoex_enable_3wire (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;/* * Program coex mode and weight registers to * enable coex 3-wire */ -REG_WRITE (ah,AR_BT_COEX_MODE , btcoex_info->bt_coex_mode); -REG_WRITE (ah,AR_BT_COEX_WEIGHT , btcoex_info->bt_coex_weights); -REG_WRITE (ah,AR_BT_COEX_MODE2 , btcoex_info->bt_coex_mode2); +REG_WRITE (ah,AR_BT_COEX_MODE , btcoex_hw->bt_coex_mode); +REG_WRITE (ah,AR_BT_COEX_WEIGHT , btcoex_hw->bt_coex_weights); +REG_WRITE (ah,AR_BT_COEX_MODE2 , btcoex_hw->bt_coex_mode2);REG_RMW_FIELD (ah,AR_QUIET1 ,AR_QUIET1_QUIET_ACK_CTS_ENABLE ,1 );REG_RMW_FIELD (ah,AR_PCU_MISC ,AR_PCU_BT_ANT_PREVENT_RX ,0 ); -ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, +ath9k_hw_cfg_output (ah, btcoex_hw->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL ); }void ath9k_hw_btcoex_enable (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; -switch (btcoex_info->scheme) { +switch (btcoex_hw->scheme) {case ATH_BTCOEX_CFG_NONE :break ;case ATH_BTCOEX_CFG_2WIRE :
@@ -159,26 +159,26 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah) }REG_RMW (ah,AR_GPIO_PDPU , - (0x2 << (btcoex_info->btactive_gpio *2 )), - (0x3 << (btcoex_info->btactive_gpio *2 ))); + (0x2 << (btcoex_hw->btactive_gpio *2 )), + (0x3 << (btcoex_hw->btactive_gpio *2 ))); - ah->btcoex_info.enabled = true; + ah->btcoex_hw.enabled = true; }void ath9k_hw_btcoex_disable (struct ath_hw *ah) { -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; -ath9k_hw_set_gpio (ah, btcoex_info->wlanactive_gpio,0 ); +ath9k_hw_set_gpio (ah, btcoex_hw->wlanactive_gpio,0 ); -ath9k_hw_cfg_output (ah, btcoex_info->wlanactive_gpio, +ath9k_hw_cfg_output (ah, btcoex_hw->wlanactive_gpio,AR_GPIO_OUTPUT_MUX_AS_OUTPUT ); -if (btcoex_info->scheme ==ATH_BTCOEX_CFG_3WIRE ) { +if (btcoex_hw->scheme ==ATH_BTCOEX_CFG_3WIRE ) {REG_WRITE (ah,AR_BT_COEX_MODE ,AR_BT_QUIET |AR_BT_MODE );REG_WRITE (ah,AR_BT_COEX_WEIGHT ,0 );REG_WRITE (ah,AR_BT_COEX_MODE2 ,0 ); } - ah->btcoex_info.enabled = false; + ah->btcoex_hw.enabled = false; }
drivers/net/wireless/ath/ath9k/btcoex.h +2 -2
@@ -55,7 +55,7 @@ struct ath_btcoex_config {bool bt_hold_rx_clear; }; -struct ath_btcoex_info { +struct ath_btcoex_hw {enum ath_btcoex_scheme scheme;bool enabled;u8 wlanactive_gpio;
@@ -69,7 +69,7 @@ struct ath_btcoex_info {bool ath_btcoex_supported (u16 subsysid);void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah);void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah); -void ath9k_hw_init_btcoex_hw_info (struct ath_hw *ah,int qnum); +void ath9k_hw_init_btcoex_hw (struct ath_hw *ah,int qnum);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/hw.c +8 -8
@@ -2560,7 +2560,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,#endif } -if (ah->btcoex_info.enabled) +if (ah->btcoex_hw.enabled)ath9k_hw_btcoex_enable (ah);return 0 ;
@@ -3511,7 +3511,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) {struct ath9k_hw_capabilities *pCap = &ah->caps;struct ath_regulatory *regulatory =ath9k_hw_regulatory (ah); -struct ath_btcoex_info *btcoex_info = &ah->btcoex_info; +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;u16 capField =0 , eeval;
@@ -3689,17 +3689,17 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)if (AR_SREV_9280_10_OR_LATER (ah) &&ath_btcoex_supported (ah->hw_version.subsysid)) { - btcoex_info->btactive_gpio =ATH_BTACTIVE_GPIO ; - btcoex_info->wlanactive_gpio =ATH_WLANACTIVE_GPIO ; + btcoex_hw->btactive_gpio =ATH_BTACTIVE_GPIO ; + btcoex_hw->wlanactive_gpio =ATH_WLANACTIVE_GPIO ;if (AR_SREV_9285 (ah)) { - btcoex_info->scheme =ATH_BTCOEX_CFG_3WIRE ; - btcoex_info->btpriority_gpio =ATH_BTPRIORITY_GPIO ; + btcoex_hw->scheme =ATH_BTCOEX_CFG_3WIRE ; + btcoex_hw->btpriority_gpio =ATH_BTPRIORITY_GPIO ; }else { - btcoex_info->scheme =ATH_BTCOEX_CFG_2WIRE ; + btcoex_hw->scheme =ATH_BTCOEX_CFG_2WIRE ; } }else { - btcoex_info->scheme =ATH_BTCOEX_CFG_NONE ; + btcoex_hw->scheme =ATH_BTCOEX_CFG_NONE ; } }
drivers/net/wireless/ath/ath9k/hw.h +1 -1
@@ -555,7 +555,7 @@ struct ath_hw {enum ath9k_ani_cmd ani_function;/* Bluetooth coexistance */ -struct ath_btcoex_info btcoex_info; +struct ath_btcoex_hw btcoex_hw;u32 intr_txqs;enum ath9k_ht_extprotspacing extprotspacing;
drivers/net/wireless/ath/ath9k/main.c +23 -23
154 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 12/15 ath9k: simplify ath_btcoex_bt_stomp()
In reply to Luis R. RodriguezThe second argument is always the hardware bt coex struct, so remove it, and rename the function on the path with a ath9k_ prefix.
--- drivers/net/wireless/ath/ath9k/main.c | 43 ++++++++++++++++----------------- 1 files changed, 21 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +21 -22
@@ -1336,47 +1336,48 @@ static void ath_detect_bt_priority(struct ath_softc *sc) } } -static void ath_btcoex_set_weight (struct ath_btcoex_hw *btcoex_hw, -u32 bt_weight, -u32 wlan_weight) +static void ath9k_hw_btcoex_set_weight (struct ath_hw *ah, +u32 bt_weight, +u32 wlan_weight) { +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; + btcoex_hw->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) | -SM (wlan_weight,AR_BTCOEX_WL_WGHT ); +SM (wlan_weight,AR_BTCOEX_WL_WGHT ); }static void ath9k_hw_btcoex_init_weight (struct ath_hw *ah) { -ath_btcoex_set_weight (&ah->btcoex_hw,AR_BT_COEX_WGHT , -AR_STOMP_LOW_WLAN_WGHT ); +ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT ,AR_STOMP_LOW_WLAN_WGHT ); }/* * Configures appropriate weight based on stomp type. */ -static void ath_btcoex_bt_stomp (struct ath_softc *sc, -struct ath_btcoex_hw *btcoex_hw, -int stomp_type) +static void ath9k_btcoex_bt_stomp (struct ath_softc *sc, +enum ath_stomp_type stomp_type) { +struct ath_hw *ah = sc->sc_ah;switch (stomp_type) {case ATH_BTCOEX_STOMP_ALL : -ath_btcoex_set_weight (btcoex_hw,AR_BT_COEX_WGHT , -AR_STOMP_ALL_WLAN_WGHT ); +ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT , +AR_STOMP_ALL_WLAN_WGHT );break ;case ATH_BTCOEX_STOMP_LOW : -ath_btcoex_set_weight (btcoex_hw,AR_BT_COEX_WGHT , -AR_STOMP_LOW_WLAN_WGHT ); +ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT , +AR_STOMP_LOW_WLAN_WGHT );break ;case ATH_BTCOEX_STOMP_NONE : -ath_btcoex_set_weight (btcoex_hw,AR_BT_COEX_WGHT , -AR_STOMP_NONE_WLAN_WGHT ); +ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT , +AR_STOMP_NONE_WLAN_WGHT );break ;default : -DPRINTF (sc->sc_ah,ATH_DBG_BTCOEX ,"Invalid Stomptype\n" ); +DPRINTF (ah,ATH_DBG_BTCOEX ,"Invalid Stomptype\n" );break ; } -ath9k_hw_btcoex_enable (sc->sc_ah); +ath9k_hw_btcoex_enable (ah); }/*
@@ -1389,13 +1390,12 @@ static void ath_btcoex_period_timer(unsigned long data)struct ath_softc *sc = (struct ath_softc *) data;struct ath_hw *ah = sc->sc_ah;struct ath_btcoex *btcoex = &sc->btcoex; -struct ath_btcoex_hw *btcoex_hw= &ah->btcoex_hw;ath_detect_bt_priority (sc);spin_lock_bh (&btcoex->btcoex_lock); -ath_btcoex_bt_stomp (sc, btcoex_hw, btcoex->bt_stomp_type); +ath9k_btcoex_bt_stomp (sc, btcoex->bt_stomp_type);spin_unlock_bh (&btcoex->btcoex_lock);
@@ -1424,16 +1424,15 @@ static void ath_btcoex_no_stomp_timer(void *arg)struct ath_softc *sc = (struct ath_softc *)arg;struct ath_hw *ah = sc->sc_ah;struct ath_btcoex *btcoex = &sc->btcoex; -struct ath_btcoex_hw *btcoex_hw= &ah->btcoex_hw;DPRINTF (ah,ATH_DBG_BTCOEX ,"no stomp timer running \n" );spin_lock_bh (&btcoex->btcoex_lock);if (btcoex->bt_stomp_type ==ATH_BTCOEX_STOMP_LOW ) -ath_btcoex_bt_stomp (sc, btcoex_hw,ATH_BTCOEX_STOMP_NONE ); +ath9k_btcoex_bt_stomp (sc,ATH_BTCOEX_STOMP_NONE );else if (btcoex->bt_stomp_type ==ATH_BTCOEX_STOMP_ALL ) -ath_btcoex_bt_stomp (sc, btcoex_hw,ATH_BTCOEX_STOMP_LOW ); +ath9k_btcoex_bt_stomp (sc,ATH_BTCOEX_STOMP_LOW );spin_unlock_bh (&btcoex->btcoex_lock); }
Signature · 1 line
1.6.3.3
PATCH 13/15 ath9k: now move ath9k_hw_btcoex_set_weight() to btcoex.c
In reply to Luis R. RodriguezAfter some necessary cleanups we now move ath9k_hw_btcoex_set_weight() to where it belongs.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 10 ++++++++++ drivers/net/wireless/ath/ath9k/btcoex.h | 3 +++ drivers/net/wireless/ath/ath9k/main.c | 18 ++---------------- 3 files changed, 15 insertions(+), 16 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +10 -0
@@ -124,6 +124,16 @@ static void ath9k_hw_btcoex_enable_2wire(struct ath_hw *ah) AR_GPIO_OUTPUT_MUX_AS_TX_FRAME); } +void ath9k_hw_btcoex_set_weight (struct ath_hw *ah, +u32 bt_weight, +u32 wlan_weight) +{ +struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; + + btcoex_hw->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) | +SM (wlan_weight,AR_BTCOEX_WL_WGHT ); +} +static void ath9k_hw_btcoex_enable_3wire (struct ath_hw *ah) {struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw;
drivers/net/wireless/ath/ath9k/btcoex.h +3 -0
@@ -70,6 +70,9 @@ bool ath_btcoex_supported(u16 subsysid);void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah);void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah);void ath9k_hw_init_btcoex_hw (struct ath_hw *ah,int qnum); +void ath9k_hw_btcoex_set_weight (struct ath_hw *ah, +u32 bt_weight, +u32 wlan_weight);void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah);
drivers/net/wireless/ath/ath9k/main.c +2 -16
@@ -1336,21 +1336,6 @@ static void ath_detect_bt_priority(struct ath_softc *sc) } } -static void ath9k_hw_btcoex_set_weight (struct ath_hw *ah, -u32 bt_weight, -u32 wlan_weight) -{ -struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; - - btcoex_hw->bt_coex_weights =SM (bt_weight,AR_BTCOEX_BT_WGHT ) | -SM (wlan_weight,AR_BTCOEX_WL_WGHT ); -} - -static void ath9k_hw_btcoex_init_weight (struct ath_hw *ah) -{ -ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT ,AR_STOMP_LOW_WLAN_WGHT ); -} -/* * Configures appropriate weight based on stomp type. */
@@ -2204,7 +2189,8 @@ static int ath9k_start(struct ieee80211_hw *hw)if ((ah->btcoex_hw.scheme !=ATH_BTCOEX_CFG_NONE ) && !ah->btcoex_hw.enabled) { -ath9k_hw_btcoex_init_weight (ah); +ath9k_hw_btcoex_set_weight (ah,AR_BT_COEX_WGHT , +AR_STOMP_LOW_WLAN_WGHT );ath9k_hw_btcoex_enable (ah);ath_pcie_aspm_disable (sc);
Signature · 1 line
1.6.3.3
PATCH 14/15 ath9k: move ath_btcoex_config and ath_bt_mode to btcoex.c
In reply to Luis R. RodriguezThese are only used by btcoex.c on one routine, so stuff them into that file.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 31 +++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath9k/btcoex.h | 20 -------------------- 2 files changed, 29 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +29 -2
@@ -16,8 +16,24 @@#include "ath9k.h" -static const struct ath_btcoex_config ath_bt_config = {0 , true, true, -ATH_BT_COEX_MODE_SLOTTED , true, true,2 ,5 , true }; +enum ath_bt_mode { +ATH_BT_COEX_MODE_LEGACY ,/* legacy rx_clear mode */ +ATH_BT_COEX_MODE_UNSLOTTED ,/* untimed/unslotted mode */ +ATH_BT_COEX_MODE_SLOTTED ,/* slotted mode */ +ATH_BT_COEX_MODE_DISALBED ,/* coexistence disabled */ +}; + +struct ath_btcoex_config { +u8 bt_time_extend; +bool bt_txstate_extend; +bool bt_txframe_extend; +enum ath_bt_mode bt_mode;/* coexistence mode */ +bool bt_quiet_collision; +bool bt_rxclear_polarity;/* invert rx_clear as WLAN_ACTIVE*/ +u8 bt_priority_time; +u8 bt_first_slot_time; +bool bt_hold_rx_clear; +};static const u16 ath_subsysid_tbl[] = {AR9280_COEX2WIRE_SUBSYSID ,
@@ -46,6 +62,17 @@ bool ath_btcoex_supported(u16 subsysid)void ath9k_hw_init_btcoex_hw (struct ath_hw *ah,int qnum) {struct ath_btcoex_hw *btcoex_hw = &ah->btcoex_hw; +const struct ath_btcoex_config ath_bt_config = { + .bt_time_extend =0 , + .bt_txstate_extend = true, + .bt_txframe_extend = true, + .bt_mode =ATH_BT_COEX_MODE_SLOTTED , + .bt_quiet_collision = true, + .bt_rxclear_polarity = true, + .bt_priority_time =2 , + .bt_first_slot_time =5 , + .bt_hold_rx_clear = true, + };u32 i; btcoex_hw->bt_coex_mode =
drivers/net/wireless/ath/ath9k/btcoex.h +0 -20
@@ -36,25 +36,6 @@ enum ath_btcoex_scheme { ATH_BTCOEX_CFG_3WIRE, }; -enum ath_bt_mode { -ATH_BT_COEX_MODE_LEGACY ,/* legacy rx_clear mode */ -ATH_BT_COEX_MODE_UNSLOTTED ,/* untimed/unslotted mode */ -ATH_BT_COEX_MODE_SLOTTED ,/* slotted mode */ -ATH_BT_COEX_MODE_DISALBED ,/* coexistence disabled */ -}; - -struct ath_btcoex_config { -u8 bt_time_extend; -bool bt_txstate_extend; -bool bt_txframe_extend; -enum ath_bt_mode bt_mode;/* coexistence mode */ -bool bt_quiet_collision; -bool bt_rxclear_polarity;/* invert rx_clear as WLAN_ACTIVE*/ -u8 bt_priority_time; -u8 bt_first_slot_time; -bool bt_hold_rx_clear; -}; -struct ath_btcoex_hw {enum ath_btcoex_scheme scheme;bool enabled;
@@ -76,5 +57,4 @@ void ath9k_hw_btcoex_set_weight(struct ath_hw *ah,void ath9k_hw_btcoex_enable (struct ath_hw *ah);void ath9k_hw_btcoex_disable (struct ath_hw *ah); -#endif
Signature · 1 line
1.6.3.3
PATCH 15/15 ath9k: rename ath_btcoex_supported() to ath9k_hw_btcoex_supported()
In reply to Luis R. RodriguezAlso just pass the ath_hw as the parameter.
--- drivers/net/wireless/ath/ath9k/btcoex.c | 6 +++--- drivers/net/wireless/ath/ath9k/btcoex.h | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/btcoex.c +3 -3
@@ -45,15 +45,15 @@ static const u16 ath_subsysid_tbl[] = {* Checks the subsystem id of the device to see if it * supports btcoex */ -bool ath_btcoex_supported (u16 subsysid) +bool ath9k_hw_btcoex_supported (struct ath_hw *ah) {int i; -if (!subsysid) +if (!ah->hw_version.subsysid)return false;for (i =0 ; i <ARRAY_SIZE (ath_subsysid_tbl); i++) -if (subsysid == ath_subsysid_tbl[i]) +if (ah->hw_version.subsysid == ath_subsysid_tbl[i])return true;return false;
drivers/net/wireless/ath/ath9k/btcoex.h +1 -1
@@ -47,7 +47,7 @@ struct ath_btcoex_hw {u32 bt_coex_mode2;/* Register setting for AR_BT_COEX_MODE2 */ }; -bool ath_btcoex_supported (u16 subsysid); +bool ath9k_hw_btcoex_supported (struct ath_hw *ah);void ath9k_hw_btcoex_init_2wire (struct ath_hw *ah);void ath9k_hw_btcoex_init_3wire (struct ath_hw *ah);void ath9k_hw_init_btcoex_hw (struct ath_hw *ah,int qnum);
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -3688,7 +3688,7 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah) ah->eep_ops->get_num_ant_config (ah,ATH9K_HAL_FREQ_BAND_2GHZ );if (AR_SREV_9280_10_OR_LATER (ah) && -ath_btcoex_supported (ah->hw_version.subsysid)) { +ath9k_hw_btcoex_supported (ah)) { btcoex_hw->btactive_gpio =ATH_BTACTIVE_GPIO ; btcoex_hw->wlanactive_gpio =ATH_WLANACTIVE_GPIO ;
Signature · 1 line
1.6.3.3