mt7603: fix configuration for HT40

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2018-01-30 10:23:03 +01:00
parent 9659c8c19c
commit d225fa72b8
2 changed files with 14 additions and 3 deletions
+3 -1
View File
@@ -127,11 +127,13 @@ mt7603_set_channel(struct mt7603_dev *dev, struct cfg80211_chan_def *def)
{
u8 *rssi_data = (u8 *) dev->mt76.eeprom.data;
int idx, ret;
u8 bw = MT_BW_20;
mt7603_mac_stop(dev);
if (def->width == NL80211_CHAN_WIDTH_40)
bw = MT_BW_40;
dev->mt76.chandef = *def;
mt76_rmw_field(dev, MT_AGG_BWCR, MT_AGG_BWCR_BW, bw);
ret = mt7603_mcu_set_channel(dev);
+11 -2
View File
@@ -470,6 +470,7 @@ static int mt7603_mcu_set_tx_power(struct mt7603_dev *dev)
int mt7603_mcu_set_channel(struct mt7603_dev *dev)
{
struct cfg80211_chan_def *chandef = &dev->mt76.chandef;
struct {
u8 control_chan;
u8 center_chan;
@@ -480,8 +481,8 @@ int mt7603_mcu_set_channel(struct mt7603_dev *dev)
u8 txpower[21];
u8 _res1[3];
} req = {
.control_chan = dev->mt76.chandef.chan->hw_value,
.center_chan = dev->mt76.chandef.chan->hw_value,
.control_chan = chandef->chan->hw_value,
.center_chan = chandef->chan->hw_value,
.bw = MT_BW_20,
.tx_streams = dev->tx_chains,
.rx_streams = dev->rx_chains,
@@ -489,6 +490,14 @@ int mt7603_mcu_set_channel(struct mt7603_dev *dev)
struct sk_buff *skb;
int ret;
if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_40) {
req.bw = MT_BW_40;
if (chandef->center_freq1 > chandef->chan->center_freq)
req.center_chan += 2;
else
req.center_chan -= 2;
}
memset(req.txpower, 0xff, sizeof(req.txpower));
skb = mt7603_mcu_msg_alloc(&req, sizeof(req));
ret = mt7603_mcu_msg_send(dev, skb, MCU_EXT_CMD_CHANNEL_SWITCH, MCU_Q_SET, NULL);