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:
+8
-11
@@ -8,16 +8,15 @@
|
||||
#include <linux/etherdevice.h>
|
||||
#include "mt76x0.h"
|
||||
|
||||
static void
|
||||
mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
|
||||
int mt76x0_set_channel(struct mt76_phy *mphy)
|
||||
{
|
||||
cancel_delayed_work_sync(&dev->cal_work);
|
||||
struct mt76x02_dev *dev = container_of(mphy->dev, struct mt76x02_dev, mt76);
|
||||
|
||||
mt76x02_pre_tbtt_enable(dev, false);
|
||||
if (mt76_is_mmio(&dev->mt76))
|
||||
tasklet_disable(&dev->dfs_pd.dfs_tasklet);
|
||||
|
||||
mt76_set_channel(&dev->mphy);
|
||||
mt76x0_phy_set_channel(dev, chandef);
|
||||
mt76x0_phy_set_channel(dev, &mphy->chandef);
|
||||
|
||||
mt76x02_mac_cc_reset(dev);
|
||||
mt76x02_edcca_init(dev);
|
||||
@@ -28,8 +27,9 @@ mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
|
||||
}
|
||||
mt76x02_pre_tbtt_enable(dev, true);
|
||||
|
||||
mt76_txq_schedule_all(&dev->mphy);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(mt76x0_set_channel);
|
||||
|
||||
int mt76x0_set_sar_specs(struct ieee80211_hw *hw,
|
||||
const struct cfg80211_sar_specs *sar)
|
||||
@@ -63,11 +63,8 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
|
||||
|
||||
mutex_lock(&dev->mt76.mutex);
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
|
||||
ieee80211_stop_queues(hw);
|
||||
mt76x0_set_channel(dev, &hw->conf.chandef);
|
||||
ieee80211_wake_queues(hw);
|
||||
}
|
||||
if (changed & IEEE80211_CONF_CHANGE_CHANNEL)
|
||||
mt76_update_channel(&dev->mphy);
|
||||
|
||||
if (changed & IEEE80211_CONF_CHANGE_POWER) {
|
||||
struct mt76_phy *mphy = &dev->mphy;
|
||||
|
||||
@@ -49,6 +49,7 @@ void mt76x0_chip_onoff(struct mt76x02_dev *dev, bool enable, bool reset);
|
||||
void mt76x0_mac_stop(struct mt76x02_dev *dev);
|
||||
|
||||
int mt76x0_config(struct ieee80211_hw *hw, u32 changed);
|
||||
int mt76x0_set_channel(struct mt76_phy *mphy);
|
||||
int mt76x0_set_sar_specs(struct ieee80211_hw *hw,
|
||||
const struct cfg80211_sar_specs *sar);
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ mt76x0e_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 = mt76x0_set_channel,
|
||||
.tx_prepare_skb = mt76x02_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02_tx_complete_skb,
|
||||
.rx_skb = mt76x02_queue_rx_skb,
|
||||
|
||||
@@ -217,6 +217,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
|
||||
.drv_flags = MT_DRV_SW_RX_AIRTIME,
|
||||
.survey_flags = SURVEY_INFO_TIME_TX,
|
||||
.update_survey = mt76x02_update_channel,
|
||||
.set_channel = mt76x0_set_channel,
|
||||
.tx_prepare_skb = mt76x02u_tx_prepare_skb,
|
||||
.tx_complete_skb = mt76x02u_tx_complete_skb,
|
||||
.tx_status_data = mt76x02_tx_status_data,
|
||||
|
||||
Reference in New Issue
Block a user