Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <ku920601@realtek.com>, <damon.chen@realtek.com>,
	<phhuang@realtek.com>, <kevin_yang@realtek.com>
Subject: [PATCH rtw-next 03/11] wifi: rtw89: 8922d: use efuse bias for CCK RX gain
Date: Thu, 12 Nov 2026 14:05:52 +0800	[thread overview]
Message-ID: <20261112060600.71784-4-pkshih@realtek.com> (raw)
In-Reply-To: <20261112060600.71784-1-pkshih@realtek.com>

Instead of deriving the CCK RX gain compensation from BW20/BW40 gain bias
and CCK RPL offset fields, write the calibration efuse gain value directly
to the efuse bias field.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.h     | 1 +
 drivers/net/wireless/realtek/rtw89/reg.h      | 1 +
 drivers/net/wireless/realtek/rtw89/rtw8922d.c | 9 +++------
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 01da0b30a7ab..afec4e166b78 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -7437,6 +7437,7 @@ struct rtw89_phy_calc_efuse_gain {
 	s8 cck_mean_gain_bias;
 	s8 cck_rpl_ofst;
 	s8 rssi_ofst;
+	s8 cck_efuse_bias;
 };
 
 #define RTW89_MAX_PATTERN_NUM             18
diff --git a/drivers/net/wireless/realtek/rtw89/reg.h b/drivers/net/wireless/realtek/rtw89/reg.h
index 4829f9fd8eb5..edbfc9514a08 100644
--- a/drivers/net/wireless/realtek/rtw89/reg.h
+++ b/drivers/net/wireless/realtek/rtw89/reg.h
@@ -11003,6 +11003,7 @@
 #define R_CCK_FC0_INV_BE4 0x26090
 #define B_CCK_FC0_INV_BE4 GENMASK(18, 0)
 #define R_GAIN_BIAS_BE4 0x260A0
+#define B_EFUSE_BIAS_BE4 GENMASK(5, 0)
 #define B_GAIN_BIAS_BW20_BE4 GENMASK(11, 6)
 #define B_GAIN_BIAS_BW40_BE4 GENMASK(17, 12)
 
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922d.c b/drivers/net/wireless/realtek/rtw89/rtw8922d.c
index 43d9df619260..b874bac9bfee 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8922d.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8922d.c
@@ -1720,6 +1720,7 @@ static void rtw8922d_calc_rx_gain_normal_cck(struct rtw89_dev *rtwdev,
 	rx_gain_offset = -rtw8922d_get_rx_gain_by_chan(rtwdev, chan, path, true);
 	calc->cck_mean_gain_bias = (rx_gain_offset & 0x3) << 1;
 	calc->cck_rpl_ofst = (rx_gain_offset >> 2) + gain->cck_rpl_base[phy_idx];
+	calc->cck_efuse_bias = rx_gain_offset;
 }
 
 static void rtw8922d_set_rx_gain_normal_cck(struct rtw89_dev *rtwdev,
@@ -1731,12 +1732,8 @@ static void rtw8922d_set_rx_gain_normal_cck(struct rtw89_dev *rtwdev,
 
 	rtw8922d_calc_rx_gain_normal_cck(rtwdev, chan, path, phy_idx, &calc);
 
-	rtw89_phy_write32_idx(rtwdev, R_GAIN_BIAS_BE4, B_GAIN_BIAS_BW20_BE4,
-			      calc.cck_mean_gain_bias, phy_idx);
-	rtw89_phy_write32_idx(rtwdev, R_GAIN_BIAS_BE4, B_GAIN_BIAS_BW40_BE4,
-			      calc.cck_mean_gain_bias, phy_idx);
-	rtw89_phy_write32_idx(rtwdev, R_CCK_RPL_OFST_BE4, B_CCK_RPL_OFST_BE4,
-			      calc.cck_rpl_ofst, phy_idx);
+	rtw89_phy_write32_idx(rtwdev, R_GAIN_BIAS_BE4, B_EFUSE_BIAS_BE4,
+			      calc.cck_efuse_bias, phy_idx);
 }
 
 static void rtw8922d_calc_rx_gain_normal_ofdm(struct rtw89_dev *rtwdev,
-- 
2.53.0


  parent reply	other threads:[~2026-11-12  6:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  6:05 [PATCH rtw-next 00/11] wifi: rtw89: correct no 2GHz band condition, update RTL8922D settings Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 01/11] wifi: rtw89: coex: add a notify entry for dynamic MLO RF-path switch Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 02/11] wifi: rtw89: pci: reclaim TXBD before fully draining Ping-Ke Shih
2026-11-12  6:05 ` Ping-Ke Shih [this message]
2026-11-12  6:05 ` [PATCH rtw-next 04/11] wifi: rtw89: 8922d: set CFR clip threshold while setting channel Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 05/11] wifi: rtw89: 8922d: correct thermal trim range to -16~+16 programmed in efuse Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 06/11] wifi: rtw89: introduce bitmap of supported bands to deal with quirks Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 07/11] wifi: rtw89: get default channel based on supported bands Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 08/11] wifi: rtw89: fix band assignment in rtw89_core_update_rx_freq_from_ie() Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 09/11] wifi: rtw89: Update sequence for MLO link switch Ping-Ke Shih
2026-11-12  6:05 ` [PATCH rtw-next 10/11] wifi: rtw89: 8922d: enable dynamic antenna gain Ping-Ke Shih
2026-11-12  6:06 ` [PATCH rtw-next 11/11] wifi: rtw89: phy: fix antenna gain unit in debug output Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112060600.71784-4-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=damon.chen@realtek.com \
    --cc=kevin_yang@realtek.com \
    --cc=ku920601@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=phhuang@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox