diff options
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ar9003_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 55 |
2 files changed, 54 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index fc67844a143..759f5f5a715 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -1360,7 +1360,7 @@ static void ar9003_hw_antctrl_shared_chain_lnadiv(struct ath_hw *ah, | |||
1360 | if (enable) { | 1360 | if (enable) { |
1361 | REG_SET_BIT(ah, AR_PHY_MC_GAIN_CTRL, | 1361 | REG_SET_BIT(ah, AR_PHY_MC_GAIN_CTRL, |
1362 | (1 << AR_PHY_ANT_SW_RX_PROT_S)); | 1362 | (1 << AR_PHY_ANT_SW_RX_PROT_S)); |
1363 | if (IS_CHAN_2GHZ(ah->curchan)) | 1363 | if (ah->curchan && IS_CHAN_2GHZ(ah->curchan)) |
1364 | REG_SET_BIT(ah, AR_PHY_RESTART, | 1364 | REG_SET_BIT(ah, AR_PHY_RESTART, |
1365 | AR_PHY_RESTART_ENABLE_DIV_M2FLAG); | 1365 | AR_PHY_RESTART_ENABLE_DIV_M2FLAG); |
1366 | REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, | 1366 | REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index ab3bc85a1f8..ed38216c3ca 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -222,6 +222,57 @@ static const struct file_operations fops_disable_ani = { | |||
222 | .llseek = default_llseek, | 222 | .llseek = default_llseek, |
223 | }; | 223 | }; |
224 | 224 | ||
225 | static ssize_t read_file_ant_diversity(struct file *file, char __user *user_buf, | ||
226 | size_t count, loff_t *ppos) | ||
227 | { | ||
228 | struct ath_softc *sc = file->private_data; | ||
229 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
230 | char buf[32]; | ||
231 | unsigned int len; | ||
232 | |||
233 | len = sprintf(buf, "%d\n", common->antenna_diversity); | ||
234 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
235 | } | ||
236 | |||
237 | static ssize_t write_file_ant_diversity(struct file *file, | ||
238 | const char __user *user_buf, | ||
239 | size_t count, loff_t *ppos) | ||
240 | { | ||
241 | struct ath_softc *sc = file->private_data; | ||
242 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | ||
243 | unsigned long antenna_diversity; | ||
244 | char buf[32]; | ||
245 | ssize_t len; | ||
246 | |||
247 | len = min(count, sizeof(buf) - 1); | ||
248 | if (copy_from_user(buf, user_buf, len)) | ||
249 | return -EFAULT; | ||
250 | |||
251 | if (!AR_SREV_9565(sc->sc_ah)) | ||
252 | goto exit; | ||
253 | |||
254 | buf[len] = '\0'; | ||
255 | if (strict_strtoul(buf, 0, &antenna_diversity)) | ||
256 | return -EINVAL; | ||
257 | |||
258 | common->antenna_diversity = !!antenna_diversity; | ||
259 | ath9k_ps_wakeup(sc); | ||
260 | ath_ant_comb_update(sc); | ||
261 | ath_dbg(common, CONFIG, "Antenna diversity: %d\n", | ||
262 | common->antenna_diversity); | ||
263 | ath9k_ps_restore(sc); | ||
264 | exit: | ||
265 | return count; | ||
266 | } | ||
267 | |||
268 | static const struct file_operations fops_ant_diversity = { | ||
269 | .read = read_file_ant_diversity, | ||
270 | .write = write_file_ant_diversity, | ||
271 | .open = simple_open, | ||
272 | .owner = THIS_MODULE, | ||
273 | .llseek = default_llseek, | ||
274 | }; | ||
275 | |||
225 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, | 276 | static ssize_t read_file_dma(struct file *file, char __user *user_buf, |
226 | size_t count, loff_t *ppos) | 277 | size_t count, loff_t *ppos) |
227 | { | 278 | { |
@@ -1599,12 +1650,12 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1599 | debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc, | 1650 | debugfs_create_file("samples", S_IRUSR, sc->debug.debugfs_phy, sc, |
1600 | &fops_samps); | 1651 | &fops_samps); |
1601 | #endif | 1652 | #endif |
1602 | |||
1603 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, | 1653 | debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR, |
1604 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); | 1654 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask); |
1605 | |||
1606 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, | 1655 | debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR, |
1607 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); | 1656 | sc->debug.debugfs_phy, &sc->sc_ah->gpio_val); |
1657 | debugfs_create_file("diversity", S_IRUSR | S_IWUSR, | ||
1658 | sc->debug.debugfs_phy, sc, &fops_ant_diversity); | ||
1608 | 1659 | ||
1609 | return 0; | 1660 | return 0; |
1610 | } | 1661 | } |