Commit 9e5f6dd7 authored by Felix Fietkau's avatar Felix Fietkau

mt76: move txpower_conf back to driver specific structs

Nothing in the core uses it
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent db7aa188
...@@ -534,7 +534,6 @@ struct mt76_dev { ...@@ -534,7 +534,6 @@ struct mt76_dev {
struct mt76_hw_cap cap; struct mt76_hw_cap cap;
struct mt76_rate_power rate_power; struct mt76_rate_power rate_power;
int txpower_conf;
int txpower_cur; int txpower_cur;
enum nl80211_dfs_regions region; enum nl80211_dfs_regions region;
......
...@@ -44,7 +44,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed) ...@@ -44,7 +44,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
dev->mt76.txpower_conf = hw->conf.power_level * 2; dev->txpower_conf = hw->conf.power_level * 2;
if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
mt76x0_phy_set_txpower(dev); mt76x0_phy_set_txpower(dev);
......
...@@ -848,7 +848,7 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) ...@@ -848,7 +848,7 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev)
mt76x0_get_power_info(dev, dev->mphy.chandef.chan, &info); mt76x0_get_power_info(dev, dev->mphy.chandef.chan, &info);
mt76x02_add_rate_power_offset(t, info); mt76x02_add_rate_power_offset(t, info);
mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); mt76x02_limit_rate_power(t, dev->txpower_conf);
dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t);
mt76x02_add_rate_power_offset(t, -info); mt76x02_add_rate_power_offset(t, -info);
......
...@@ -108,6 +108,7 @@ struct mt76x02_dev { ...@@ -108,6 +108,7 @@ struct mt76x02_dev {
struct mt76x02_calibration cal; struct mt76x02_calibration cal;
int txpower_conf;
s8 target_power; s8 target_power;
s8 target_power_delta[2]; s8 target_power_delta[2];
bool enable_tpc; bool enable_tpc;
......
...@@ -386,7 +386,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, ...@@ -386,7 +386,7 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate); max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate);
} }
txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->mt76.txpower_conf, txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->txpower_conf,
max_txpwr_adj); max_txpwr_adj);
txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj); txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj);
......
...@@ -96,7 +96,7 @@ s8 mt76x02_tx_get_max_txpwr_adj(struct mt76x02_dev *dev, ...@@ -96,7 +96,7 @@ s8 mt76x02_tx_get_max_txpwr_adj(struct mt76x02_dev *dev,
s8 mt76x02_tx_get_txpwr_adj(struct mt76x02_dev *dev, s8 txpwr, s8 max_txpwr_adj) s8 mt76x02_tx_get_txpwr_adj(struct mt76x02_dev *dev, s8 txpwr, s8 max_txpwr_adj)
{ {
txpwr = min_t(s8, txpwr, dev->mt76.txpower_conf); txpwr = min_t(s8, txpwr, dev->txpower_conf);
txpwr -= (dev->target_power + dev->target_power_delta[0]); txpwr -= (dev->target_power + dev->target_power_delta[0]);
txpwr = min_t(s8, txpwr, max_txpwr_adj); txpwr = min_t(s8, txpwr, max_txpwr_adj);
......
...@@ -86,14 +86,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed) ...@@ -86,14 +86,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
dev->mt76.txpower_conf = hw->conf.power_level * 2; dev->txpower_conf = hw->conf.power_level * 2;
/* convert to per-chain power for 2x2 devices */ /* convert to per-chain power for 2x2 devices */
dev->mt76.txpower_conf -= 6; dev->txpower_conf -= 6;
if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) { if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) {
mt76x2_phy_set_txpower(dev); mt76x2_phy_set_txpower(dev);
mt76x02_tx_set_txpwr_auto(dev, dev->mt76.txpower_conf); mt76x02_tx_set_txpwr_auto(dev, dev->txpower_conf);
} }
} }
......
...@@ -152,7 +152,7 @@ void mt76x2_phy_set_txpower(struct mt76x02_dev *dev) ...@@ -152,7 +152,7 @@ void mt76x2_phy_set_txpower(struct mt76x02_dev *dev)
mt76x2_get_rate_power(dev, &t, chan); mt76x2_get_rate_power(dev, &t, chan);
mt76x02_add_rate_power_offset(&t, txp.target_power + delta); mt76x02_add_rate_power_offset(&t, txp.target_power + delta);
mt76x02_limit_rate_power(&t, dev->mt76.txpower_conf); mt76x02_limit_rate_power(&t, dev->txpower_conf);
dev->mt76.txpower_cur = mt76x02_get_max_rate_power(&t); dev->mt76.txpower_cur = mt76x02_get_max_rate_power(&t);
base_power = mt76x2_get_min_rate_power(&t); base_power = mt76x2_get_min_rate_power(&t);
......
...@@ -78,10 +78,10 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed) ...@@ -78,10 +78,10 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
} }
if (changed & IEEE80211_CONF_CHANGE_POWER) { if (changed & IEEE80211_CONF_CHANGE_POWER) {
dev->mt76.txpower_conf = hw->conf.power_level * 2; dev->txpower_conf = hw->conf.power_level * 2;
/* convert to per-chain power for 2x2 devices */ /* convert to per-chain power for 2x2 devices */
dev->mt76.txpower_conf -= 6; dev->txpower_conf -= 6;
if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
mt76x2_phy_set_txpower(dev); mt76x2_phy_set_txpower(dev);
......
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