aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9003_calib.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-03-25ath9k: use AR9300_MAX_CHAINS when appropriateWenli Looi1-1/+1
Replace other constants with AR9300_MAX_CHAINS when appropriate. This change does not appear to affect the final binary. Signed-off-by: Wenli Looi <wlooi@ucalgary.ca> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://lore.kernel.org/r/20220320233010.123106-4-wlooi@ucalgary.ca
2021-11-01ath9k: use swap() to make code cleanerYang Guang1-9/+5
Using swap() make it more readable. Reported-by: Zeal Robot <zealci@zte.com.cn> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20211028010451.7754-1-yang.guang5@zte.com.cn
2016-10-13Revert "ath9k_hw: implement temperature compensation support for AR9003+"Felix Fietkau1-22/+3
This reverts commit 171f6402e4aa ("ath9k_hw: implement temperature compensation support for AR9003+"). Some users report that this commit causes a regression in performance under some conditions. Fixes: 171f6402e4aa ("ath9k_hw: implement temperature compensation support for AR9003+") Cc: <stable@vger.kernel.org> # 4.8 Signed-off-by: Felix Fietkau <nbd@nbd.name> [kvalo@qca.qualcomm.com: improve commit log] Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-07-19ath9k_hw: implement temperature compensation support for AR9003+Felix Fietkau1-3/+22
Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-07-19ath9k_hw: get rid of some duplicate code in calibration initFelix Fietkau1-32/+22
Remove a misleading debug message as well Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-07-19ath9k_hw: simplify ar9003_hw_per_calibrationFelix Fietkau1-27/+26
Reduce indentation, use a variable to save a few pointer dereferences Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-03-11ath9k: set correct peak detect thresholdMiaoqing Pan1-14/+11
Set QCA9561 peak detect threshold to 11. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-03-11ath9k: use AR_SREV_9003_PCOEM to identify PCOEM chipsMiaoqing Pan1-4/+1
commit f49c90db4d23 ("ath9k: Add a macro to identify PCOEM chips") defined AR_SREV_9003_PCOEM macro, its more clear to use the macro instead of checking one by one. Also removed PCOEM chips checking in the callback of ar9003_hw_do_pcoem_manual_peak_cal() which only for PCOEM chips. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-03-11ath9k: enable manual peak cal for all ar9300 chipsMiaoqing Pan1-8/+6
HW peak detect calibration would fail, enable all ar9300 chips manual peak calibration instead. Signed-off-by: Miaoqing Pan <miaoqing@codeaurora.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2015-09-29ath9k: enable hw manual peak calibration for QCA9561Miaoqing Pan1-2/+4
This patch fix https://lists.openwrt.org/pipermail/openwrt-devel/ 2015-August/034979.html. As the peak detect calibration is set incorrectly. Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-01-29ath9k: Enable manual peak detect calibrationSujith Manoharan1-2/+8
On some AR955x/QCA953x boards, noise floor calibration gets stuck and the cause is a hardware/BB issue. To fix this, peak detect calibration in the HW is disabled and is done in the driver instead. There a few differences with the calibration routine for older chips like AR9331. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-01-29ath9k: Set correct peak detect thresholdSujith Manoharan1-4/+11
The value is different for PCOEM cards and AR955x/AR953x. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2015-01-29ath9k: Fix manual peak calibration initializationSujith Manoharan1-8/+30
The LNA gain setting override needs to be done only for AR9330 and PCOEM chips. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2014-10-27ath9k: restart hardware after noise floor calibration failureFelix Fietkau1-5/+6
When NF calibration fails, the radio often becomes deaf. The usual hardware hang checks do not detect this, so it's better to issue a reset when that happens. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Calculate IQ-CAL medianSujith Manoharan1-12/+79
This patch adds a routine to calculate the median IQ correction values for AR955x, which is used for outlier detection. The normal method which is used for all other chips is bypassed for AR955x. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Expand the IQ coefficient arraySujith Manoharan1-20/+21
This will be used for storing data for mutiple IQ calibration runs, for AR955x. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Modify IQ calibration for AR955xSujith Manoharan1-22/+59
IQ calibration post-processing for AR955x is different from other chips - instead of just doing it as part of AGC calibration once, it is triggered 3 times and a median is determined. This patch adds initial support for changing the calibration behavior for AR955x. Also, to simplify things, a helper routine to issue/poll AGC calibration is used. For non-AR955x chips, the iqcal_idx (which will be used in subsequent patches) is set to zero. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Fix magnitude/phase calculationSujith Manoharan1-3/+7
Incorrect values are programmed in the registers containing the IQ correction coefficients by the IQ-CAL post-processing code. Fix this. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Rename ar9003_hw_tx_iqcal_load_avg_2_passesSujith Manoharan1-4/+4
Use ar9003_hw_tx_iq_cal_outlier_detection instead. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Check explicitly for IQ calibrationSujith Manoharan1-1/+6
In chips like AR955x, the initvals contain the information whether IQ calibration is to be done in the HW when an AGC calibration is triggered. Check if IQ-CAL is enabled in the initvals before flagging 'txiqcal_done' as true. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Fix IQ cal post processing for SoCSujith Manoharan1-2/+2
Calibration data is not reused for SoC chips, so call ar9003_hw_tx_iq_cal_post_proc() with the correct argument. The 'is_reusable' flag is currently used only for PC-OEM chips, but it makes things clearer to specify it explicity. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-02-12ath9k: Remove unnecessary checkSujith Manoharan1-3/+0
The commit "ath9k: Fix IQ calibration" added a check to ensure that valid i2_p_q2_a0_d1 values are not discarded. But since it is masked with 0xfff earlier, the codepath will not be executed. The earlier case where all values above 0x800 were considered invalid is incorrect, since the HW can return valid values between 0x800 and 0xfff. Cc: Kai Shi <kaishi@qca.qualcomm.com> Reported-by: Alex Hacker <hacker@epn.ru> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-01-16ath9k: Fix possible overflow conditionSujith Manoharan1-1/+1
Prevent a possible overflow condition which results in occasional bad IQ coefficients and EVM numbers. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-01-16ath9k: Fix IQ calibrationSujith Manoharan1-2/+15
This patch fixes a bug in the TX IQ calibration post processing routine because of which the driver disables TX IQ correction even though the calibration results are valid. This fix is applicable for all chips in the AR9003 family. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2014-01-03ath9k: Fix AR955x RX sensitivitySujith Manoharan1-0/+223
AR955x has problems with RX sensitivity in 2G. This patch adds a routine to select range_osdac dynamically on a per-chain basis to address this issue. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-09ath9k: Enable manual peak calibration for AR9331 v1.1Sujith Manoharan1-10/+19
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Cleanup IQ calibration for PCOEM chipsSujith Manoharan1-11/+1
Since IQ calibration is done as part of AGC calibration for AR9485 and above, remove the seperate IQ calibration code. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Fix TX IQ calibration for SoC chipsSujith Manoharan1-12/+8
Since calibration data reuse is not enabled in SoC chips, simplify the IQ calibration code. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Fix Carrier Leak calibration for SoC chipsSujith Manoharan1-25/+2
CL calibration is applicable for all chips and the enable/disable knob comes via the INI file. For PCOEM chips, the calibration data is reused when Fast Channel Change is used. Caldata reuse is not enabled for SoC chips, so remove the CL post processing code. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Remove unnecessary checkSujith Manoharan1-2/+1
TX IQ calibration is always enabled for SoC chips. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Remove RTT/MCI code from SoC calibrationSujith Manoharan1-69/+1
RTT is enabled only for AR9462 and MCI for AR9462/AR9565. Also, manual peak calibration is not done for any of the SoC chips. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-12-02ath9k: Separate routines for PCOEM and SoC calibrationSujith Manoharan1-3/+195
Though there is some overlap between the calibration mechanisms of PC-OEM cards and SoC chip families, dumping both of them into a single function makes things hard to understand. ar9003_hw_init_cal() is unreadable with chip-specific segments scattered around. To make the logic understandable, use different functions for client cards and SoC chips. Some code is duplicated, but in the long run, it makes the code more maintanable. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26ath9k: Fix PeakDetect calibration for AR9462Sujith Manoharan1-11/+46
Since HW PeakDetect calibration is turned on for AR9462, various conditions have to be handled in the driver: * Enable agc_cal when loading RTT fails. * Disable SW PeakDetect calibration when RTT calibration is not enabled. * Keep SW PeakDetect calibration result in driver. * Update RTT table according to the saved value. * Write RTT back after modifying SW RTT table. * Enable local mode for PeakDetect calibration and restore values. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26ath9k: Use bitops for calibration flagsSujith Manoharan1-8/+12
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-09-26ath9k: Fix calibration for AR9462Sujith Manoharan1-0/+15
TX IQ calibration is disabled by default for AR9462, this is done using the initvals (reg 0xa644). But, to compensate for this, the AR_PHY_RX_DELAY register should be set to the max allowed value when performing calibration. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-05-17ath9k_hw: Enable manual peak calibration for AR9485Sujith Manoharan1-1/+1
Manual peak calibration is currently enabled only for AR9462 and AR9565. This is also required for AR9485. The initvals are also modified to disable HW peak calibration. Cc: <stable@vger.kernel.org> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-03-29Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirelessJohn W. Linville1-0/+4
Conflicts: net/mac80211/sta_info.c net/wireless/core.h
2013-03-27Show actual timeout value in failed calibration messages.Robert Shade1-1/+2
The messages are currently hard coding "1ms", which does not match the actual timeout being used. Signed-off-by: Robert Shade <robert.shade@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-03-18ath9k_hw: revert chainmask to user configuration after calibrationFelix Fietkau1-0/+4
The commit 'ath9k_hw: fix calibration issues on chainmask that don't include chain 0' changed the hardware chainmask to the chip chainmask for the duration of the calibration, but the revert to user configuration in the reset path runs too early. That causes some issues with limiting the number of antennas (including spurious failure in hardware-generated packets). Fix this by reverting the chainmask after the essential parts of the calibration that need the workaround, and before NF calibration is run. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Reported-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Tested-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Cc: stable@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-28Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirelessJohn W. Linville1-0/+2
Conflicts: drivers/net/wireless/ath/ath9k/main.c drivers/net/wireless/iwlwifi/dvm/tx.c
2013-01-22ath9k_hw: fix calibration issues on chainmask that don't include chain 0Felix Fietkau1-0/+2
Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-09ath9k_hw: Use helper routines to simplify ar9003_hw_init_cal()Sujith Manoharan1-38/+54
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-09ath9k_hw: Fix MCI init for AGC calibrationSujith Manoharan1-8/+11
When AGC calibration is to be done, a GPM message with the payload, MCI_GPM_WLAN_CAL_REQ has to be sent. Currently this falls within the IQ-CAL code block which is incorrect. Fix this by using a separate variable to decide when IQ-CAL is to be done separately and call ar9003_mci_init_cal_req correctly. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-09ath9k_hw: Do not enable IQ-CAL for half/quarter ratesSujith Manoharan1-7/+6
IQ calibration doesn't complete and times out for half/quarter rates, so skip it correctly. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-07ath9k_hw: Fix calibration for AR9340Sujith Manoharan1-1/+1
TX_IQ_ON_AGC_CAL should not be enabled for AR9340. TX-IQ calibration is run as part of AGC calibration only for AR9485, AR9462 and AR9565. For the others (AR9300, AR9330, AR9340), TX-IQ cal is done independent of AGC-cal. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-07ath9k_hw: Remove TEMP_COMP_CALSujith Manoharan1-17/+3
This is not enabled for any chip and is unused. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2013-01-07ath9k_hw: Enable calibration types in init_cal_settingsSujith Manoharan1-6/+11
Doing this in ath9k_hw_fill_cap_info() is odd and it's cleaner to do this in the init function for calibration. Also, setup the supported calibration type in init_cal_settings. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-11-16ath9k_hw: Fix wrong peak detector DC offsetRajkumar Manoharan1-0/+76
An issue is reported in AR9462 & AR9565 that NF_cal_not_done is not observed when HW peak detector calibration is disabled. At that state, the HW is stuck at NF calibration which prevents tx output. The root cause is wrong peak detector offset calibrated by HW. To resolve this issue, peak detector calibration is done manually by SW for AR9462 and AR9565. Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-10-29ath9k_hw: Fix max rx rate drop for AR9565Rajkumar Manoharan1-0/+5
Whenever i_coff of IQ calibration is too high, AR9565 drops max rx rate to MCS4. Skipping IQ update at this time can avoid this problem for AR9565. Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-07-09ath9k_hw: do not load noise floor readings when it is runningRajkumar Manoharan1-8/+5
Noise floor calibration is performed on longcal interval and the reading will be updated in history buffer. On rare occasions, the previous noisefloor calibration might not be completed within the period and trying to load nf reading will be failed. In such situation, postpone the nf cabliration to next cycle to give enough time to complete the calibration. This was already taken care for ar9002 chips. Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>