From: Luca Casati <luk00casati@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, arend.vanspriel@broadcom.com,
b43-dev@lists.infradead.org, alessio.ferri@mythread.it,
Luca Casati <luk00casati@gmail.com>
Subject: [PATCH wireless-next v2 1/5] b43: N-PHY: fix the TX tone sample table
Date: Fri, 6 Nov 2026 22:15:12 +0100 [thread overview]
Message-ID: <20261106211516.273791-2-luk00casati@gmail.com> (raw)
In-Reply-To: <20261106211516.273791-1-luk00casati@gmail.com>
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).
mmiotraces: https://github.com/Luca00casati/b43patch/blob/755c2d8/traces/excerpts/patch1-tone-table.txt
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..c4e6c1ac0 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;
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);
--
2.43.0
next prev parent reply other threads:[~2026-11-06 21:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 21:15 [PATCH wireless-next v2 0/5] b43: N-PHY: fix calibrations on rev7+ (BCM43228) Luca Casati
2026-11-06 21:15 ` Luca Casati [this message]
2026-11-06 22:12 ` [PATCH wireless-next v2 1/5] b43: N-PHY: fix the TX tone sample table Alessio Ferri
2026-11-06 21:15 ` [PATCH wireless-next v2 2/5] b43: N-PHY: fix TX IQ/LO calibration Luca Casati
2026-11-06 21:15 ` [PATCH wireless-next v2 3/5] b43: N-PHY: fix rev3+ RSSI calibration Luca Casati
2026-11-07 12:00 ` Alessio Ferri
2026-11-06 21:15 ` [PATCH wireless-next v2 4/5] b43: N-PHY: use wl's delays in the 2057 RC calibration Luca Casati
2026-11-06 21:15 ` [PATCH wireless-next v2 5/5] b43: N-PHY: add the missing override to the rev7 TX_PU command Luca Casati
2026-11-07 11:48 ` [PATCH wireless-next v2 0/5] b43: N-PHY: fix calibrations on rev7+ (BCM43228) 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=20261106211516.273791-2-luk00casati@gmail.com \
--to=luk00casati@gmail.com \
--cc=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 \
/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