The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: luka.gejak@linux.dev
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: Luka Gejak <luka.gejak@linux.dev>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michael Straube <straube.linux@gmail.com>,
	Peter Robinson <pbrobinson@gmail.com>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>
Subject: Re: [PATCH v2 05/11] wifi: rtw88: coex: add the RTL8723BS scan antenna workaround
Date: Thu, 30 Jul 2026 07:44:58 +0000	[thread overview]
Message-ID: <20260730074504.19725-4-luka.gejak@linux.dev> (raw)
In-Reply-To: <c04cb1048e1940b1bc63dd68732998d8@realtek.com>

From: Luka Gejak <luka.gejak@linux.dev>

On 27/07/2026 07:58, Ping-Ke Shih wrote:
>> +/* 8723BS SDIO WiFi/BT coexistence antenna handling. On BT-disabled boards the
> 
> comment style.

Fixed here and everywhere else in the series.

>> +#define REG_8723BS_BT_COEX_CTRL                0x0039
>> +#define REG_8723BS_BB_ANT_CFG          0x0930
>> +#define REG_8723BS_BB_ANT_CFG1         0x0944
>> +#define REG_8723BS_BB_ANT_BUF          0x0974
>> +#define RTW8723BS_COEX_H_WLAN_ACTIVE   0x1800101b
> 
> define these in reg.h

Done for the registers. 0x0974 already existed as REG_RFE_CTRL_E, so I
use that. The other three are now

  #define REG_PWR_DATA		0x0038
  #define BIT_EEPRPAD_RFE_CTRL_EN	BIT(11)
  #define REG_RFE_CTRL_ANTA_SRC	0x0930
  #define REG_RFE_CTRL_ANT_SW	0x0944
  #define BIT_RFE_CTRL_ANT_SW_SEL	GENMASK(1, 0)

0x0039 is the second byte of REG_PWR_DATA and the bit the vendor sets
there is bit 11 of the register, which rtl8xxxu calls
PWR_DATA_EEPRPAD_RFE_CTRL_EN, so I used the same name with rtw88's
BIT_ prefix. 0x0930 is rfe_ctrl_anta_src in the vendor PHY register
header. 0x0944 has no vendor name I could find, so I named it after
what the write does; happy to take a better one if you have it.

0x1800101b I left in coex.c: it is a value written to
REG_BT_COEX_TABLE_H, not a register, and coex.c already keeps its other
table values inline. Say the word and I will move it.

>> +/* Write BB_SEL_BTG, retrying once with SYS_FUNC BB reset if the first
> 
> With the given name, this comment seems not necessary.

Removed.

>> +       if ((sys_func_before & (BIT(0) | BIT(1))) != (BIT(0) | BIT(1)))
>> +               rtw_write8_set(rtwdev, REG_SYS_FUNC_EN, BIT(0) | BIT(1));
> 
> Use given names for BIT 0/1.

Now BIT_FEN_BB_GLB_RST | BIT_FEN_BB_RSTB. The same open-coded sequence
appeared twice, so it is factored into rtw_coex_8723bs_enable_bb().

>> +static u32 rtw_coex_8723bs_reassert_pta_ant(struct rtw_dev *rtwdev)
> 
> Just call rtw_coex_8723bs_write_bb_sel_btg() ?

Dropped. rtw_coex_8723bs_write_bb_sel_btg() now takes no value and
computes the PTA path itself, since that was the only value ever
written.

>> +static void rtw_coex_8723bs_fw_gnt_bt_low(struct rtw_dev *rtwdev)
>> +{
>> +       if (!rtw_coex_8723bs_bt_disabled(rtwdev))
> 
> Please review your calling path. I think callers should ensure RTL8723BS
> before calling. (But here needs additional condition bt_disabled though)
[...]
>> +       if (!rtw_is_8723bs(rtwdev))
> 
> Caller check this already.
[...]
>> +       if (coex_stat->bt_disabled)
> 
> It looks like callers check this already.

All of these are gone. There are now exactly two entry points from the
common flow, rtw_coex_8723bs_scan_notify() and
rtw_coex_8723bs_connect_notify(), which test the chip and bt_disabled
once and return true when they have handled the notification.
Everything below them assumes both. rtw_coex_8723bs_bt_disabled() is
gone with them.

While doing that I found rtw_coex_8723bs_set_cck_pri() was only ever
called with high=true, so the argument and its dead else branch are
removed too.

> I wonder how you can make this workaround? There are so many arguments.

It is halbtc8723b1ant_SetAntPath() for the wifi-only / BT-off case,
plus the vendor's non-connected coex table and PS-TDMA type 8. Every
register write in the function maps one to one onto a vendor write in
that path; I did not invent any of the values. I then removed them one
at a time on hardware to check each was actually load bearing, which is
how the ones below went.

>> +                       req.op_code = BT_MP_INFO_OP_SUPP_VER;
>> +                       rtw_fw_query_bt_mp_info(rtwdev, &req);
>> +                       req.op_code = BT_MP_INFO_OP_PATCH_VER;
>> +                       rtw_fw_query_bt_mp_info(rtwdev, &req);
> 
> These two are debug purpose. When you cat debugfs, it will try to query the
> version, won't it?
> 
>> +                       rtw_fw_query_bt_info(rtwdev);
> 
> It seems to be called at initial. Is it necessary?

You are right on both counts, all three are removed.

Measured over 10 cold module reloads, three scans each, with and
without them:

  with:     24/24 scans saw the target AP, 8/8 associations
  without:  29/30 scans saw the target AP, 10/10 associations

The single miss is one scan pass not catching a beacon, not a
regression. The pre-auth rtw_fw_query_bt_info() in patch 06 went the
same way, together with two of the three repeated PS-TDMA H2Cs there.

> Since RTL8723BS does special handle, just move all into a function, but put
> in common flow.

Done, that is rtw_coex_8723bs_scan_notify() above.

>> +void rtw_coex_8723bs_scan_workaround(struct rtw_dev *rtwdev);
> 
> Just static no need to export.

Static now, and the coex.h declaration is gone.

Best regards,
Luka Gejak

  reply	other threads:[~2026-07-30  7:45 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 15:04 [PATCH v2 00/11] wifi: rtw88: preparations for RTL8723B/RTL8723BS luka.gejak
2026-07-25 15:04 ` [PATCH v2 01/11] wifi: rtw88: add the RTL8723B chip type and SDIO helper luka.gejak
2026-07-27  7:12   ` Ping-Ke Shih
2026-07-27 13:25     ` Luka Gejak
2026-07-30  6:27       ` Luka Gejak
2026-07-30  9:21         ` Ping-Ke Shih
2026-07-30  7:44     ` luka.gejak
2026-07-30  9:17       ` Ping-Ke Shih
2026-07-30 14:28         ` Luka Gejak
2026-07-25 15:04 ` [PATCH v2 02/11] wifi: rtw88: rx: mark zero length packets on RTL8723BS luka.gejak
2026-07-27  7:14   ` Ping-Ke Shih
2026-07-30  7:44     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 03/11] wifi: rtw88: fw: add the GNT_BT firmware command luka.gejak
2026-07-25 15:04 ` [PATCH v2 04/11] wifi: rtw88: fw: fix the reserved page upload on RTL8723BS luka.gejak
2026-07-27  7:37   ` Ping-Ke Shih
2026-07-30  7:44     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 05/11] wifi: rtw88: coex: add the RTL8723BS scan antenna workaround luka.gejak
2026-07-27  7:58   ` Ping-Ke Shih
2026-07-30  7:44     ` luka.gejak [this message]
2026-07-25 15:04 ` [PATCH v2 06/11] wifi: rtw88: coex: reassert the antenna path when associating luka.gejak
2026-07-27  8:21   ` Ping-Ke Shih
2026-07-30  7:44     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 07/11] wifi: rtw88: sdio: track free TX pages and OQT credits for RTL8723BS luka.gejak
2026-07-27  8:52   ` Ping-Ke Shih
2026-07-30  7:45     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 08/11] wifi: rtw88: sdio: set up RX aggregation and interrupts " luka.gejak
2026-07-27  8:59   ` Ping-Ke Shih
2026-07-30  7:45     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 09/11] wifi: rtw88: sdio: add TX back-pressure and retry on page starvation luka.gejak
2026-07-27  9:21   ` Ping-Ke Shih
2026-07-30  7:45     ` luka.gejak
2026-07-30  9:02       ` Ping-Ke Shih
2026-07-25 15:04 ` [PATCH v2 10/11] wifi: rtw88: record beacons from the target BSSID before authenticating luka.gejak
2026-07-27  9:27   ` Ping-Ke Shih
2026-07-30  7:45     ` luka.gejak
2026-07-25 15:04 ` [PATCH v2 11/11] wifi: rtw88: run the RTL8723BS association register sequence luka.gejak
2026-07-27  9:33   ` Ping-Ke Shih
2026-07-30  7:45     ` luka.gejak

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=20260730074504.19725-4-luka.gejak@linux.dev \
    --to=luka.gejak@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pbrobinson@gmail.com \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=straube.linux@gmail.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