2022-04-17 16:59:24

by Thibaut VARÈNE

[permalink] [raw]
Subject: [PATCH v2] ath9k: fix QCA9561 PA bias level

This patch fixes an invalid TX PA DC bias level on QCA9561, which
results in a very low output power and very low throughput as devices
are further away from the AP (compared to other 2.4GHz APs).

This patch was suggested by Felix Fietkau, who noted[1]:
"The value written to that register is wrong, because while the mask
definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the
shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is
wrong for 9561."

In real life testing, without this patch the 2.4GHz throughput on
Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to
practical maximum with the patch applied.

[1] https://lore.kernel.org/all/[email protected]

Signed-off-by: Thibaut VARÈNE <[email protected]>
---
v2: Adjust #define per Felix's suggestion
---
drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.h b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
index a171dbb29..ad949eb02 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.h
@@ -720,7 +720,7 @@
#define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \
(AR_SREV_9462(ah) ? 0x16290 : 0x16284))
#define AR_CH0_TOP2_XPABIASLVL (AR_SREV_9561(ah) ? 0x1e00 : 0xf000)
-#define AR_CH0_TOP2_XPABIASLVL_S 12
+#define AR_CH0_TOP2_XPABIASLVL_S (AR_SREV_9561(ah) ? 9 : 12)

#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \
((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : \
--
2.30.2


2022-04-17 17:55:41

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH v2] ath9k: fix QCA9561 PA bias level

On 17.04.22 16:51, Thibaut VARÈNE wrote:
> This patch fixes an invalid TX PA DC bias level on QCA9561, which
> results in a very low output power and very low throughput as devices
> are further away from the AP (compared to other 2.4GHz APs).
>
> This patch was suggested by Felix Fietkau, who noted[1]:
> "The value written to that register is wrong, because while the mask
> definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the
> shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is
> wrong for 9561."
>
> In real life testing, without this patch the 2.4GHz throughput on
> Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to
> practical maximum with the patch applied.
>
> [1] https://lore.kernel.org/all/[email protected]
>
> Signed-off-by: Thibaut VARÈNE <[email protected]>

Acked-by: Felix Fietkau <[email protected]>

2022-04-18 07:25:30

by Toke Høiland-Jørgensen

[permalink] [raw]
Subject: Re: [PATCH v2] ath9k: fix QCA9561 PA bias level

Thibaut VARÈNE <[email protected]> writes:

> This patch fixes an invalid TX PA DC bias level on QCA9561, which
> results in a very low output power and very low throughput as devices
> are further away from the AP (compared to other 2.4GHz APs).
>
> This patch was suggested by Felix Fietkau, who noted[1]:
> "The value written to that register is wrong, because while the mask
> definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the
> shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is
> wrong for 9561."
>
> In real life testing, without this patch the 2.4GHz throughput on
> Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to
> practical maximum with the patch applied.
>
> [1] https://lore.kernel.org/all/[email protected]
>
> Signed-off-by: Thibaut VARÈNE <[email protected]>

Thank you for the fix!

Acked-by: Toke Høiland-Jørgensen <[email protected]>

2022-04-23 13:37:21

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2] ath9k: fix QCA9561 PA bias level

Thibaut VARÈNE <[email protected]> wrote:

> This patch fixes an invalid TX PA DC bias level on QCA9561, which
> results in a very low output power and very low throughput as devices
> are further away from the AP (compared to other 2.4GHz APs).
>
> This patch was suggested by Felix Fietkau, who noted[1]:
> "The value written to that register is wrong, because while the mask
> definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the
> shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is
> wrong for 9561."
>
> In real life testing, without this patch the 2.4GHz throughput on
> Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to
> practical maximum with the patch applied.
>
> [1] https://lore.kernel.org/all/[email protected]
>
> Signed-off-by: Thibaut VARÈNE <[email protected]>
> Acked-by: Felix Fietkau <[email protected]>
> Acked-by: Toke Høiland-Jørgensen <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

Patch applied to ath-next branch of ath.git, thanks.

e999a5da28a0 ath9k: fix QCA9561 PA bias level

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches