Commit adea8b7
RTL8814AU: port PHY_SetTxPowerIndex_8814A (BB 0x1998 packed write) (#26)
## Summary
- Port `PHY_SetTxPowerIndex_8814A` from upstream
`hal/rtl8814a/rtl8814a_phycfg.c:743` — the 8814 TX-power-table uses a
single packed DWord write to BB register `0x1998` per (path, rate),
totally different from 8812's per-byte per-rate register layout
(`rTxAGC_A_CCK*`, `rTxAGC_A_Ofdm*`, etc.).
- The previous code path was writing 8812 register addresses on 8814;
those registers don't exist there, so the writes scribbled random bits
and the chip's BB stalled on each one — the full TX-power loop took ~6
minutes to finish on 8814, which is why an earlier workaround skipped it
entirely in monitor mode.
- Branched at the top of `PHY_SetTxPowerIndex_8812A` on `CHIP_8814A`;
existing 8812 fanout below is untouched. Also extends
`phy_set_tx_power_level_by_path` to cover `HT_MCS16_MCS23` and
`VHT_3SSMCS0_3SSMCS9` for 8814 (upstream `PHY_SetTxPowerLevel8814`
populates all rate sections regardless of link capability).
## Background
The fix matches upstream verbatim:
```c
u32 txagc_table_wd = 0x00801000;
txagc_table_wd |= (RFPath << 8) | MRateToHwRate(Rate) | (PowerIndex << 24);
phy_set_bb_reg(Adapter, 0x1998, bMaskDWord, txagc_table_wd);
if (Rate == MGN_1M)
phy_set_bb_reg(Adapter, 0x1998, bMaskDWord, txagc_table_wd);
```
The previous "skip TX power on 8814 in monitor mode" workaround landed
in `8814AU RX WORKING: skip TX power setup in monitor mode + log
packets` is removed; gating the loop with `DEVOURER_SKIP_TXPWR=1`
remains as an escape hatch.
## What this does NOT fix
End-to-end 8814 TX. With this change, init completes fast and the
TX-power table is correctly programmed, but bulk OUT EP 0x02 still times
out (`rc=-7`) post-init — chip-init leaves the USB controller in a state
where EP 0x02 doesn't drain, for a different reason. That gate is
tracked separately and will be a follow-up PR.
## Test plan
- [x] Build green on macOS (`cmake --build build`)
- [x] Build green on Arch Linux 6.18 (trainer-arch box)
- [x] 8814 RX regression on CF-938AC (0bda:8813), channel 6: 10+ packets
received in demo window (was previously working via the skip workaround;
still works after this change)
- [x] Init completes in ~5s on 8814 (vs prior ~6 minutes when the loop
ran on the broken 8812 register format)
- [ ] 8812 RX regression — code path is gated by `CHIP_8814A` so the
8812 path is untouched, but ideally smoke-tested before merge
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 67589c0 commit adea8b7
1 file changed
Lines changed: 54 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
237 | 241 | | |
238 | 242 | | |
239 | 243 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
250 | 254 | | |
251 | | - | |
252 | | - | |
| 255 | + | |
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| |||
1145 | 1148 | | |
1146 | 1149 | | |
1147 | 1150 | | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
1148 | 1160 | | |
1149 | 1161 | | |
1150 | 1162 | | |
| |||
1229 | 1241 | | |
1230 | 1242 | | |
1231 | 1243 | | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
1232 | 1272 | | |
1233 | 1273 | | |
1234 | | - | |
1235 | | - | |
1236 | | - | |
| 1274 | + | |
| 1275 | + | |
1237 | 1276 | | |
1238 | 1277 | | |
1239 | 1278 | | |
| |||
0 commit comments