Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170498
b: refs/heads/master
c: af03abe
h: refs/heads/master
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Oct 7, 2009
1 parent dffe07e commit d1a1b8d
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e20250a2ce1f4a7ba7c83ccb62d9b7b9b96c736
refs/heads/master: af03abecd8e3646736904431f3335dad5e28cb8d
2 changes: 0 additions & 2 deletions trunk/drivers/net/wireless/ath/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "rc.h"
#include "debug.h"
#include "../ath.h"
#include "btcoex.h"

struct ath_node;

Expand Down Expand Up @@ -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;
};

Expand Down
57 changes: 38 additions & 19 deletions trunk/drivers/net/wireless/ath/ath9k/btcoex.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,29 @@ bool ath_btcoex_supported(u16 subsysid)
return false;
}

static 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);
}

void ath9k_hw_btcoex_init_weight(struct ath_hw *ah)
{
ath_btcoex_set_weight(&ah->btcoex_info, AR_BT_COEX_WGHT,
AR_STOMP_LOW_WLAN_WGHT);
}

/*
* Detects if there is any priority bt traffic
*/
static void ath_detect_bt_priority(struct ath_softc *sc)
{
struct ath_btcoex *btcoex = &sc->btcoex;
struct ath_hw *ah = sc->sc_ah;

if (ath9k_hw_gpio_get(sc->sc_ah, sc->btcoex_info.btpriority_gpio))
if (ath9k_hw_gpio_get(sc->sc_ah, ah->btcoex_info.btpriority_gpio))
btcoex->bt_priority_cnt++;

if (time_after(jiffies, btcoex->bt_priority_time +
Expand Down Expand Up @@ -106,8 +121,9 @@ static void ath_btcoex_bt_stomp(struct ath_softc *sc,
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_info *btinfo = &sc->btcoex_info;
struct ath_btcoex_info *btinfo = &ah->btcoex_info;

ath_detect_bt_priority(sc);

Expand All @@ -119,9 +135,9 @@ static void ath_btcoex_period_timer(unsigned long data)

if (btcoex->btcoex_period != btcoex->btcoex_no_stomp) {
if (btcoex->hw_timer_enabled)
ath_gen_timer_stop(sc->sc_ah, btinfo->no_stomp_timer);
ath_gen_timer_stop(ah, btinfo->no_stomp_timer);

ath_gen_timer_start(sc->sc_ah,
ath_gen_timer_start(ah,
btinfo->no_stomp_timer,
(ath9k_hw_gettsf32(sc->sc_ah) +
btcoex->btcoex_no_stomp),
Expand All @@ -141,10 +157,11 @@ static void ath_btcoex_period_timer(unsigned long data)
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_info *btinfo = &sc->btcoex_info;
struct ath_btcoex_info *btinfo = &ah->btcoex_info;

DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "no stomp timer running \n");
DPRINTF(ah, ATH_DBG_BTCOEX, "no stomp timer running \n");

spin_lock_bh(&btcoex->btcoex_lock);

Expand All @@ -156,14 +173,14 @@ static void ath_btcoex_no_stomp_timer(void *arg)
spin_unlock_bh(&btcoex->btcoex_lock);
}

static int ath_init_btcoex_info(struct ath_hw *hw,
static int ath_init_btcoex_info(struct ath_hw *ah,
struct ath_btcoex_info *btcoex_info)
{
struct ath_btcoex *btcoex = &hw->ah_sc->btcoex;
struct ath_btcoex *btcoex = &ah->ah_sc->btcoex;
u32 i;
int qnum;

qnum = ath_tx_get_qnum(hw->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE);
qnum = ath_tx_get_qnum(ah->ah_sc, ATH9K_TX_QUEUE_DATA, ATH9K_WME_AC_BE);

btcoex_info->bt_coex_mode =
(btcoex_info->bt_coex_mode & AR_BT_QCU_THRESH) |
Expand All @@ -190,15 +207,15 @@ static int ath_init_btcoex_info(struct ath_hw *hw,
btcoex->btcoex_period / 100;

for (i = 0; i < 32; i++)
hw->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i;
ah->hw_gen_timers.gen_timer_index[(debruijn32 << i) >> 27] = i;

setup_timer(&btcoex->period_timer, ath_btcoex_period_timer,
(unsigned long) hw->ah_sc);
(unsigned long) ah->ah_sc);

btcoex_info->no_stomp_timer = ath_gen_timer_alloc(hw,
btcoex_info->no_stomp_timer = ath_gen_timer_alloc(ah,
ath_btcoex_no_stomp_timer,
ath_btcoex_no_stomp_timer,
(void *)hw->ah_sc, AR_FIRST_NDP_TIMER);
(void *)ah->ah_sc, AR_FIRST_NDP_TIMER);

if (btcoex_info->no_stomp_timer == NULL)
return -ENOMEM;
Expand All @@ -210,7 +227,7 @@ static int ath_init_btcoex_info(struct ath_hw *hw,

int ath9k_hw_btcoex_init(struct ath_hw *ah)
{
struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;
int ret = 0;

if (btcoex_info->btcoex_scheme == ATH_BTCOEX_CFG_2WIRE) {
Expand Down Expand Up @@ -258,7 +275,7 @@ int ath9k_hw_btcoex_init(struct ath_hw *ah)

void ath9k_hw_btcoex_enable(struct ath_hw *ah)
{
struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
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 */
Expand Down Expand Up @@ -291,7 +308,7 @@ void ath9k_hw_btcoex_enable(struct ath_hw *ah)

void ath9k_hw_btcoex_disable(struct ath_hw *ah)
{
struct ath_btcoex_info *btcoex_info = &ah->ah_sc->btcoex_info;
struct ath_btcoex_info *btcoex_info = &ah->btcoex_info;

ath9k_hw_set_gpio(ah, btcoex_info->wlanactive_gpio, 0);

Expand All @@ -313,11 +330,12 @@ void ath9k_hw_btcoex_disable(struct ath_hw *ah)
void ath_btcoex_timer_pause(struct ath_softc *sc)
{
struct ath_btcoex *btcoex = &sc->btcoex;
struct ath_hw *ah = sc->sc_ah;

del_timer_sync(&btcoex->period_timer);

if (btcoex->hw_timer_enabled)
ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer);
ath_gen_timer_stop(ah, ah->btcoex_info.no_stomp_timer);

btcoex->hw_timer_enabled = false;
}
Expand All @@ -328,12 +346,13 @@ void ath_btcoex_timer_pause(struct ath_softc *sc)
void ath_btcoex_timer_resume(struct ath_softc *sc)
{
struct ath_btcoex *btcoex = &sc->btcoex;
struct ath_hw *ah = sc->sc_ah;

DPRINTF(sc->sc_ah, ATH_DBG_BTCOEX, "Starting btcoex timers");
DPRINTF(ah, ATH_DBG_BTCOEX, "Starting btcoex timers");

/* make sure duty cycle timer is also stopped when resuming */
if (btcoex->hw_timer_enabled)
ath_gen_timer_stop(sc->sc_ah, sc->btcoex_info.no_stomp_timer);
ath_gen_timer_stop(sc->sc_ah, ah->btcoex_info.no_stomp_timer);

btcoex->bt_priority_cnt = 0;
btcoex->bt_priority_time = jiffies;
Expand Down
14 changes: 3 additions & 11 deletions trunk/drivers/net/wireless/ath/ath9k/btcoex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion trunk/drivers/net/wireless/ath/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <asm/unaligned.h>
#include <linux/pci.h>

#include "hw.h"
#include "ath9k.h"
#include "initvals.h"

Expand Down Expand Up @@ -3558,7 +3559,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;

Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "calib.h"
#include "reg.h"
#include "phy.h"
#include "btcoex.h"

#include "../regd.h"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -675,4 +679,7 @@ u32 ath9k_hw_gettsf32(struct ath_hw *ah);
#define ATH_PCIE_CAP_LINK_L1 2

void 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
Loading

0 comments on commit d1a1b8d

Please sign in to comment.