aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2018-10-12 06:16:28 -0400
committerFelix Fietkau <nbd@nbd.name>2018-10-13 11:39:53 -0400
commitbbd10586f0df1a3ff6abda39c9542458fdfc5686 (patch)
treeb2855d6470648544424044527a87c2309180aaba /drivers/net/wireless
parent4636a2544c3b79b95115bd612455de7c176dadcf (diff)
mt76x0: phy: do not run calibration during channel switch
Do not perform phy/vga calibration during channel switch. Moreover remove mt76x0_agc_save and mt76x0_agc_restore routines since they are no longer necessary. Furthermore run mt76_set_channel in order to check if there are pending frames during channel switch Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/main.c22
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h2
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x0/phy.c23
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt76x02.h2
4 files changed, 23 insertions, 26 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
index c9cd0254a979..9273d2d2764a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/main.c
@@ -16,6 +16,20 @@
16#include <linux/etherdevice.h> 16#include <linux/etherdevice.h>
17#include "mt76x0.h" 17#include "mt76x0.h"
18 18
19static int
20mt76x0_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
21{
22 int ret;
23
24 cancel_delayed_work_sync(&dev->cal_work);
25
26 mt76_set_channel(&dev->mt76);
27 ret = mt76x0_phy_set_channel(dev, chandef);
28 mt76_txq_schedule_all(&dev->mt76);
29
30 return ret;
31}
32
19int mt76x0_config(struct ieee80211_hw *hw, u32 changed) 33int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
20{ 34{
21 struct mt76x02_dev *dev = hw->priv; 35 struct mt76x02_dev *dev = hw->priv;
@@ -25,7 +39,7 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
25 39
26 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { 40 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
27 ieee80211_stop_queues(hw); 41 ieee80211_stop_queues(hw);
28 ret = mt76x0_phy_set_channel(dev, &hw->conf.chandef); 42 ret = mt76x0_set_channel(dev, &hw->conf.chandef);
29 ieee80211_wake_queues(hw); 43 ieee80211_wake_queues(hw);
30 } 44 }
31 45
@@ -114,8 +128,6 @@ void mt76x0_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
114{ 128{
115 struct mt76x02_dev *dev = hw->priv; 129 struct mt76x02_dev *dev = hw->priv;
116 130
117 cancel_delayed_work_sync(&dev->cal_work);
118 mt76x0_agc_save(dev);
119 set_bit(MT76_SCANNING, &dev->mt76.state); 131 set_bit(MT76_SCANNING, &dev->mt76.state);
120} 132}
121EXPORT_SYMBOL_GPL(mt76x0_sw_scan); 133EXPORT_SYMBOL_GPL(mt76x0_sw_scan);
@@ -125,11 +137,7 @@ void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
125{ 137{
126 struct mt76x02_dev *dev = hw->priv; 138 struct mt76x02_dev *dev = hw->priv;
127 139
128 mt76x0_agc_restore(dev);
129 clear_bit(MT76_SCANNING, &dev->mt76.state); 140 clear_bit(MT76_SCANNING, &dev->mt76.state);
130
131 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
132 MT_CALIBRATE_INTERVAL);
133} 141}
134EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete); 142EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete);
135 143
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
index 6717d83e0ff6..2187bafaf2e9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
@@ -66,8 +66,6 @@ int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
66/* PHY */ 66/* PHY */
67void mt76x0_phy_init(struct mt76x02_dev *dev); 67void mt76x0_phy_init(struct mt76x02_dev *dev);
68int mt76x0_wait_bbp_ready(struct mt76x02_dev *dev); 68int mt76x0_wait_bbp_ready(struct mt76x02_dev *dev);
69void mt76x0_agc_save(struct mt76x02_dev *dev);
70void mt76x0_agc_restore(struct mt76x02_dev *dev);
71int mt76x0_phy_set_channel(struct mt76x02_dev *dev, 69int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
72 struct cfg80211_chan_def *chandef); 70 struct cfg80211_chan_def *chandef);
73void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev); 71void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
index 3d0fcf8c34b4..cf024950e0ed 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
@@ -723,17 +723,21 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
723 723
724 if (mt76_is_usb(dev)) { 724 if (mt76_is_usb(dev)) {
725 mt76x0_vco_cal(dev, channel); 725 mt76x0_vco_cal(dev, channel);
726 if (scan)
727 mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1,
728 false);
729 } else { 726 } else {
730 /* enable vco */ 727 /* enable vco */
731 rf_set(dev, MT_RF(0, 4), BIT(7)); 728 rf_set(dev, MT_RF(0, 4), BIT(7));
732 mt76x0_phy_calibrate(dev, false);
733 } 729 }
734 730
731 if (scan)
732 return 0;
733
734 if (mt76_is_mmio(dev))
735 mt76x0_phy_calibrate(dev, false);
735 mt76x0_phy_set_txpower(dev); 736 mt76x0_phy_set_txpower(dev);
736 737
738 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
739 MT_CALIBRATE_INTERVAL);
740
737 return 0; 741 return 0;
738} 742}
739 743
@@ -770,17 +774,6 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
770 mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false); 774 mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false);
771} 775}
772 776
773void mt76x0_agc_save(struct mt76x02_dev *dev)
774{
775 /* Only one RX path */
776 dev->agc_save = FIELD_GET(MT_BBP_AGC_GAIN, mt76_rr(dev, MT_BBP(AGC, 8)));
777}
778
779void mt76x0_agc_restore(struct mt76x02_dev *dev)
780{
781 mt76_rmw_field(dev, MT_BBP(AGC, 8), MT_BBP_AGC_GAIN, dev->agc_save);
782}
783
784static void mt76x0_temp_sensor(struct mt76x02_dev *dev) 777static void mt76x0_temp_sensor(struct mt76x02_dev *dev)
785{ 778{
786 u8 rf_b7_73, rf_b0_66, rf_b0_67; 779 u8 rf_b7_73, rf_b0_66, rf_b0_67;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index f375fdcbd2bf..47c42c607964 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -102,8 +102,6 @@ struct mt76x02_dev {
102 102
103 bool no_2ghz; 103 bool no_2ghz;
104 104
105 u8 agc_save;
106
107 u8 coverage_class; 105 u8 coverage_class;
108 u8 slottime; 106 u8 slottime;
109 107