From nobody Sat Dec 07 07:14:55 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y4zsX06FDz5gfWg; Sat, 07 Dec 2024 07:14:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4zsW4wWfz49Ly; Sat, 7 Dec 2024 07:14:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZwoPWjfA6ybzCvY3pfFcQTgyDOjlS1vRmCUpfaVcTUk=; b=XUziTSfCR0GqveyuwcqtbBbg+2mDwoiPOmHYrUv+5C6/nzOZv2DIEfQVM/s+FtYR9u2PMW MYW2OwzBvX2+skGlYMBizTbZvqGu6D3kkpVYXGfTSyZaugNaAmnxe0F8FH3F9gr2xyKV0i zu225/n/DVVO+i0cBvY2+Be82TrIb7ZfyEo2BeLb2il/5YaXOp/qYBngTcyoZg7Ye9R6H5 45xHiDiiV8aHk1Q7ET0uZYAVTrtfkxBZHgyQqtixiKoJtcww5UKDTk4C9CPa/cdj7QKiwi 3ajyercKrziQOPrQNADOf+V2q8J5nENG2RGfJuNa3G17FWrjv3+LzKM5/waURQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555695; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZwoPWjfA6ybzCvY3pfFcQTgyDOjlS1vRmCUpfaVcTUk=; b=Hu0bncpSFtnMi4SexhB1PM16uLfSuKend1VeJCtz/ZFGg5i6PiBkFYpL1wHPoJ3wpaKKxn 48n1NUIYIfe6jvYSSfXMZpJfZzVMj3nGp+boo4zHXUosErd5IyZa95ExyXT9LHudV9QTVJ Z1kvb7Dtq2IY3X7iJiWWEHoXS0GqpzeEVbiYmE8cxKfI97okuM7ZAyRutVJTFTJW0QNVSn ebHfbcAMZ1m+wjvnBm2Qy0kLeQznCpif3I0PrXBEdz0H3nBMd28ESOQF2/W4U2WNrMQo/e ersm+w+RNuhPw+DeWomeNq3MGkHpgtDZLJBMf42EAm0XdxOvN50+3CZkvYVR+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733555695; a=rsa-sha256; cv=none; b=ZxCJ7WeZHQRrqur3rB3/yNbntPpq2jW6s7JOYzJ7pkHrUc0bgbz76sSkzGPNfNIMWTFsB6 g9uSBNvrew5Bn93/ctR9vjbFOiy9ItvPiipbVzmQldiwHTl6xpgXuOzUN4HWECRm3WaeOG bvz3kzcUz4reQgiOZ2BFeRUccg0t9jSqgG7dutGHXJxXNL4VdDufgLPwR4RU+ioCety3Gw kRemGtD18nqRhUiJc2zbIDtm01PgVAKYggwRQ8j143OoOljGsiD50NC17s6kmCKMTOZFGL AWs1290gR4QdeEJ3UsVrZgxuRKMs+sQLDTHembIj60Ab+yaNMfCa1x9TxWWZxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4zsW4X5hz1Ckm; Sat, 7 Dec 2024 07:14:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B77Etnh058406; Sat, 7 Dec 2024 07:14:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B77EtOQ058403; Sat, 7 Dec 2024 07:14:55 GMT (envelope-from git) Date: Sat, 7 Dec 2024 07:14:55 GMT Message-Id: <202412070714.4B77EtOQ058403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 468cd606239e - main - rtwn: refactor out the rtl8812/rtl8821 tx power programming List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 468cd606239e4f32aceb2f0aa2bcf01424b418a4 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=468cd606239e4f32aceb2f0aa2bcf01424b418a4 commit 468cd606239e4f32aceb2f0aa2bcf01424b418a4 Author: Adrian Chadd AuthorDate: 2024-12-04 05:11:54 +0000 Commit: Adrian Chadd CommitDate: 2024-12-07 07:13:59 +0000 rtwn: refactor out the rtl8812/rtl8821 tx power programming In preparation for the VHT TX power programming, refactor out the CCK, OFDM and HT programming into their own routines. Locally tested: * RTL8821AU, STA mode --- sys/dev/rtwn/rtl8812a/r12a_chan.c | 66 ++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/sys/dev/rtwn/rtl8812a/r12a_chan.c b/sys/dev/rtwn/rtl8812a/r12a_chan.c index 6bad6345f27f..517d96bb06cf 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_chan.c +++ b/sys/dev/rtwn/rtl8812a/r12a_chan.c @@ -60,30 +60,10 @@ #include static void -r12a_write_txpower(struct rtwn_softc *sc, int chain, +r12a_write_txpower_ht(struct rtwn_softc *sc, int chain, struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) { - if (IEEE80211_IS_CHAN_2GHZ(c)) { - /* Write per-CCK rate Tx power. */ - rtwn_bb_write(sc, R12A_TXAGC_CCK11_1(chain), - SM(R12A_TXAGC_CCK1, power[RTWN_RIDX_CCK1]) | - SM(R12A_TXAGC_CCK2, power[RTWN_RIDX_CCK2]) | - SM(R12A_TXAGC_CCK55, power[RTWN_RIDX_CCK55]) | - SM(R12A_TXAGC_CCK11, power[RTWN_RIDX_CCK11])); - } - - /* Write per-OFDM rate Tx power. */ - rtwn_bb_write(sc, R12A_TXAGC_OFDM18_6(chain), - SM(R12A_TXAGC_OFDM06, power[RTWN_RIDX_OFDM6]) | - SM(R12A_TXAGC_OFDM09, power[RTWN_RIDX_OFDM9]) | - SM(R12A_TXAGC_OFDM12, power[RTWN_RIDX_OFDM12]) | - SM(R12A_TXAGC_OFDM18, power[RTWN_RIDX_OFDM18])); - rtwn_bb_write(sc, R12A_TXAGC_OFDM54_24(chain), - SM(R12A_TXAGC_OFDM24, power[RTWN_RIDX_OFDM24]) | - SM(R12A_TXAGC_OFDM36, power[RTWN_RIDX_OFDM36]) | - SM(R12A_TXAGC_OFDM48, power[RTWN_RIDX_OFDM48]) | - SM(R12A_TXAGC_OFDM54, power[RTWN_RIDX_OFDM54])); /* Write per-MCS Tx power. */ rtwn_bb_write(sc, R12A_TXAGC_MCS3_0(chain), SM(R12A_TXAGC_MCS0, power[RTWN_RIDX_HT_MCS(0)]) | @@ -108,6 +88,50 @@ r12a_write_txpower(struct rtwn_softc *sc, int chain, SM(R12A_TXAGC_MCS15, power[RTWN_RIDX_HT_MCS(15)])); } + /* TODO: HT MCS 16 -> 31 */ +} + +static void +r12a_write_txpower_cck(struct rtwn_softc *sc, int chain, + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) +{ + + if (IEEE80211_IS_CHAN_2GHZ(c)) { + /* Write per-CCK rate Tx power. */ + rtwn_bb_write(sc, R12A_TXAGC_CCK11_1(chain), + SM(R12A_TXAGC_CCK1, power[RTWN_RIDX_CCK1]) | + SM(R12A_TXAGC_CCK2, power[RTWN_RIDX_CCK2]) | + SM(R12A_TXAGC_CCK55, power[RTWN_RIDX_CCK55]) | + SM(R12A_TXAGC_CCK11, power[RTWN_RIDX_CCK11])); + } +} + +static void +r12a_write_txpower_ofdm(struct rtwn_softc *sc, int chain, + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) +{ + + /* Write per-OFDM rate Tx power. */ + rtwn_bb_write(sc, R12A_TXAGC_OFDM18_6(chain), + SM(R12A_TXAGC_OFDM06, power[RTWN_RIDX_OFDM6]) | + SM(R12A_TXAGC_OFDM09, power[RTWN_RIDX_OFDM9]) | + SM(R12A_TXAGC_OFDM12, power[RTWN_RIDX_OFDM12]) | + SM(R12A_TXAGC_OFDM18, power[RTWN_RIDX_OFDM18])); + rtwn_bb_write(sc, R12A_TXAGC_OFDM54_24(chain), + SM(R12A_TXAGC_OFDM24, power[RTWN_RIDX_OFDM24]) | + SM(R12A_TXAGC_OFDM36, power[RTWN_RIDX_OFDM36]) | + SM(R12A_TXAGC_OFDM48, power[RTWN_RIDX_OFDM48]) | + SM(R12A_TXAGC_OFDM54, power[RTWN_RIDX_OFDM54])); +} + +static void +r12a_write_txpower(struct rtwn_softc *sc, int chain, + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) +{ + + r12a_write_txpower_cck(sc, chain, c, power); + r12a_write_txpower_ofdm(sc, chain, c, power); + r12a_write_txpower_ht(sc, chain, c, power); /* TODO: VHT rates */ }