From: Christian Lamparter <chunkeey@gmail.com>
To: Masi Osmani <mas-i@hotmail.de>
Cc: linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com
Subject: Re: [PATCH 08/10] carl9170: phy: enable antenna diversity for 2-chain devices
Date: Sat, 21 Mar 2026 20:53:20 +0100 [thread overview]
Message-ID: <46d3a248-bc59-4c60-85ba-88d80afa8dc3@gmail.com> (raw)
In-Reply-To: <AM7PPF5613FA0B6344DB5885359FAFC80D69444A@AM7PPF5613FA0B6.EURP251.PROD.OUTLOOK.COM>
On 3/12/26 11:38 AM, Masi Osmani wrote:
> Enable fast antenna diversity on devices with two RX chains
> (rx_mask == 3). This programs the MULTICHAIN_GAIN_CTL register
> to configure main/alternate LNA settings and enables the
> CCK fast antenna diversity bit.
>
> The AR9170 hardware has antenna diversity registers inherited
> from the AR9285/AR9287 family, but the carl9170 driver never
> programmed them. For dual-chain devices this improves receive
> performance in multipath environments by allowing the baseband
> to quickly switch between antenna paths.
Oh, no. It does program them! It's part of the ar5416_phy_init array in phy.c.
So. From what I remember, this was the reason why I copied the definitions
over from the ath9k driver to carl9170. Because this register must be important
if they are part of the init values. But I don't know if these definitions
are the same for AR9170 and AR9285. That's why the AR9285 is there.
As for ar5416_phy_init values. They came from the original OTUS driver.
Hope this helps.
If possible, this feature should be governed by something like the experimental
module parameter?
>
> The diversity configuration mirrors what ath9k uses for the
> AR9285 single-chip design:
> - Main LNA: LNA1
> - Alt LNA: LNA1+LNA2 (combined)
> - Gain table: table 0 for both paths
>
> Signed-off-by: Masi Osmani <mas-i@hotmail.de>
> ---
> drivers/net/wireless/ath/carl9170/phy.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/carl9170/phy.c b/drivers/net/wireless/ath/carl9170/phy.c
> index 290c336..bcd9066 100644
> --- a/drivers/net/wireless/ath/carl9170/phy.c
> +++ b/drivers/net/wireless/ath/carl9170/phy.c
> @@ -536,6 +536,31 @@ static int carl9170_init_phy_from_eeprom(struct ar9170 *ar,
> carl9170_regwrite(AR9170_PHY_REG_RX_CHAINMASK, ar->eeprom.rx_mask);
> carl9170_regwrite(AR9170_PHY_REG_CAL_CHAINMASK, ar->eeprom.rx_mask);
>
> + /*
> + * Enable fast antenna diversity for 2-chain devices.
> + * Configure main/alt LNA with both chains for best
> + * multipath performance.
> + */
> + if (ar->eeprom.rx_mask == 3) {
> + val = carl9170_def_val(AR9170_PHY_REG_MULTICHAIN_GAIN_CTL,
> + is_2ghz, is_40mhz);
> + val |= AR9170_PHY_9285_ANT_DIV_CTL;
> + SET_VAL(AR9170_PHY_9285_ANT_DIV_ALT_LNACONF, val,
> + AR9170_PHY_9285_ANT_DIV_LNA1_PLUS_LNA2);
> + SET_VAL(AR9170_PHY_9285_ANT_DIV_MAIN_LNACONF, val,
> + AR9170_PHY_9285_ANT_DIV_LNA1);
> + SET_VAL(AR9170_PHY_9285_ANT_DIV_ALT_GAINTB, val,
> + AR9170_PHY_9285_ANT_DIV_GAINTB_0);
> + SET_VAL(AR9170_PHY_9285_ANT_DIV_MAIN_GAINTB, val,
> + AR9170_PHY_9285_ANT_DIV_GAINTB_0);
> + carl9170_regwrite(AR9170_PHY_REG_MULTICHAIN_GAIN_CTL, val);
> +
> + val = carl9170_def_val(AR9170_PHY_REG_CCK_DETECT,
> + is_2ghz, is_40mhz);
> + val |= AR9170_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV;
> + carl9170_regwrite(AR9170_PHY_REG_CCK_DETECT, val);
> + }
> +
> carl9170_regwrite_finish();
> return carl9170_regwrite_result();
> }
next prev parent reply other threads:[~2026-03-21 19:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1773277728.git.mas-i@hotmail.de>
2026-03-12 10:37 ` [PATCH 01/10] carl9170: mac80211: enable Short Guard Interval for 20 MHz Masi Osmani
2026-03-21 18:41 ` Christian Lamparter
2026-03-12 10:37 ` [PATCH 02/10] carl9170: mac80211: advertise RX STBC capability Masi Osmani
2026-03-21 18:47 ` Christian Lamparter
2026-03-12 10:37 ` [PATCH 03/10] carl9170: mac80211: document spatial multiplexing power save handler Masi Osmani
2026-03-21 18:57 ` Christian Lamparter
2026-03-12 10:37 ` [PATCH 04/10] carl9170: rx: wire up dropped frame counter Masi Osmani
2026-03-21 19:03 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 05/10] carl9170: rx: track PHY errors via debugfs Masi Osmani
2026-03-21 20:29 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 06/10] carl9170: phy: populate per-channel TX power from EEPROM Masi Osmani
2026-03-21 19:24 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 07/10] carl9170: main: add exponential restart backoff Masi Osmani
2026-03-21 20:42 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 08/10] carl9170: phy: enable antenna diversity for 2-chain devices Masi Osmani
2026-03-21 19:53 ` Christian Lamparter [this message]
2026-03-12 10:38 ` [PATCH 09/10] carl9170: fw: enable DFS radar detection Masi Osmani
2026-03-21 20:11 ` Christian Lamparter
2026-03-12 10:38 ` [PATCH 10/10] carl9170: phy: add periodic runtime IQ calibration Masi Osmani
2026-03-21 21:25 ` Christian Lamparter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46d3a248-bc59-4c60-85ba-88d80afa8dc3@gmail.com \
--to=chunkeey@gmail.com \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=mas-i@hotmail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox