From nobody Sat Dec 07 07:14:57 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 4Y4zsZ5xhKz5gfP1; Sat, 07 Dec 2024 07:14:58 +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 4Y4zsY6L0Hz49R4; Sat, 7 Dec 2024 07:14:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555697; 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=vd99WmPjwbgIe+6sU2LB9l4bvLBXRR2vyC+/clIruKI=; b=VZQpfpdQ2tyej6Q5FkqMRyzJ/1guhyKKam0jLNvT6Foj3wNhGhVgXXTOZGzJYRl0yZXiwk UWA+gFRyXDLf5nFM/LXlLpoWR5GShE5tJ3hhhhK4GXth0i+dw7arVhLHcfiALe4xf3/Zvv SOsI/ZxPwlCiLLoMBgSZ4YVEP410vRVdEoIxuIencWIm49nlCCXHrn7IJUk7kIitnNWy34 FP1vs5XB2xhx2BldejbFB6AZ53nctjmm394XBj1fL/wIEsRMKQgbdDgp1lAIly9YY/o19C Ns0wYd6xmUFh455xveVcj/eOJZxiEPZpYWqoIRcThZQd0Bk71RfWyuoMB/AeKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733555697; 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=vd99WmPjwbgIe+6sU2LB9l4bvLBXRR2vyC+/clIruKI=; b=w2JwgBmkvyM4K2TJbpGTylqnY+BEB5HiQsV7nyyEwUvf57jOKAbzwSWIdyRDMFdRqv4kbT NwMCFr69k79+2jgrg+fcCNNCvEYb9wn57kYnmH/AW7UcYuHilZEzduR1tAl6l+bEwU1JFJ 2os2enP1JrGp+qD8QD2G3OmJ3E25oADqks5tolxPXPceHwtDZ/ZLwkFaHgSlVb/amiAua+ +AFdYcrTrh8z21NETAjPijmn4ndX4ni++XzSDjUNebk28e5JfzSB10pzDNGFM80Jvb19JH JzOQRysk30SvEw/vmBezEsKQL360qiPgT67BTou1MMeeY7D+HkQs2TyzxSQ5/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733555697; a=rsa-sha256; cv=none; b=WXYBQ9ytHerLTGQdXIgeUefeYdS0o/JTxh53Nipz+rapu6VfvodN0qsVa/cOrDzuxFHt0g 3mBdN3Xl+cfEchj0aobslxpocRwgC1vWOA1PIp3bnT+YkmsXj5aZC9rk32FOWU6aXk9BrL /33p68TLITsvP1H6yuBgM8fuk8JY8TyB05tY3t1i5RyFjkcxg8z5ROGbtF675IGdPuBlES GwlFzbt2Nrtfd5cKOuiB+ZNh0/ca2lb7WX6d/aZWJca8SCyaC4s0puyMu9JNpL4IJPFrz0 +dNZCqySB7X4lTov8ovADtNPc132lrnW0hfJuVTSCSBFUqosWf/Fqv39MaBVMg== 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 4Y4zsY5xlTz1CXq; Sat, 7 Dec 2024 07:14:57 +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 4B77EvYQ058530; Sat, 7 Dec 2024 07:14:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B77EvBE058527; Sat, 7 Dec 2024 07:14:57 GMT (envelope-from git) Date: Sat, 7 Dec 2024 07:14:57 GMT Message-Id: <202412070714.4B77EvBE058527@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: b811e5a5effe - main - rtwn: program the 1 and 2 stream VHT transmit power rates 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: b811e5a5effed0a3f8fa017606e2f37649047537 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=b811e5a5effed0a3f8fa017606e2f37649047537 commit b811e5a5effed0a3f8fa017606e2f37649047537 Author: Adrian Chadd AuthorDate: 2024-12-04 05:31:35 +0000 Commit: Adrian Chadd CommitDate: 2024-12-07 07:14:14 +0000 rtwn: program the 1 and 2 stream VHT transmit power rates This is needed to be able to successfully transmit VHT frames. Locally tested: * RTL8821AU, STA mode (with the rest of VHT work to actually test VHT) Differential Revision: https://reviews.freebsd.org/D47899 --- sys/dev/rtwn/rtl8812a/r12a_chan.c | 58 ++++++++++++++++++++++++++++++++++++++- sys/dev/rtwn/rtl8812a/r12a_reg.h | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/sys/dev/rtwn/rtl8812a/r12a_chan.c b/sys/dev/rtwn/rtl8812a/r12a_chan.c index 518b02d765cf..789a14b0e1d6 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_chan.c +++ b/sys/dev/rtwn/rtl8812a/r12a_chan.c @@ -91,6 +91,62 @@ r12a_write_txpower_ht(struct rtwn_softc *sc, int chain, /* TODO: HT MCS 16 -> 31 */ } +static void +r12a_write_txpower_vht(struct rtwn_softc *sc, int chain, + struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) +{ + + /* 1SS, MCS 0..3 */ + rtwn_bb_write(sc, R12A_TXAGC_NSS1IX3_1IX0(chain), + SM(R12A_TXAGC_NSS1_MCS0, power[RTWN_RIDX_VHT_MCS(0, 0)]) | + SM(R12A_TXAGC_NSS1_MCS1, power[RTWN_RIDX_VHT_MCS(0, 1)]) | + SM(R12A_TXAGC_NSS1_MCS2, power[RTWN_RIDX_VHT_MCS(0, 2)]) | + SM(R12A_TXAGC_NSS1_MCS3, power[RTWN_RIDX_VHT_MCS(0, 3)])); + + /* 1SS, MCS 4..7 */ + rtwn_bb_write(sc, R12A_TXAGC_NSS1IX7_1IX4(chain), + SM(R12A_TXAGC_NSS1_MCS4, power[RTWN_RIDX_VHT_MCS(0, 4)]) | + SM(R12A_TXAGC_NSS1_MCS5, power[RTWN_RIDX_VHT_MCS(0, 5)]) | + SM(R12A_TXAGC_NSS1_MCS6, power[RTWN_RIDX_VHT_MCS(0, 6)]) | + SM(R12A_TXAGC_NSS1_MCS7, power[RTWN_RIDX_VHT_MCS(0, 7)])); + + /* 1SS, MCS 8,9 ; 2SS MCS0, 1 */ + if (sc->ntxchains == 1) { + rtwn_bb_write(sc, R12A_TXAGC_NSS2IX1_1IX8(chain), + SM(R12A_TXAGC_NSS1_MCS8, power[RTWN_RIDX_VHT_MCS(0, 8)]) | + SM(R12A_TXAGC_NSS1_MCS9, power[RTWN_RIDX_VHT_MCS(0, 9)]) | + SM(R12A_TXAGC_NSS2_MCS0, 0) | + SM(R12A_TXAGC_NSS2_MCS1, 0)); + } else { + rtwn_bb_write(sc, R12A_TXAGC_NSS2IX1_1IX8(chain), + SM(R12A_TXAGC_NSS1_MCS8, power[RTWN_RIDX_VHT_MCS(0, 8)]) | + SM(R12A_TXAGC_NSS1_MCS9, power[RTWN_RIDX_VHT_MCS(0, 9)]) | + SM(R12A_TXAGC_NSS2_MCS0, power[RTWN_RIDX_VHT_MCS(1, 0)]) | + SM(R12A_TXAGC_NSS2_MCS1, power[RTWN_RIDX_VHT_MCS(1, 1)])); + } + + /* 2SS MCS 2..5 */ + if (sc->ntxchains > 1) { + rtwn_bb_write(sc, R12A_TXAGC_NSS2IX5_2IX2(chain), + SM(R12A_TXAGC_NSS2_MCS2, power[RTWN_RIDX_VHT_MCS(1, 2)]) | + SM(R12A_TXAGC_NSS2_MCS3, power[RTWN_RIDX_VHT_MCS(1, 3)]) | + SM(R12A_TXAGC_NSS2_MCS4, power[RTWN_RIDX_VHT_MCS(1, 4)]) | + SM(R12A_TXAGC_NSS2_MCS5, power[RTWN_RIDX_VHT_MCS(1, 5)])); + } + + /* 2SS MCS 6..9 */ + if (sc->ntxchains > 1) { + rtwn_bb_write(sc, R12A_TXAGC_NSS2IX9_2IX6(chain), + SM(R12A_TXAGC_NSS2_MCS2, power[RTWN_RIDX_VHT_MCS(1, 6)]) | + SM(R12A_TXAGC_NSS2_MCS3, power[RTWN_RIDX_VHT_MCS(1, 7)]) | + SM(R12A_TXAGC_NSS2_MCS4, power[RTWN_RIDX_VHT_MCS(1, 8)]) | + SM(R12A_TXAGC_NSS2_MCS5, power[RTWN_RIDX_VHT_MCS(1, 9)])); + } + + /* TODO: 3SS, 4SS VHT rates */ +} + + static void r12a_write_txpower_cck(struct rtwn_softc *sc, int chain, struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) @@ -132,7 +188,7 @@ r12a_write_txpower(struct rtwn_softc *sc, int chain, 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 */ + r12a_write_txpower_vht(sc, chain, c, power); } static int diff --git a/sys/dev/rtwn/rtl8812a/r12a_reg.h b/sys/dev/rtwn/rtl8812a/r12a_reg.h index 4e9892ce2592..4f5f6f28c11a 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_reg.h +++ b/sys/dev/rtwn/rtl8812a/r12a_reg.h @@ -230,6 +230,56 @@ #define R12A_TXAGC_MCS15_M 0xff000000 #define R12A_TXAGC_MCS15_S 24 +/* Bits for R12A_TXAGC_NSS1IX3_1IX0(i) */ +#define R12A_TXAGC_NSS1_MCS0_M 0x000000ff +#define R12A_TXAGC_NSS1_MCS0_S 0 +#define R12A_TXAGC_NSS1_MCS1_M 0x0000ff00 +#define R12A_TXAGC_NSS1_MCS1_S 8 +#define R12A_TXAGC_NSS1_MCS2_M 0x00ff0000 +#define R12A_TXAGC_NSS1_MCS2_S 16 +#define R12A_TXAGC_NSS1_MCS3_M 0xff000000 +#define R12A_TXAGC_NSS1_MCS3_S 24 + +/* Bits for R12A_TXAGC_NSS1IX7_1IX4(i) */ +#define R12A_TXAGC_NSS1_MCS4_M 0x000000ff +#define R12A_TXAGC_NSS1_MCS4_S 0 +#define R12A_TXAGC_NSS1_MCS5_M 0x0000ff00 +#define R12A_TXAGC_NSS1_MCS5_S 8 +#define R12A_TXAGC_NSS1_MCS6_M 0x00ff0000 +#define R12A_TXAGC_NSS1_MCS6_S 16 +#define R12A_TXAGC_NSS1_MCS7_M 0xff000000 +#define R12A_TXAGC_NSS1_MCS7_S 24 + +/* Bits for R12A_TXAGC_NSS2IX1_1IX8(i) */ +#define R12A_TXAGC_NSS1_MCS8_M 0x000000ff +#define R12A_TXAGC_NSS1_MCS8_S 0 +#define R12A_TXAGC_NSS1_MCS9_M 0x0000ff00 +#define R12A_TXAGC_NSS1_MCS9_S 8 +#define R12A_TXAGC_NSS2_MCS0_M 0x00ff0000 +#define R12A_TXAGC_NSS2_MCS0_S 16 +#define R12A_TXAGC_NSS2_MCS1_M 0xff000000 +#define R12A_TXAGC_NSS2_MCS1_S 24 + +/* Bits for R12A_TXAGC_NSS2IX5_2IX2(i) */ +#define R12A_TXAGC_NSS2_MCS2_M 0x000000ff +#define R12A_TXAGC_NSS2_MCS2_S 0 +#define R12A_TXAGC_NSS2_MCS3_M 0x0000ff00 +#define R12A_TXAGC_NSS2_MCS3_S 8 +#define R12A_TXAGC_NSS2_MCS4_M 0x00ff0000 +#define R12A_TXAGC_NSS2_MCS4_S 16 +#define R12A_TXAGC_NSS2_MCS5_M 0xff000000 +#define R12A_TXAGC_NSS2_MCS5_S 24 + +/* Bits for R12A_TXAGC_NSS2IX9_2IX6(i) */ +#define R12A_TXAGC_NSS2_MCS6_M 0x000000ff +#define R12A_TXAGC_NSS2_MCS6_S 0 +#define R12A_TXAGC_NSS2_MCS7_M 0x0000ff00 +#define R12A_TXAGC_NSS2_MCS7_S 8 +#define R12A_TXAGC_NSS2_MCS8_M 0x00ff0000 +#define R12A_TXAGC_NSS2_MCS8_S 16 +#define R12A_TXAGC_NSS2_MCS9_M 0xff000000 +#define R12A_TXAGC_NSS2_MCS9_S 24 + /* * RF (6052) registers. */