Commit Graph
53 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau df23620dbd mt76: move mt76x2_tssi_enabled in mt76x02_eeprom.h
Move mt76x2_tssi_enabled and mt76x02_temp_tx_alc_enabled in
mt76x02_eeprom.h in order to be reused in mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 7556cb9355 mt76: move mt76x2_ext_pa_enabled routine in mt76x02_eeprom.c
Move mt76x2_ext_pa_enabled utility routine in mt76x02_eeprom.c
and remove duplicated code. This is a preliminary patch to
unify eeprom code between mt76x2 and mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 611b8c7bff mt76: move mt76x2_eeprom_get in mt76x02_eeprom.h
Move mt76x2_eeprom_get utility routine in mt76x02_eeprom.h since
it will be used to parse mt76x0 eeprom in order to unify eeprom
support between mt76x2 and mt76x0 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-21 18:05:35 +02:00
Lorenzo BianconiandFelix Fietkau 2b3b4df596 mt76x2: move mt76x2_phy_tssi_compensate in mt76x2-common module
Move mt76x2_phy_tssi_compensate routine in mt76x2-common module
since it is shared between mt76x2 and mt76x2u drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-09-12 13:16:50 +02:00
Lorenzo BianconiandFelix Fietkau ce91108826 mt76: move shared mcu_calibrate routine in mt76x02-lib module
Move mcu_calibrate routine in mt76x02-lib module since it is
shared between USB and PCI code. Moreover remove duplicated
code

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-09-12 13:16:50 +02:00
Lorenzo BianconiandFelix Fietkau a0cbd4b677 mt76: move mt76{0,2} mcu shared code in mt76x02_mcu.c
Move shared mt76x2/mt76x0 mcu shared code in a common file
and remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-09-12 13:16:50 +02:00
Lorenzo BianconiandFelix Fietkau 264edbe6df mt76: add mt76x2_phy_common to mt76x2-common module
Move phy related code shared between mt76x2 and mt76x2u in
mt76x2-common module

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 29f960aa27 mt76: add mt76x2_mac_common to mt76x2-common module
Move mac related code shared between mt76x2 and mt76x2u in
mt76x2-common module

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau c55d29bcf1 mt76x2: move utility routines in mt76x2.h
In order to reuse them supporting mt76x2u based devices, move
mt76x2_wait_for_mac, wait_for_wpdma and mt76x2_channel_silent in
mt76x2.h

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Felix Fietkau 1d4ca10a56 mt76x2: track rssi for gain adjustment per station
This preserves more sensitivity when weak stations are active

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-19 11:15:19 +02:00
Felix Fietkau f450659334 mt76x2: improve gain adjustment in noisy environments
When switching between low gain (high RSSI) and high gain settings, it
can take a few seconds to adjust to the current environment.
This can lead to short periods of time with extreme packet loss.

When switching from low_gain=1 to low_gain=2, start with the same gain
adjustment value instead of the lowest to avoid spikes of huge numbers
of false CCA events

Also avoid resetting adjustment values on switching between low_gain
values 0 and 1, since it affects only the upper limit of vga adjustment

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-18 12:27:02 +02:00
Felix Fietkau 65e161bec8 mt76x2: fix tracking rssi for dynamic gain adjustment
Only use unicast rssi, to avoid counting signal data from other
networks.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 20:49:55 +02:00
Felix Fietkau f3522e1d2b mt76x2: add a debugfs file to dump agc calibration information
Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 19:12:14 +02:00
Felix Fietkau 1528fe7f57 mt76x2: fix variable gain adjustment range
The range should only be limited to 4 for really weak signals, for all
other gain settings the range is 16.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 19:02:24 +02:00
Felix Fietkau 4936c0cef0 mt76x2: clear false CCA counters after changing gain settings
They will be read on the next calibration step without gain change and
must not count earlier events

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:56:58 +02:00
Felix Fietkau a39ab7043a mt76x2: adjust AGC control register 26 based on gain for VHT80
Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:41:20 +02:00
Felix Fietkau 2cbaa57a77 mt76x2: fix swapped values for RXO-18 in gain control
The lowest bit should be set to 0 only for strong links, not for weak
ones.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:28:53 +02:00
Felix Fietkau 9090f9c705 mt76x2: fix threshold for gain adjustment
The gain should be reduced only for very strong connections, not for mid
range.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:27:54 +02:00
Lorenzo BianconiandFelix Fietkau b2ecc529b4 mt76x2: fix avg_rssi estimation
Add leftover filter coefficients in IIR rssi estimation

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-05-03 13:38:49 +02:00
Lorenzo BianconiandFelix Fietkau 5153ece6b9 mt76x2: set default values in TX_ALC_CFG_{1,2} for tempetaure compensation
Initialize default values for temperature compensation in TX_ALC_CFG_{1,2}
if tssi has been enabled

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:14:39 +02:00
Lorenzo BianconiandFelix Fietkau 6e7d5ceb4f mt76x2: remove unnecessary MT_TX_ALC_CFG_4 configuration
Remove unnecessary MT_TX_ALC_CFG_4 configuration since the register value
will be properly set according to the usage of an external power amplifier

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-09 10:14:23 +02:00
Lorenzo BianconiandFelix Fietkau bc35af8213 mt76x2: fix tssi initialization for 5GHz band
Fix mcu initial configuration for tssi calibration on 5GHz band

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-03 21:36:16 +02:00
Lorenzo BianconiandFelix Fietkau ced433d006 mt76x2: add mac80211 {set,get}_antenna callbacks
Add capability to select tx/rx antennas. Possible values are:
 - 1: to use only the first antenna
 - 2: to use only the second antenna
 - 3: to use both of them

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-03-21 11:23:10 +01:00
Felix Fietkau 5ba59953c5 mt76x2: rework tx power handling
There were a number of issues in the existing tx power handling code:

1. The EEPROM target power for chain 0 refers to the actual output power
after the channel and bandwidth delta have been added to the initial
channel gain. This means the delta values should not be added/subtracted
for the rate power calculation

2. When power is reduced significantly, the initial channel gain
underflows very quickly, while the per-rate power offsets are high.
This miscalculation causes effective tx power to be increased when it
should actually be lowered.

Fix this by trying to adjust the channel gain to the lowest power from
the rate table. In case of under- or overflow, compensate by adding an
appropriate delta to the rate power values.

This makes power configuration more accurate on a wider range of
configurable values

Signed-off-by: Felix Fietkau <[email protected]>
2018-02-24 10:24:07 +01:00
Felix Fietkau 3bd7e76e2d mt76x2: initialize channel power limits
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-30 12:33:47 +01:00
Felix Fietkau 11f42a8aab mt76x2: add channel argument to eeprom tx power functions
Preparation for exposing maximum power to mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2017-11-30 12:16:39 +01:00
Felix Fietkau a51358e3ae mt76x2: increase OFDM SIFS time
Fixes throughput issues in combination with LDPC

Signed-off-by: Felix Fietkau <[email protected]>
2017-11-29 13:14:45 +01:00
Felix Fietkau 8f1c8abdf7 mt76x2: sync tx power related values with reference driver
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-16 19:48:52 +01:00
Felix Fietkau 70f2002651 mt76x2: add more gain tuning based on the latest reference driver
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-16 19:25:33 +01:00
Felix Fietkau 4af37bd999 mt76x2: implement dynamic AGC tuning based on false packet detection count
Significantly improves radio performance

Signed-off-by: Felix Fietkau <[email protected]>
2017-11-16 19:12:01 +01:00
Felix Fietkau efd7724b1a mt76x2: sync channel gain value with latest reference driver
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-16 18:31:06 +01:00
Felix Fietkau af425def8c mt76x2: fix LNA gain register annotation
Signed-off-by: Felix Fietkau <[email protected]>
2017-11-16 18:09:43 +01:00
Lorenzo BianconiandFelix Fietkau 9e7bb5309f mt76x2: phy: update dfs AGC parameters according to AGC_8 register
Signed-off-by: Lorenzo Bianconi <[email protected]>
2017-01-31 11:31:16 +01:00
Lorenzo BianconiandFelix Fietkau 6375fc1abe mt76x2: add hw radar detector
add hw DFS pattern detector support for mt76x2 based devices
DFS region supported:
 - FCC
 - ETSI
 - JAPAN_W53
 - JAPAN_W56

Signed-off-by: Lorenzo Bianconi <[email protected]>
2016-09-25 18:13:12 +02:00
Felix Fietkau d7f5112c09 mt76x2: fix checkpatch warnings
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 18:59:22 +02:00
Felix Fietkau b300bdc42e use the new bitfield accessor macros
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:37:26 +02:00
Felix Fietkau 53c1b7f6ac update my email address
Signed-off-by: Felix Fietkau <[email protected]>
2016-09-04 17:33:28 +02:00
Felix Fietkau ced81a3458 relicense to ISC (except for util.h which is based on GPL'd kernel code
Signed-off-by: Felix Fietkau <[email protected]>
2016-07-12 08:38:46 +02:00
Lorenzo BianconiandFelix Fietkau 9a75c6caa0 mt76x2: phy: fix typo in rate-power configuration
fix typo in MT_TX_PWR_CFG_7 configuration for OFDM_54M max
tx power adjustment

Signed-off-by: Lorenzo Bianconi <[email protected]>
2016-07-11 09:56:58 +02:00
Lorenzo BianconiandFelix Fietkau caff56f908 mt76x2: phy: cosmetics
replace spaces with tabs in mt76x2_phy_set_txpower()

Signed-off-by: Lorenzo Bianconi <[email protected]>
2016-07-11 09:56:49 +02:00
Felix Fietkau 267e959c84 move mt76 rate power struct to mt76.h
Signed-off-by: Felix Fietkau <[email protected]>
2016-06-17 12:45:39 +02:00
Felix Fietkau 3c8a4bc30e mt76x2: implement survey support
Signed-off-by: Felix Fietkau <[email protected]>
2016-06-15 16:47:23 +02:00
Felix Fietkau 6c4b37be98 move dev->chandef to mt76 struct
Signed-off-by: Felix Fietkau <[email protected]>
2016-06-15 15:47:49 +02:00
Felix Fietkau e4c05ba162 use nl80211_band instead of ieee80211_band
Signed-off-by: Felix Fietkau <[email protected]>
2016-05-14 16:51:44 +02:00
Felix Fietkau 13c29223ef Use NL80211_BAND_2GHZ instead of IEEE80211_BAND_2GHZ
Signed-off-by: Felix Fietkau <[email protected]>
2016-05-14 16:49:30 +02:00
Felix Fietkau 81c6ab2d8c mt76x2: remove some unused code
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 18:24:52 +01:00
Felix Fietkau 079ad90fe2 update copyright lines
Signed-off-by: Felix Fietkau <[email protected]>
2016-02-25 18:09:13 +01:00
Felix Fietkau 2044de5229 move mt76 state enum/storage to mt76.h
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 22:05:42 +01:00
Felix Fietkau b0f76bb5d9 move register poll functions to core
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 19:20:00 +01:00
Felix Fietkau 62ecfb9730 move more register accessor functions to mt76.h
Signed-off-by: Felix Fietkau <[email protected]>
2015-12-06 18:01:45 +01:00