Commit 9313faac authored by Felix Fietkau's avatar Felix Fietkau

mt76: move mt76x02_get_txpower to mt76 core

It will be reused by mt7603 later
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent f545540d
...@@ -710,3 +710,21 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -710,3 +710,21 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mt76_sta_state); EXPORT_SYMBOL_GPL(mt76_sta_state);
int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int *dbm)
{
struct mt76_dev *dev = hw->priv;
int n_chains = __sw_hweight8(dev->antenna_mask);
*dbm = dev->txpower_cur / 2;
/* convert from per-chain power to combined
* output on 2x2 devices
*/
if (n_chains > 1)
*dbm += 3;
return 0;
}
EXPORT_SYMBOL_GPL(mt76_get_txpower);
...@@ -680,6 +680,9 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -680,6 +680,9 @@ int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *mt76_rx_convert(struct sk_buff *skb); struct ieee80211_sta *mt76_rx_convert(struct sk_buff *skb);
int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
int *dbm);
/* internal */ /* internal */
void mt76_tx_free(struct mt76_dev *dev); void mt76_tx_free(struct mt76_dev *dev);
struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev); struct mt76_txwi_cache *mt76_get_txwi(struct mt76_dev *dev);
......
...@@ -99,7 +99,7 @@ static const struct ieee80211_ops mt76x0e_ops = { ...@@ -99,7 +99,7 @@ static const struct ieee80211_ops mt76x0e_ops = {
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.wake_tx_queue = mt76_wake_tx_queue, .wake_tx_queue = mt76_wake_tx_queue,
.get_survey = mt76_get_survey, .get_survey = mt76_get_survey,
.get_txpower = mt76x02_get_txpower, .get_txpower = mt76_get_txpower,
.flush = mt76x0e_flush, .flush = mt76x0e_flush,
.set_tim = mt76x0e_set_tim, .set_tim = mt76x0e_set_tim,
.release_buffered_frames = mt76_release_buffered_frames, .release_buffered_frames = mt76_release_buffered_frames,
......
...@@ -155,7 +155,7 @@ static const struct ieee80211_ops mt76x0u_ops = { ...@@ -155,7 +155,7 @@ static const struct ieee80211_ops mt76x0u_ops = {
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.set_rts_threshold = mt76x02_set_rts_threshold, .set_rts_threshold = mt76x02_set_rts_threshold,
.wake_tx_queue = mt76_wake_tx_queue, .wake_tx_queue = mt76_wake_tx_queue,
.get_txpower = mt76x02_get_txpower, .get_txpower = mt76_get_txpower,
}; };
static int mt76x0u_register_device(struct mt76x02_dev *dev) static int mt76x0u_register_device(struct mt76x02_dev *dev)
......
...@@ -172,8 +172,6 @@ void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -172,8 +172,6 @@ void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const u8 *mac); const u8 *mac);
void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
int mt76x02_get_txpower(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, int *dbm);
void mt76x02_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps); void mt76x02_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps);
void mt76x02_bss_info_changed(struct ieee80211_hw *hw, void mt76x02_bss_info_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
......
...@@ -607,24 +607,6 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, ...@@ -607,24 +607,6 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
} }
EXPORT_SYMBOL_GPL(mt76x02_sw_scan_complete); EXPORT_SYMBOL_GPL(mt76x02_sw_scan_complete);
int mt76x02_get_txpower(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, int *dbm)
{
struct mt76x02_dev *dev = hw->priv;
u8 nstreams = dev->mt76.chainmask & 0xf;
*dbm = dev->mt76.txpower_cur / 2;
/* convert from per-chain power to combined
* output on 2x2 devices
*/
if (nstreams > 1)
*dbm += 3;
return 0;
}
EXPORT_SYMBOL_GPL(mt76x02_get_txpower);
void mt76x02_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, void mt76x02_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta,
bool ps) bool ps)
{ {
......
...@@ -191,7 +191,7 @@ const struct ieee80211_ops mt76x2_ops = { ...@@ -191,7 +191,7 @@ const struct ieee80211_ops mt76x2_ops = {
.sw_scan_complete = mt76x02_sw_scan_complete, .sw_scan_complete = mt76x02_sw_scan_complete,
.flush = mt76x2_flush, .flush = mt76x2_flush,
.ampdu_action = mt76x02_ampdu_action, .ampdu_action = mt76x02_ampdu_action,
.get_txpower = mt76x02_get_txpower, .get_txpower = mt76_get_txpower,
.wake_tx_queue = mt76_wake_tx_queue, .wake_tx_queue = mt76_wake_tx_queue,
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.release_buffered_frames = mt76_release_buffered_frames, .release_buffered_frames = mt76_release_buffered_frames,
......
...@@ -138,5 +138,5 @@ const struct ieee80211_ops mt76x2u_ops = { ...@@ -138,5 +138,5 @@ const struct ieee80211_ops mt76x2u_ops = {
.sw_scan_start = mt76x02_sw_scan, .sw_scan_start = mt76x02_sw_scan,
.sw_scan_complete = mt76x02_sw_scan_complete, .sw_scan_complete = mt76x02_sw_scan_complete,
.sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
.get_txpower = mt76x02_get_txpower, .get_txpower = mt76_get_txpower,
}; };
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