From a51ca615be250e0ad76be7449ce7d2aaf02a581f Mon Sep 17 00:00:00 2001 From: snokvist Date: Sun, 25 Oct 2026 12:01:58 +0100 Subject: [PATCH] jaguar2: 8822B RX DFIR follows the channel width (vendor phydm_rxdfirpar_by_bw_8822b) set_channel_bw wrote the BW20 RX DFIR set (0x948[29:28]=2, 0x94c[29:28]=2, 0xc20[31]=0xe20[31]=1) at every width. The vendor function switches it by width: BW40 1/0/0, BW80 2/1/0, BW20/10/5 2/2/1. The 8821C path already does this. Measured on an 8812BU (8822B cut 3, RFE 3) through the LA ring, fixed gain, noise-floor width at -6 dB: with the BW20 set the post-DFIR band is ~+-10 MHz at 20/40/80 MHz width and the 80 MHz tap duplicates ~47 % of samples; with the vendor values it is +-19.9 MHz at BW40 and +-38 MHz at BW80, and the 80 MHz tap is genuine (duplicates 0.0001). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WAgKg5Azt5HiWAvzGdGnuW --- src/jaguar2/HalJaguar2.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/jaguar2/HalJaguar2.cpp b/src/jaguar2/HalJaguar2.cpp index 3bfefdc7..c81b6c4b 100644 --- a/src/jaguar2/HalJaguar2.cpp +++ b/src/jaguar2/HalJaguar2.cpp @@ -1097,14 +1097,27 @@ void HalJaguar2::set_channel_bw(uint8_t channel, uint8_t bw, uint8_t rfe_type, rf_set(0, 0xb8, (1u << 19), 0); rf_set(0, 0xb8, (1u << 19), 1); - /* --- phydm_rxdfirpar_by_bw_8822b (RX digital filter, BW20 path) --- + /* --- phydm_rxdfirpar_by_bw_8822b (RX digital filter) --- * The RX DFIR must match the bandwidth or the OFDM demod filter is wrong: * energy is detected (CCA/FA fire) but no PSDU ever completes and nothing - * reaches the MAC RX FIFO. This was the missing piece for first RX. */ - _device.phy_set_bb_reg(0x0948, (1u << 29) | (1u << 28), 0x2); - _device.phy_set_bb_reg(0x094c, (1u << 29) | (1u << 28), 0x2); - _device.phy_set_bb_reg(0x0c20, (1u << 31), 0x1); - _device.phy_set_bb_reg(0x0e20, (1u << 31), 0x1); + * reaches the MAC RX FIFO. This was the missing piece for first RX. + * Vendor values per width (BW20 also covers 5/10 MHz). With the BW20 set + * at 40/80 MHz the post-DFIR signal stays ~+-10 MHz wide: measured on an + * 8812BU cut 3 via the LA ring, the noise floor is +-10 MHz at every width; + * with these values it is +-20 MHz (BW40) and +-37 MHz (BW80), and the + * rate_sel-0 tap stops duplicating samples at BW80 (genuine 80 MS/s). */ + { + uint32_t a = 0x2, b = 0x2, n20 = 0x1; + if (bw == 1) { /* 40 MHz */ + a = 0x1; b = 0x0; n20 = 0x0; + } else if (bw == 2) { /* 80 MHz */ + a = 0x2; b = 0x1; n20 = 0x0; + } + _device.phy_set_bb_reg(0x0948, (1u << 29) | (1u << 28), a); + _device.phy_set_bb_reg(0x094c, (1u << 29) | (1u << 28), b); + _device.phy_set_bb_reg(0x0c20, (1u << 31), n20); + _device.phy_set_bb_reg(0x0e20, (1u << 31), n20); + } /* --- phydm_ccapar_by_rfe_8822b (CCA thresholds) --- col: 2G/5G x 1R/2R. * RFE types 3/5/12/15/16/17/19 (external-FEM boards, incl. the T3U's