git: 66ecb413fe70 - main - rtwn: fix 8188f channel offset / width programming

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 01:21:49 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=66ecb413fe7061d7d515e0199dc6c06cef37ac9e

commit 66ecb413fe7061d7d515e0199dc6c06cef37ac9e
Author:     Mir Saheb Ali <mirsahebali@pm.me>
AuthorDate: 2026-10-29 01:18:30 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-10-29 01:21:24 +0000

    rtwn: fix 8188f channel offset / width programming
    
    * rtwn_chan2centieee() already calculates the proper centre
      frequency, so it doesn't need to be further offset.
    * Don't program R92C_RF_CHNLBW with further 20MHz wide bits;
      the rest of the programming works correctly for 20/40MHz
      operation.
    
    Tested:
    
    * Verified against the linux rtl8xxxu/8188f.c code.
    * Tested w/ 20 and 40MHz 11n; 40MHz is now operating at higher
      speed.
    
    Fixes: 2c38dc04d6f8bc84620bb3b67c8ccd9f910c4d03
---
 sys/dev/rtwn/rtl8188f/r88f_chan.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sys/dev/rtwn/rtl8188f/r88f_chan.c b/sys/dev/rtwn/rtl8188f/r88f_chan.c
index 52566a85f1e6..e9ec8f89c126 100644
--- a/sys/dev/rtwn/rtl8188f/r88f_chan.c
+++ b/sys/dev/rtwn/rtl8188f/r88f_chan.c
@@ -249,7 +249,6 @@ r88f_spur_calibration(struct rtwn_softc *sc, struct ieee80211_channel *c,
 void
 r88f_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
 {
-	struct r92c_softc *rs = sc->sc_priv;
 	uint32_t reg;
 	uint8_t chan, subchannel;
 	bool sec_ch_above;
@@ -302,10 +301,8 @@ r88f_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
 		if (IEEE80211_IS_CHAN_HT40U(c) ||
 			IEEE80211_IS_CHAN_VHT40U(c)) {
 			sec_ch_above = 1;
-			chan += 2;
 		} else {
 			sec_ch_above = 0;
-			chan -= 2;
 		}
 
 		/* Set Control channel to upper or lower. */
@@ -353,6 +350,4 @@ r88f_set_chan(struct rtwn_softc *sc, struct ieee80211_channel *c)
 	rtwn_rf_write(sc, 0, R92C_RF_RX_G2, 0x1c6c);
 	rtwn_rf_write(sc, 0, R88F_RF_GAIN_CCA,
 	    R88F_RF_PKTBUF_DBG_CTRL);
-	rtwn_rf_write(sc, 0, R92C_RF_CHNLBW,
-		(rs->rf_chnlbw[0] & ~0xfff) | chan | R88E_RF_CHNLBW_BW20);
 }