Commit 63081305 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville

ath9k: Cleanup WLAN/BT RX diversity

For single-chain WLAN+BT cards, the BT antenna can be used for
WLAN RX when the BT interface is disabled. Rename the modparam
"antenna_diversity" to "bt_ant_diversity" to clarify this.
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3afa6b4f
...@@ -159,7 +159,7 @@ struct ath_common { ...@@ -159,7 +159,7 @@ struct ath_common {
bool btcoex_enabled; bool btcoex_enabled;
bool disable_ani; bool disable_ani;
bool antenna_diversity; bool bt_ant_diversity;
}; };
struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
......
...@@ -887,6 +887,6 @@ void ath_ant_comb_update(struct ath_softc *sc) ...@@ -887,6 +887,6 @@ void ath_ant_comb_update(struct ath_softc *sc)
ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf); ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf);
if (common->antenna_diversity) if (common->bt_ant_diversity)
ath9k_hw_antctrl_shared_chain_lnadiv(ah, true); ath9k_hw_antctrl_shared_chain_lnadiv(ah, true);
} }
...@@ -270,25 +270,26 @@ static const struct file_operations fops_ani = { ...@@ -270,25 +270,26 @@ static const struct file_operations fops_ani = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
static ssize_t read_file_ant_diversity(struct file *file, char __user *user_buf, static ssize_t read_file_bt_ant_diversity(struct file *file,
size_t count, loff_t *ppos) char __user *user_buf,
size_t count, loff_t *ppos)
{ {
struct ath_softc *sc = file->private_data; struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
char buf[32]; char buf[32];
unsigned int len; unsigned int len;
len = sprintf(buf, "%d\n", common->antenna_diversity); len = sprintf(buf, "%d\n", common->bt_ant_diversity);
return simple_read_from_buffer(user_buf, count, ppos, buf, len); return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
static ssize_t write_file_ant_diversity(struct file *file, static ssize_t write_file_bt_ant_diversity(struct file *file,
const char __user *user_buf, const char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct ath_softc *sc = file->private_data; struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
unsigned long antenna_diversity; unsigned long bt_ant_diversity;
char buf[32]; char buf[32];
ssize_t len; ssize_t len;
...@@ -296,26 +297,23 @@ static ssize_t write_file_ant_diversity(struct file *file, ...@@ -296,26 +297,23 @@ static ssize_t write_file_ant_diversity(struct file *file,
if (copy_from_user(buf, user_buf, len)) if (copy_from_user(buf, user_buf, len))
return -EFAULT; return -EFAULT;
if (!AR_SREV_9565(sc->sc_ah))
goto exit;
buf[len] = '\0'; buf[len] = '\0';
if (kstrtoul(buf, 0, &antenna_diversity)) if (kstrtoul(buf, 0, &bt_ant_diversity))
return -EINVAL; return -EINVAL;
common->antenna_diversity = !!antenna_diversity; common->bt_ant_diversity = !!bt_ant_diversity;
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
ath_ant_comb_update(sc); ath_ant_comb_update(sc);
ath_dbg(common, CONFIG, "Antenna diversity: %d\n", ath_dbg(common, CONFIG, "Enable WLAN/BT RX Antenna diversity: %d\n",
common->antenna_diversity); common->bt_ant_diversity);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
exit:
return count; return count;
} }
static const struct file_operations fops_ant_diversity = { static const struct file_operations fops_bt_ant_diversity = {
.read = read_file_ant_diversity, .read = read_file_bt_ant_diversity,
.write = write_file_ant_diversity, .write = write_file_bt_ant_diversity,
.open = simple_open, .open = simple_open,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = default_llseek, .llseek = default_llseek,
...@@ -1933,8 +1931,8 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1933,8 +1931,8 @@ int ath9k_init_debug(struct ath_hw *ah)
sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
debugfs_create_file("diversity", S_IRUSR | S_IWUSR, debugfs_create_file("bt_ant_diversity", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_ant_diversity); sc->debug.debugfs_phy, sc, &fops_bt_ant_diversity);
debugfs_create_file("antenna_diversity", S_IRUSR, debugfs_create_file("antenna_diversity", S_IRUSR,
sc->debug.debugfs_phy, sc, &fops_antenna_diversity); sc->debug.debugfs_phy, sc, &fops_antenna_diversity);
#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
......
...@@ -53,9 +53,9 @@ static int ath9k_btcoex_enable; ...@@ -53,9 +53,9 @@ static int ath9k_btcoex_enable;
module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444);
MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
static int ath9k_enable_diversity; static int ath9k_bt_ant_diversity;
module_param_named(enable_diversity, ath9k_enable_diversity, int, 0444); module_param_named(bt_ant_diversity, ath9k_bt_ant_diversity, int, 0444);
MODULE_PARM_DESC(enable_diversity, "Enable Antenna diversity for AR9565"); MODULE_PARM_DESC(bt_ant_diversity, "Enable WLAN/BT RX antenna diversity");
bool is_ath9k_unloaded; bool is_ath9k_unloaded;
/* We use the hw_value as an index into our private channel structure */ /* We use the hw_value as an index into our private channel structure */
...@@ -633,11 +633,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, ...@@ -633,11 +633,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
ath9k_init_platform(sc); ath9k_init_platform(sc);
/* /*
* Enable Antenna diversity only when BTCOEX is disabled * Enable WLAN/BT RX Antenna diversity only when BTCOEX is enabled
* and the user manually requests the feature. * and the user manually requests the feature.
*/ */
if (!common->btcoex_enabled && ath9k_enable_diversity) if (common->btcoex_enabled && ath9k_bt_ant_diversity)
common->antenna_diversity = 1; common->bt_ant_diversity = 1;
spin_lock_init(&common->cc_lock); spin_lock_init(&common->cc_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment