From: Alessio Ferri <alessio.ferri@mythread.it>
To: Luca Casati <luk00casati@gmail.com>
Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net,
arend.vanspriel@broadcom.com, b43-dev@lists.infradead.org
Subject: Re: [PATCH wireless-next 1/5] b43: N-PHY: fix the TX tone sample table
Date: Fri, 6 Nov 2026 08:37:36 +0100 [thread overview]
Message-ID: <20261106083736.00006add@mythread.it> (raw)
In-Reply-To: <20261026181543.77763-2-luk00casati@gmail.com>
Il giorno Mon, 26 Oct 2026 19:15:39 +0100
Luca Casati <luk00casati@gmail.com> ha scritto:
> b43_nphy_load_samples() masked with (0x3FF << 10) instead of shifting
> the masked I value, and b43_nphy_gen_load_samples() fed
> cordic_calc_iq() a 16.16 fixed-point angle (CORDIC_FIXED() of a value
> already shifted by 16) held in a u16, while the function takes whole
> degrees. Together the sample table ended up all zeros, so every
> calibration that plays a test tone (TX IQ/LO, RX IQ) ran without a
> signal.
>
> Compute the rotation in whole degrees as brcmsmac does and fix the
> precedence.
>
> Tested on a BCM43228 (N-PHY rev 16, radio 2057 rev 9).
>
> Found and fixed with the help of an AI coding assistant (Claude Opus
> 5.5), by comparing mmiotraces of b43 and wl on the same card.
>
> Signed-off-by: Luca Casati <luk00casati@gmail.com>
> ---
> drivers/net/wireless/broadcom/b43/phy_n.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c
> b/drivers/net/wireless/broadcom/b43/phy_n.c index
> bbc30cbad..66565c14e 100644 ---
> a/drivers/net/wireless/broadcom/b43/phy_n.c +++
> b/drivers/net/wireless/broadcom/b43/phy_n.c @@ -1515,7 +1515,7 @@
> static int b43_nphy_load_samples(struct b43_wldev *dev,
> b43_nphy_stay_in_carrier_search(dev, 1);
> for (i = 0; i < len; i++) {
> - data[i] = (samples[i].i & 0x3FF << 10);
> + data[i] = (samples[i].i & 0x3FF) << 10;
> data[i] |= samples[i].q & 0x3FF;
> }
> b43_ntab_write_bulk(dev, B43_NTAB32(17, 0), len, data);
> @@ -1531,7 +1531,8 @@ static u16 b43_nphy_gen_load_samples(struct
> b43_wldev *dev, u32 freq, u16 max, bool test)
> {
> int i;
> - u16 bw, len, rot, angle;
> + u16 bw, len;
> + s32 rot, angle; /* whole degrees, as
> cordic_calc_iq() wants */ struct cordic_iq *samples;
>
> bw = b43_is_40mhz(dev) ? 40 : 20;
> @@ -1554,11 +1555,11 @@ static u16 b43_nphy_gen_load_samples(struct
> b43_wldev *dev, u32 freq, u16 max, b43err(dev->wl, "allocation for
> samples generation failed\n"); return 0;
> }
> - rot = (((freq * 36) / bw) << 16) / 100;
> + rot = ((freq * 36) / bw) / 100;
> angle = 0;
>
> for (i = 0; i < len; i++) {
> - samples[i] = cordic_calc_iq(CORDIC_FIXED(angle));
> + samples[i] = cordic_calc_iq(angle);
> angle += rot;
> samples[i].q = CORDIC_FLOAT(samples[i].q * max);
> samples[i].i = CORDIC_FLOAT(samples[i].i * max);
Drop the added comment, claude like to add random and useless comments
all over the code. Changing rot and angle type is not strictly needed,
but ok for consistency with brcmsmac.
The rest of the patch is good, i encountered the same problem.
Alessio
next prev parent reply other threads:[~2026-11-06 7:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 18:15 [PATCH wireless-next 0/5] b43: N-PHY: fix calibrations on rev7+ (BCM43228) Luca Casati
2026-10-26 18:15 ` [PATCH wireless-next 1/5] b43: N-PHY: fix the TX tone sample table Luca Casati
2026-11-06 7:37 ` Alessio Ferri [this message]
2026-10-26 18:15 ` [PATCH wireless-next 2/5] b43: N-PHY: fix TX IQ/LO calibration Luca Casati
2026-10-26 18:15 ` [PATCH wireless-next 3/5] b43: N-PHY: fix rev3+ RSSI calibration Luca Casati
2026-11-06 8:08 ` Alessio Ferri
2026-10-26 18:15 ` [PATCH wireless-next 4/5] b43: N-PHY: wait for the first 2057 RC calibration run Luca Casati
2026-11-06 10:41 ` Alessio Ferri
2026-10-26 18:15 ` [PATCH wireless-next 5/5] b43: N-PHY: add the missing override to the rev7 TX_PU command Luca Casati
2026-10-28 18:12 ` [PATCH wireless-next 0/5] b43: N-PHY: fix calibrations on rev7+ (BCM43228) Rosen Penev
2026-10-29 7:13 ` Johannes Berg
2026-11-06 7:23 ` Alessio Ferri
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=20261106083736.00006add@mythread.it \
--to=alessio.ferri@mythread.it \
--cc=arend.vanspriel@broadcom.com \
--cc=b43-dev@lists.infradead.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=luk00casati@gmail.com \
/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