mac80211: ath10k: backport bus and device specific API 1 BDF selection
[openwrt/staging/chunkeey.git] / package / kernel / mac80211 / patches / ath9k / 580-ath9k_ar9561_fix_bias_level.patch
1 From 4509e523dba46f789377cfec6f20579adf743416 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= <hacks+kernel@slashdirt.org>
3 Date: Sun, 17 Apr 2022 11:31:35 +0200
4 Subject: [PATCH v2] ath9k: fix QCA9561 PA bias level
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This patch fixes an invalid TX PA DC bias level on QCA9561, which
10 results in a very low output power and very low throughput as devices
11 are further away from the AP (compared to other 2.4GHz APs).
12
13 This patch was suggested by Felix Fietkau, who noted[1]:
14 "The value written to that register is wrong, because while the mask
15 definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the
16 shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is
17 wrong for 9561."
18
19 In real life testing, without this patch the 2.4GHz throughput on
20 Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to
21 practical maximum with the patch applied.
22
23 [1] https://lore.kernel.org/all/91c58969-c60e-2f41-00ac-737786d435ae@nbd.name
24
25 Signed-off-by: Thibaut VARĂˆNE <hacks+kernel@slashdirt.org>
26 ---
27 v2: Adjust #define per Felix's suggestion
28 ---
29 drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
31
32 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
33 +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
34 @@ -720,7 +720,7 @@
35 #define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
36 (AR_SREV_9462(ah) ? 0x16290 : 0x16284))
37 #define AR_CH0_TOP2_XPABIASLVL (AR_SREV_9561(ah) ? 0x1e00 : 0xf000)
38 -#define AR_CH0_TOP2_XPABIASLVL_S 12
39 +#define AR_CH0_TOP2_XPABIASLVL_S (AR_SREV_9561(ah) ? 9 : 12)
40
41 #define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \
42 ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : \