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:
@@ -47,6 +47,8 @@ void mt76x2_phy_power_on(struct mt76x02_dev *dev);
|
||||
void mt76x2_stop_hardware(struct mt76x02_dev *dev);
|
||||
int mt76x2_eeprom_init(struct mt76x02_dev *dev);
|
||||
int mt76x2_apply_calibration_data(struct mt76x02_dev *dev, int channel);
|
||||
int mt76x2e_set_channel(struct mt76_phy *phy);
|
||||
int mt76x2u_set_channel(struct mt76_phy *phy);
|
||||
|
||||
void mt76x2_phy_set_antenna(struct mt76x02_dev *dev);
|
||||
int mt76x2_phy_start(struct mt76x02_dev *dev);
|
||||
|
||||
@@ -25,6 +25,7 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
MT_DRV_SW_RX_AIRTIME,
|
||||
.survey_flags = SURVEY_INFO_TIME_TX,
|
||||
.update_survey = mt76x02_update_channel,
|
||||
.set_channel = mt76x2e_set_channel,
|
||||
.tx_prepare_skb = mt76x02_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02_tx_complete_skb,
|
||||
.rx_skb = mt76x02_queue_rx_skb,
|
||||
|
||||
+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;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ static int mt76x2u_probe(struct usb_interface *intf,
|
||||
.drv_flags = MT_DRV_SW_RX_AIRTIME,
|
||||
.survey_flags = SURVEY_INFO_TIME_TX,
|
||||
.update_survey = mt76x02_update_channel,
|
||||
.set_channel = mt76x2u_set_channel,
|
||||
.tx_prepare_skb = mt76x02u_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02u_tx_complete_skb,
|
||||
.tx_status_data = mt76x02_tx_status_data,
|
||||
|
||||
+5
-20
@@ -31,32 +31,20 @@ static void mt76x2u_stop(struct ieee80211_hw *hw)
|
||||
mt76x2u_stop_hw(dev);
|
||||
}
|
||||
|
||||
static int
|
||||
mt76x2u_set_channel(struct mt76x02_dev *dev,
|
||||
struct cfg80211_chan_def *chandef)
|
||||
int mt76x2u_set_channel(struct mt76_phy *mphy)
|
||||
{
|
||||
struct mt76x02_dev *dev = container_of(mphy->dev, struct mt76x02_dev, mt76);
|
||||
int err;
|
||||
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
mt76x02_pre_tbtt_enable(dev, false);
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
set_bit(MT76_RESET, &dev->mphy.state);
|
||||
|
||||
mt76_set_channel(&dev->mphy);
|
||||
|
||||
mt76x2_mac_stop(dev, false);
|
||||
|
||||
err = mt76x2u_phy_set_channel(dev, chandef);
|
||||
err = mt76x2u_phy_set_channel(dev, &mphy->chandef);
|
||||
|
||||
mt76x02_mac_cc_reset(dev);
|
||||
mt76x2_mac_resume(dev);
|
||||
|
||||
clear_bit(MT76_RESET, &dev->mphy.state);
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
mt76x02_pre_tbtt_enable(dev, true);
|
||||
mt76_txq_schedule_all(&dev->mphy);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -93,11 +81,8 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
|
||||
|
||||
mutex_unlock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
|
||||
ieee80211_stop_queues(hw);
|
||||
err = mt76x2u_set_channel(dev, &hw->conf.chandef);
|
||||
ieee80211_wake_queues(hw);
|
||||
}
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL)
|
||||
mt76_update_channel(&dev->mphy);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user