Commit 5048e8c3 authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville

ath9k: move update tx power to common

move ath_update_txpow to common to remove code duplication
in both ath9k & ath9k_htc.
Signed-off-by: default avatarRajkumar Manoharan <rmanoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c344c9cb
...@@ -189,6 +189,17 @@ void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, ...@@ -189,6 +189,17 @@ void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
} }
EXPORT_SYMBOL(ath9k_cmn_btcoex_bt_stomp); EXPORT_SYMBOL(ath9k_cmn_btcoex_bt_stomp);
void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
u16 new_txpow, u16 *txpower)
{
if (cur_txpow != new_txpow) {
ath9k_hw_set_txpowerlimit(ah, new_txpow, false);
/* read back in case value is clamped */
*txpower = ath9k_hw_regulatory(ah)->power_limit;
}
}
EXPORT_SYMBOL(ath9k_cmn_update_txpow);
static int __init ath9k_cmn_init(void) static int __init ath9k_cmn_init(void)
{ {
return 0; return 0;
......
...@@ -68,3 +68,5 @@ struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw, ...@@ -68,3 +68,5 @@ struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
int ath9k_cmn_count_streams(unsigned int chainmask, int max); int ath9k_cmn_count_streams(unsigned int chainmask, int max);
void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common, void ath9k_cmn_btcoex_bt_stomp(struct ath_common *common,
enum ath_stomp_type stomp_type); enum ath_stomp_type stomp_type);
void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
u16 new_txpow, u16 *txpower);
...@@ -18,17 +18,6 @@ ...@@ -18,17 +18,6 @@
#include "ath9k.h" #include "ath9k.h"
#include "btcoex.h" #include "btcoex.h"
static void ath_update_txpow(struct ath_softc *sc)
{
struct ath_hw *ah = sc->sc_ah;
if (sc->curtxpow != sc->config.txpowlimit) {
ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false);
/* read back in case value is clamped */
sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit;
}
}
static u8 parse_mpdudensity(u8 mpdudensity) static u8 parse_mpdudensity(u8 mpdudensity)
{ {
/* /*
...@@ -271,7 +260,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, ...@@ -271,7 +260,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
goto ps_restore; goto ps_restore;
} }
ath_update_txpow(sc); ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
ath9k_hw_set_interrupts(ah, ah->imask); ath9k_hw_set_interrupts(ah, ah->imask);
if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) { if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) {
...@@ -863,7 +853,8 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) ...@@ -863,7 +853,8 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw)
channel->center_freq, r); channel->center_freq, r);
} }
ath_update_txpow(sc); ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
if (ath_startrecv(sc) != 0) { if (ath_startrecv(sc) != 0) {
ath_err(common, "Unable to restart recv logic\n"); ath_err(common, "Unable to restart recv logic\n");
goto out; goto out;
...@@ -966,7 +957,8 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) ...@@ -966,7 +957,8 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
* that changes the channel so update any state that * that changes the channel so update any state that
* might change as a result. * might change as a result.
*/ */
ath_update_txpow(sc); ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL))) if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL)))
ath_beacon_config(sc, NULL); /* restart beacons */ ath_beacon_config(sc, NULL); /* restart beacons */
...@@ -1042,7 +1034,8 @@ static int ath9k_start(struct ieee80211_hw *hw) ...@@ -1042,7 +1034,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
* This is needed only to setup initial state * This is needed only to setup initial state
* but it's best done after a reset. * but it's best done after a reset.
*/ */
ath_update_txpow(sc); ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
/* /*
* Setup the hardware after reset: * Setup the hardware after reset:
...@@ -1707,7 +1700,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) ...@@ -1707,7 +1700,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
sc->config.txpowlimit = 2 * conf->power_level; sc->config.txpowlimit = 2 * conf->power_level;
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
ath_update_txpow(sc); ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
} }
......
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