mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: sync with upstream changes
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+33
-40
@@ -67,39 +67,6 @@ static const struct ieee80211_iface_combination if_comb[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static void
|
||||
mt7915_init_txpower(struct mt7915_dev *dev,
|
||||
struct ieee80211_supported_band *sband)
|
||||
{
|
||||
int i, n_chains = hweight8(dev->mphy.antenna_mask);
|
||||
int nss_delta = mt76_tx_power_nss_delta(n_chains);
|
||||
int pwr_delta = mt7915_eeprom_get_power_delta(dev, sband->band);
|
||||
struct mt76_power_limits limits;
|
||||
|
||||
for (i = 0; i < sband->n_channels; i++) {
|
||||
struct ieee80211_channel *chan = &sband->channels[i];
|
||||
u32 target_power = 0;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < n_chains; j++) {
|
||||
u32 val;
|
||||
|
||||
val = mt7915_eeprom_get_target_power(dev, chan, j);
|
||||
target_power = max(target_power, val);
|
||||
}
|
||||
|
||||
target_power += pwr_delta;
|
||||
target_power = mt76_get_rate_power_limits(&dev->mphy, chan,
|
||||
&limits,
|
||||
target_power);
|
||||
target_power += nss_delta;
|
||||
target_power = DIV_ROUND_UP(target_power, 2);
|
||||
chan->max_power = min_t(int, chan->max_reg_power,
|
||||
target_power);
|
||||
chan->orig_mpwr = target_power;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mt7915_regd_notifier(struct wiphy *wiphy,
|
||||
struct regulatory_request *request)
|
||||
@@ -110,12 +77,8 @@ mt7915_regd_notifier(struct wiphy *wiphy,
|
||||
struct mt7915_phy *phy = mphy->priv;
|
||||
struct cfg80211_chan_def *chandef = &mphy->chandef;
|
||||
|
||||
memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
|
||||
dev->mt76.region = request->dfs_region;
|
||||
|
||||
mt7915_init_txpower(dev, &mphy->sband_2g.sband);
|
||||
mt7915_init_txpower(dev, &mphy->sband_5g.sband);
|
||||
|
||||
if (!(chandef->chan->flags & IEEE80211_CHAN_RADAR))
|
||||
return;
|
||||
|
||||
@@ -247,6 +210,38 @@ static int mt7915_txbf_init(struct mt7915_dev *dev)
|
||||
return mt7915_mcu_set_txbf_type(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
mt7915_init_txpower_band(struct mt7915_dev *dev,
|
||||
struct ieee80211_supported_band *sband)
|
||||
{
|
||||
int i, n_chains = hweight8(dev->mphy.antenna_mask);
|
||||
|
||||
for (i = 0; i < sband->n_channels; i++) {
|
||||
struct ieee80211_channel *chan = &sband->channels[i];
|
||||
u32 target_power = 0;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < n_chains; j++) {
|
||||
u32 val;
|
||||
|
||||
val = mt7915_eeprom_get_target_power(dev, chan, j);
|
||||
target_power = max(target_power, val);
|
||||
}
|
||||
|
||||
chan->max_power = min_t(int, chan->max_reg_power,
|
||||
target_power / 2);
|
||||
chan->orig_mpwr = target_power / 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void mt7915_init_txpower(struct mt7915_dev *dev)
|
||||
{
|
||||
mt7915_init_txpower_band(dev, &dev->mphy.sband_2g.sband);
|
||||
mt7915_init_txpower_band(dev, &dev->mphy.sband_5g.sband);
|
||||
|
||||
mt7915_eeprom_init_sku(dev);
|
||||
}
|
||||
|
||||
static int mt7915_register_ext_phy(struct mt7915_dev *dev)
|
||||
{
|
||||
struct mt7915_phy *phy = mt7915_ext_phy(dev);
|
||||
@@ -303,8 +298,7 @@ static void mt7915_init_work(struct work_struct *work)
|
||||
|
||||
mt7915_mcu_set_eeprom(dev);
|
||||
mt7915_mac_init(dev);
|
||||
mt7915_init_txpower(dev, &dev->mphy.sband_2g.sband);
|
||||
mt7915_init_txpower(dev, &dev->mphy.sband_5g.sband);
|
||||
mt7915_init_txpower(dev);
|
||||
mt7915_txbf_init(dev);
|
||||
}
|
||||
|
||||
@@ -403,7 +397,6 @@ static int mt7915_init_hardware(struct mt7915_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void mt7915_set_stream_vht_txbf_caps(struct mt7915_phy *phy)
|
||||
{
|
||||
int nss;
|
||||
|
||||
Reference in New Issue
Block a user