mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: partially move channel change code to core
This allows the core code to change the channel. Code deduplication and preparation for adding scanning code to the core. Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
+7
-18
@@ -32,33 +32,25 @@ mt76x2_stop(struct ieee80211_hw *hw)
|
||||
mt76x2_stop_hardware(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
|
||||
int mt76x2e_set_channel(struct mt76_phy *phy)
|
||||
{
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
struct mt76x02_dev *dev = container_of(phy->dev, struct mt76x02_dev, mt76);
|
||||
|
||||
tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
|
||||
tasklet_disable(&dev->dfs_pd.dfs_tasklet);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
set_bit(MT76_RESET, &dev->mphy.state);
|
||||
|
||||
mt76_set_channel(&dev->mphy);
|
||||
|
||||
mt76x2_mac_stop(dev, true);
|
||||
mt76x2_phy_set_channel(dev, chandef);
|
||||
mt76x2_phy_set_channel(dev, &phy->chandef);
|
||||
|
||||
mt76x02_mac_cc_reset(dev);
|
||||
mt76x02_dfs_init_params(dev);
|
||||
|
||||
mt76x2_mac_resume(dev);
|
||||
|
||||
clear_bit(MT76_RESET, &dev->mphy.state);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
tasklet_enable(&dev->dfs_pd.dfs_tasklet);
|
||||
tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
|
||||
|
||||
mt76_txq_schedule_all(&dev->mphy);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -95,11 +87,8 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
|
||||
ieee80211_stop_queues(hw);
|
||||
mt76x2_set_channel(dev, &hw->conf.chandef);
|
||||
ieee80211_wake_queues(hw);
|
||||
}
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL)
|
||||
mt76_update_channel(&dev->mphy);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user