Commit Graph

4307 Commits

Author SHA1 Message Date
Johannes Berg
3a006d09a2 rtw-next patches for v7.3
Some random cleanups and fixes on rtlwifi, rtw88 and rtw89. The major
 features added to rtw89 are listed:
 
 rtw89:
 
  - add LED support
 
  - update BT-coexistence mechanism to support dual Bluetooth for RTL8922D
 
  - support WiFi 7 chip RTL8922DE
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEuyEnvMdOsBl1WjpdjlvZYmhshd8FAmpuqQAACgkQjlvZYmhs
 hd+RcxAAvOxWrvFuWBkpZoo9+z7COPtpDhOVfBCEnx2qpMtm9sUSHGsCaOuETvm+
 AZAUG2GpYFzcOEVIawdX7CAMd2sg7MXVPxgKrY0VO+SVuFCnbWOp/AqJOqdgC5fA
 HZHfBT+yHGiMh7U/F8p8rDtXrXS+7v5yld8yyNEXhxCK647HKFA84qLqY4f4wFN3
 MtN30B5Pj0mlTCAM+h7W6j2uc5h88jj7fjNDQa3SehfM3q/i6h8cXkTx/dw2i2ul
 XWtPIADYjwZFfL20BujIVOyVQQrUnFb2SZhoBeQn1sru5c0yzfklOa5SFscynuex
 XOIF3PhUeSBnNxP233vBJNx/ZwWRlZCjdXPqdBpX/g26FxCzNL/i1gjzP2X4Uz25
 QaS/6mWB4ZRoexoPWDf6XbeYmDjFtY3A1ecwOSsUSul5PSPzoeYrQExWx6BuRsE0
 vXH+FmgZUEmiQULgiIoglGdaerScI2p5U9AkIaoviBkbdb8bBj1FG3iMMR+K6pM4
 ERQtV5Y4mQ8DDhBGjcAwvccciawNeUYx5qz5rfn4dFZYZo7mntoLhGl/zbF/JvbA
 B55EH3jAR1ekyqy0pumUQKce0IZzb0Ogk24dfZHu84ZHca3+grSJUuuWxYId1BUq
 CoEfXuDLQ750r3dONF/R8y/g4FXnoC/U1LRq83k3mgTUqFeMZeE=
 =8EO5
 -----END PGP SIGNATURE-----

Merge tag 'rtw-next-2026-08-02' of https://github.com/pkshih/rtw

Ping-Ke Shih says:
==================
rtw-next patches for v7.3

Some random cleanups and fixes on rtlwifi, rtw88 and rtw89. The major
features added to rtw89 are listed:

rtw89:

 - add LED support

 - update BT-coexistence mechanism to support dual Bluetooth for RTL8922D

 - support WiFi 7 chip RTL8922DE
==================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-08-02 18:50:03 +02:00
Ping-Ke Shih
86c3125c75 wifi: rtw89: 8922d: enable Makefile and Kconfig for RTL8922DE
RTL8922DE is a WiFi 7 chipset, supporting 2x2 2GHz/5GHz/6GHz 4096/1024-QAM
160MHz channels. As STA, AP and P2P modes work well, enable this chipset.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-8-pkshih@realtek.com
2026-08-02 09:55:20 +08:00
Ching-Te Ku
97b81c10fe wifi: rtw89: coex: Update Wi-Fi/Bluetooth coexistence version to 9.24.1
The 9.24.1 coexistence version included firmware 0.35.111.X support for
RTL8922A/D, 0.24.97.X support for RTL8852C, 0.29.133.X support for
RTL8852B chip family.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-7-pkshih@realtek.com
2026-08-02 09:55:04 +08:00
Ching-Te Ku
dd7e70e76b wifi: rtw89: coex: Port _update_bt_ctrl_lps() for BT profile-based LPS control
The old lps_ctrl_scbd logic in _update_bt_scbd() blocked WiFi LPS only
when mode == BTC_WLINK_V0_2G_STA, which created a dead-lock while
WiFi already in LPS suppressed TDD binding so mode was never set to
BTC_WLINK_V0_2G_STA, lps_ctrl_scbd stayed 0, and WiFi remained stuck
in LPS. Port _update_bt_ctrl_lps() from the reference implementation to
check BT profile existence (A2DP, HFP, PAN) for both radios directly,
with out_of_band and freerun guards so LPS is only blocked when WiFi and
Bluetooth actually share a band. Call it from both _update_bt_scbd() and
_update_bt_info() so profile changes reported via either SCBD or BT info
C2H correctly update lps_ctrl_scbd. Also remove the dead
lps_ctrl_scbd_last field.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-6-pkshih@realtek.com
2026-08-02 09:53:22 +08:00
Ching-Te Ku
4d9f081150 wifi: rtw89: coex: Change Wi-Fi link_mode_v0 translating timing
Logic should only get explicit link_mode only, to cover the old branch
link_mode_v0 using (old branch firmware needed) should do translating
after link_mode is settled. And the coexistence logic has already updated
to new branch style, so the logic should use new link_mode, don't need
to consider link_mode_v0. To prevent unexpected logic bug, refine the
related logic.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-5-pkshih@realtek.com
2026-08-02 09:53:06 +08:00
Ching-Te Ku
8847c1b12b wifi: rtw89: coex: Clear BT link weight when BT is disabled
When a BT device is disabled, _update_bt_link_cnt() is no longer called
for that device, so its link_weight[] retains stale values from the last
active period. _set_bind_info() then computes a non-zero band score for
the disabled device, which can lead to an incorrect tdd_bind.rf_band
selection and ultimately wrong coexistence policy.

Clear link_weight[] for any disabled BT device at the start of the
_set_bind_info() loop so that stale scores are not carried forward.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-4-pkshih@realtek.com
2026-08-02 09:52:50 +08:00
Ching-Te Ku
cf7f33eb04 wifi: rtw89: coex: Fix BT-info parsing for 5/6 GHz band & dual Bluetooth
The _update_bt_info() function always parsed BT-info for bt0 and used a
single raw_info buffer regardless of which BT device sent the packet or
which RF band it belongs to. This caused two bugs:

1. BT-info packets from bt1 were incorrectly parsed into bt0's state.

2. BT-info packets from 5/6 GHz BT (L1 bit7=1) overwrote the 2.4 GHz
   link_info and raw_info, breaking duplicate detection across bands.

Fix by adding the bid parameter to select bt0/bt1, detecting the 5/6 GHz
band flag (L1 bit7) to route packets into link_info_56g with a dedicated
raw_info_56g buffer, and updating the early-return mask to ignore bit7
when checking the length field.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-3-pkshih@realtek.com
2026-08-02 09:51:10 +08:00
Ching-Te Ku
e62f0baca0 wifi: rtw89: coex: Fix Bluetooth link weight not updated on profile change
_update_bt_link_cnt() was missing the bt->link_weight[].
Without it, link_weight stays at the initial value of 5
(set on BT re-enable) regardless of the active BT profile.

_set_bind_info() uses link_weight to compute b2g_score/b5g_score, which
determines tdd_bind.rf_band. With a stale weight of 5 (below the active
profile threshold), tdd_bind.rf_band may not reflect the actual RF band,
causing mode_v0 in _run_coex() to remain 0 (BTC_WLINK_NOLINK), which
incorrectly triggers _action_wl_nc() instead of the BT-profile action.

Add the link_weight calculation to _update_bt_link_cnt() using the same
weighting table as Formal (BIS/A2DP-sink: 70, A2DP: 40-60, PAN/active: 30,
no-profile: 5, else: 9) and call _update_bt_link_cnt() from
_update_bt_info() after parsing the profile exist flags, replacing the
open-coded link_cnt increment that omitted le-audio profiles.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260730060220.55844-2-pkshih@realtek.com
2026-08-02 09:50:54 +08:00
Po-Hao Huang
d946a4e031 wifi: rtw89: change scan offload format to V3 for WiFi 7 IC
Adapt H2C format to fit firmware version after 0.35.113.2, which
only supports active scanning with a provided SSID list.
The wildcard_6ghz field is no longer required for WiFi 7 chips' new
format, but not removed since WiFi 6 still requires it.
Keep original H2C style also to support older firmwares.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260729124354.3231368-4-pkshih@realtek.com
2026-08-02 09:31:24 +08:00
Po-Hao Huang
58c0d447c5 wifi: rtw89: fix scan offload version check logic
The version check with less than should check for smallest upper-bound
first, or some branch will be unreachable.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260729124354.3231368-3-pkshih@realtek.com
2026-08-02 09:31:07 +08:00
Dian-Syuan Yang
304720870f wifi: rtw89: refine RX filter configuration for WiFi 7 generation
When an AP interface is registered and starts AP, mac80211 calls the
configure_filter() to clear B_AX_A_UC_CAM_MATCH and B_AX_A_BC_CAM_MATCH
so that frames from un-associated stations can be received. However, for
a dedicated AP interface created via iw command, configure_filter() is
only triggered on the initial AP startup. Since the interface remains up
even after hostapd stops, and it isn't triggered again on later restarts.
Additionally, each AP start causes IPS leave, reverting the RX filter to
its default value.

For WiFi 7 chips, the default value is hardcoded in rx_fltr_init_be(),
so the reverted value does not match hal.rx_fltr. Therefore, refine
the behavior of WiFi 7 chips to align with the WiFi 6 implementation.

Signed-off-by: Dian-Syuan Yang <dian_syuan0116@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260729124354.3231368-2-pkshih@realtek.com
2026-08-02 09:29:26 +08:00
Yuhang.chen
667c12782a wifi: rtw89: pci: add .shutdown callback to stop rfkill polling on reboot
Since the hardware rfkill polling was introduced, arm64 platforms can
panic with an asynchronous SError during warm reboot:

  SError Interrupt on CPU8, code 0x00000000be000011 -- SError
  Workqueue: events_power_efficient rfkill_poll [rfkill]
    rtw89_pci_ops_read8+0x94/0x160 [rtw89_pci]
    rtw89_core_rfkill_poll+0x50/0x1e0 [rtw89_core]
    rtw89_ops_rfkill_poll+0x40/0x68 [rtw89_core]
    ieee80211_rfkill_poll+0x3c/0x70 [mac80211]
    cfg80211_rfkill_poll+0x40/0x2a0 [cfg80211]
    rfkill_poll+0x30/0x88 [rfkill]
  Kernel panic - not syncing: Asynchronous SError Interrupt

On the reboot path the kernel only runs device_shutdown(), which calls
each driver's .shutdown callback; .remove is not invoked.  The rtw89 PCI
driver had no .shutdown callback, so nothing stopped the rfkill polling
work while the platform was tearing the PCIe link down.  Once the link
is gone, the next MMIO read from the poll handler targets a
non-responding device and is reported as a fatal asynchronous SError on
arm64.

Add rtw89_pci_shutdown(), wired to all rtw89 PCI device drivers, which
sets a new RTW89_FLAG_SHUTDOWN flag (mirroring the USB
RTW89_FLAG_UNPLUGGED pattern).  When the flag is set,
rtw89_ops_rfkill_poll() returns early, so no MMIO read is issued to the
chip after shutdown begins and the SError no longer occurs.

This does not call the full .remove path from .shutdown, to keep the
shutdown handler minimal and avoid running the non-idempotent teardown
twice.

Fixes: 0b38e6277a ("wifi: rtw89: add support for hardware rfkill")
Cc: stable@vger.kernel.org
Suggested-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yuhang.chen <yhchen312@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260729014142.2746777-1-yhchen312@gmail.com
2026-08-02 09:14:34 +08:00
Abdun Nihaal
9f29480107 wifi: rtw88: Fix potential memory leak in rtw_txq_push_skb()
The skb passed to the rtw_hci_tx_write() is expected to be freed when
the function fails, but the error path in rtw_txq_push_skb() does not
free the skb before returning. This can lead to a memory leak in
rtw_txq_push() where a dequeued skb is passed to rtw_txq_push_skb().

Fixes: aaab5d0e67 ("rtw88: kick off TX packets once for higher efficiency")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260727064223.61836-1-nihaal@cse.iitm.ac.in
2026-07-30 13:37:50 +08:00
Sang-Heon Jeon
bbc18041ad wifi: rtw89: remove conditional return with no effect in sys_init_*()
Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260726134034.1385834-3-ekffu200098@gmail.com
2026-07-30 13:34:47 +08:00
Sang-Heon Jeon
c13ab5bed7 wifi: rtlwifi: rtl8821ae: remove conditional return with no effect in _rtl8821ae_llt_write()
Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260726134034.1385834-2-ekffu200098@gmail.com
2026-07-30 13:34:11 +08:00
Ching-Te Ku
6a43bbee78 wifi: rtw89: coex: Handle Bluetooth LE-Audio related coexistence feature
Implement event handler of BTF_EVNT_BT_LEAUDIO_INFO C2H command, and
related coexistence mechanism for Bluetooth LE-Audio feature.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-15-pkshih@realtek.com
2026-07-30 10:40:10 +08:00
Ching-Te Ku
4406b550ae wifi: rtw89: coex: Fix H2C command redundant send & version fall through
I/O offload higher priority sending event didn't return after H2C command
was sent, add a return to prevent send twice in the same time. Update
driver info entry which is handling module control info didn't handle the
version 9 command format, add if condition to handle it. TX power update
H2C command result checker logic was reversed, it will lead to the TX
power value never update again after first update, fix the issue.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-14-pkshih@realtek.com
2026-07-30 10:39:54 +08:00
Ching-Te Ku
ffb7d6a1c6 wifi: rtw89: coex: Fix TDMA v8 handling to unblock BTC report parsing
fcxtdma=8 was not handled in _chk_btc_report(), causing the parser to
hit 'goto err' and return 0 when processing the TDMA sub-report. This
broke the _parse_btc_report() loop before reaching BT_VER (type=9),
leaving bt->ver_info.fw always zero on RTL8922A/D.

TDMA v8 uses the same struct layout as v3/v4/v7 (rtw89_btc_fbtc_tdma_v3,
12 bytes), so add it to the existing v3/v4/v7 branch in both switch cases.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-13-pkshih@realtek.com
2026-07-30 10:39:37 +08:00
Ching-Te Ku
2951ecd83c wifi: rtw89: coex: Add dual Bluetooth debug info dump
As RTL8922D support dual Bluetooth, add BT debug info dump for it.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-12-pkshih@realtek.com
2026-07-30 10:39:20 +08:00
Ching-Te Ku
068daf7086 wifi: rtw89: coex: Add BTC report version 8 support for BT sub-reports
RTL8922A (FW >= 0.35.111) and RTL8922D (FW >= 0.35.94) set fcxbtver,
fcxbtscan and fcxbtafh to 8, but the handler in _chk_btc_report only
had branches for version 1 and 7.  When version 8 arrived pfinfo was
left NULL and pcinfo->req_len was left at zero, so the length check at
validation stage rejected the report and bt->ver_info.fw was never
written, causing BT_FW:0x0 in the BTC dump.

BT-scan and BT-afh version 8 hit the goto err path for the same reason,
making all BT sub-reports silently broken on these chips.

The structural change in version 8 is that the previously reserved
second byte in each struct is now bt_id (0 = BT0, 1 = BT1), allowing
firmware to send separate reports for each Bluetooth device. All three
structs are otherwise layout-compatible with version 7.

Add rtw89_btc_fbtc_btver_v8, rtw89_btc_fbtc_btscan_v8 and
rtw89_btc_fbtc_btafh_v8 structs with the bt_id field, extend the
corresponding unions, add version 8 branches to _chk_btc_report, and
update _update_bt_report to route each report to BT0 or BT1 according
to BT ID.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-11-pkshih@realtek.com
2026-07-30 10:37:33 +08:00
Ching-Te Ku
b23378a564 wifi: rtw89: coex: Fix log dump format with proper newline
Fix the log output format in _show_mreg_v7() where the phy-0 gnt_status
line was missing the proper field label and newline. Use the standard
" %-15s : " format with "[gnt_status]" label consistent with the rest
of the dump output.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-10-pkshih@realtek.com
2026-07-30 10:37:17 +08:00
Ching-Te Ku
528e5e1d78 wifi: rtw89: coex: Refine RF calibration notify flow
BT-coexistence only needs to record RF calibration is doing or not, don't
need to record the status of the calibration steps.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-9-pkshih@realtek.com
2026-07-30 10:37:01 +08:00
Ching-Te Ku
5c90259b97 wifi: rtw89: coex: complete GPIO debug configuration handler
Complete the implementation of _fw_set_gpio() function to support all
GPIO control configuration types for coexistence. Included debug signal,
antenna switch, external I2C mailbox, external PTA related GPIO
configuration. This function is called during initialization and when
BT re-enables.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-8-pkshih@realtek.com
2026-07-30 10:35:16 +08:00
Ching-Te Ku
b01bfd2fc7 wifi: rtw89: coex: Decrease Wi-Fi special packet protect time
While Wi-Fi is doing special packet handshake, or going into some
transient state, BT-Coexistence will held timer to fix control logic
to protect the segment. Set the protection duration to 1 second,
it is enough to cover the situation.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-7-pkshih@realtek.com
2026-07-30 10:34:20 +08:00
Ching-Te Ku
a76501e1d1 wifi: rtw89: coex: Separate _ntfy_role_info into two function
To make logic more clearly, separate _ntfy_role_info into two function by
data collecting and using.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-6-pkshih@realtek.com
2026-07-30 10:34:01 +08:00
Ching-Te Ku
86f763e372 wifi: rtw89: coex: Rearrange _ntfy_role_info info
rtw89_btc_wl_link_info is duplicated declaring in the function, remove one
of them. We need MAC Address only when Wi-Fi role is station, included the
copy operation into if statement.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-5-pkshih@realtek.com
2026-07-30 10:33:46 +08:00
Ching-Te Ku
eb70edecee wifi: rtw89: coex: Add firmware 0.35.111.X support for RTL8922A/D
Add BTC version table entries for RTL8922A and RTL8922D. The new firmware
need driver provide more chip initial related parameters.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-4-pkshih@realtek.com
2026-07-30 10:33:28 +08:00
Ching-Te Ku
04852fcad5 wifi: rtw89: coex: Add Wi-Fi MLO info version 2 H2C command
The info included MLO status, hardware status, firmware will set
corresponding register control to do coexistence (PTA slot priority,
RF switch etc.)

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-3-pkshih@realtek.com
2026-07-30 10:31:43 +08:00
Ching-Te Ku
6f24d22a31 wifi: rtw89: coex: Add chip initial info version 11 for RTL8922A/D
The version 11 init info add current RF path control information.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260724135640.3195044-2-pkshih@realtek.com
2026-07-30 10:29:55 +08:00
Abdun Nihaal
3c2999d13e wifi: rtlwifi: pci: fix error path in rtl_pci_probe()
In the last error path in rtl_pci_probe(), the cleanup functions are
skipped due to a wrong goto label. Moreover, the successful call to
rtl_init_rfkill(), ieee80211_register_hw(), rtl_debug_add_one() have to
be reverted. Fix this issue by updating the labels and adding the
relevant cleanup functions to the last error path.

Fixes: 0c8173385e ("rtl8192ce: Add new driver")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260723120118.145383-1-nihaal@cse.iitm.ac.in
2026-07-30 10:27:40 +08:00
Abdun Nihaal
6496ce9084 wifi: rtlwifi: rtl8192du: Fix possible memory leak in rtl92du_init_sw_vars()
The memory allocated inside rtl92du_init_shared_data() is not freed in
any of the subsequent error paths in rtl92du_init_sw_vars().
Fix that by adding a call to rtl92du_deinit_shared_data() in the error
path.

Fixes: b5dc8873b6 ("wifi: rtlwifi: Add rtl8192du/sw.c")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260723114539.136986-1-nihaal@cse.iitm.ac.in
2026-07-30 10:26:12 +08:00
Stanislaw Gruszka
799b5f45cb wifi: rtl818x: initialize eeprom_93cx6 struct to zero
Commit 7738a7ab9d ("misc: eeprom: eeprom_93cx6: Add quirk for extra
read clock cycle") added extra 'quirk' field to struct eeprom_93cx6.

Many existing users of eeprom_93cx6, including rtl818x drivers, allocate
the structure on the stack without initializing all fields. As a result,
the added quirk field has an undefined value and can randomly cause
reading wrong data from the EEPROM.

Fix by initializing the structures with {}.

Fixes: 7738a7ab9d ("misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle")
Cc: stable@kernel.org # v6.13+
Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260723110640.8588-1-stf_xl@wp.pl
2026-07-30 10:19:06 +08:00
Mihail Dimoski
b0034a2e41 wifi: rtw88: disable ASPM and deep PS on ASUS TUF Gaming A15 FA506II
The RTL8822CE on the ASUS TUF Gaming A15 FA506II wedges during normal
use. The driver watchdog toggles PCIe ASPM while leaving power save;
the DBI read of the ASPM link-config register fails with -EIO, the PCIe
link becomes unstable, and the device drops off the bus, taking Wi-Fi
down until a cold power cycle:

  rtw88_8822ce 0000:03:00.0: failed to read ASPM, ret=-5
  rtw88_8822ce 0000:03:00.0: firmware failed to leave lps state
  rtw88_8822ce 0000:03:00.0: mac power on failed

This is the same platform ASPM inter-operability problem already
handled for other machines through rtw_pci_quirks[]. Disabling PCI
ASPM and deep power save on this model stops the failure. Add a DMI
quirk so the workaround is applied automatically.

Signed-off-by: Mihail Dimoski <mihaildimoski@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260718124045.23493-1-mihaildimoski@gmail.com
2026-07-24 11:38:52 +08:00
Ching-Te Ku
38c58d541c wifi: rtw89: coex: Add firmware 0.27.97.X support for RTL8852C
Newer firmware is using the new TLV-Header format, without this patch
it will lead driver run into length mismatch state.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-14-pkshih@realtek.com
2026-07-24 11:20:30 +08:00
Ching-Te Ku
236badaa50 wifi: rtw89: coex: Add wifi role info version 101
The structure active_role which describes the using Wi-Fi role format is
different with the exist v1. Add branch to cover the difference.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-13-pkshih@realtek.com
2026-07-24 11:19:04 +08:00
Ching-Te Ku
b8892add7e wifi: rtw89: coex: Add cycle status report version 105
The exists version 5 format has FDDT(frequency divided training) related
information. But the feature wasn't support for RTL8852C now, so firmware
will not send the related reference value.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-12-pkshih@realtek.com
2026-07-24 11:17:16 +08:00
Ching-Te Ku
b87da03ee7 wifi: rtw89: coex: Add slots version 2
Slots structure version 2 uses new TLV-Header to package slots information,
patch related entry for version 2.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-11-pkshih@realtek.com
2026-07-24 11:15:31 +08:00
Ching-Te Ku
42a83b5f13 wifi: rtw89: coex: Add TDMA version 4
TDMA version 4 uses new TLV-Header to package TDMA information,
patch related entry for version 4.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-10-pkshih@realtek.com
2026-07-24 11:15:16 +08:00
Ching-Te Ku
58b1bde371 wifi: rtw89: coex: Add firmware 0.29.133.X support for RTL8852B family
The new firmware modified GPIO setup structure format for third party
chip set I/O control & offloaded Wi-Fi TRX status to firmware for training
traffic RF-Parameters & TDMA mechanism.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-9-pkshih@realtek.com
2026-07-24 11:15:01 +08:00
Ching-Te Ku
35b569b60a wifi: rtw89: coex: Fix Wi-Fi role info H2C command header issue
The function to filled up H2C command data is the last step in the driver,
the next step is going to firmware. So the structure version number should
not included driver local branch number (like firmware is v5, but driver
branch to v105), it should be assigned as a explicit version number which
paired with firmware.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-8-pkshih@realtek.com
2026-07-24 11:14:44 +08:00
Ching-Te Ku
81d30a7be8 wifi: rtw89: coex: Add driver info H2C command index version 103
The 0.29.133.X firmware driver info H2C index maximum is 5, to prevent
switch case fall through and send unexpected H2C commands, add version
code 103 as judgment.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-7-pkshih@realtek.com
2026-07-24 11:14:29 +08:00
Ching-Te Ku
49989a3fef wifi: rtw89: coex: Refine chip initial related structure
Due to the firmware version become more and more, the version divided
branch coding method make the related code scattered everywhere, and
too much version macro, rearrange the code, assign the value to version
format only when H2C commands.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-6-pkshih@realtek.com
2026-07-24 11:12:38 +08:00
Ching-Te Ku
00961e2705 wifi: rtw89: coex: Branch out version 105 firmware report map index
RTL8852B in firmware 0.29.133.X do not support BT-TX-PWR report, re-index
and branch out to version 105.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-5-pkshih@realtek.com
2026-07-24 11:12:20 +08:00
Ching-Te Ku
b5bfb43844 wifi: rtw89: coex: Fix unexpected grant-signal assignee
The C2H report is for knowing what the grant-signal setting is now,
not for applying new grant-signal setting.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-4-pkshih@realtek.com
2026-07-24 11:11:55 +08:00
Ching-Te Ku
4bedf26e13 wifi: rtw89: coex: Add version 9 report control info
WiFi firmware will save its build date/time and package into C2H event then
send to driver. It helps to analyze what kind of firmware was loaded now.
Remove unnecessary memory set.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-3-pkshih@realtek.com
2026-07-24 11:10:12 +08:00
Ching-Te Ku
0427315a6e wifi: rtw89: coex: Add version 107 TX/RX info for firmware feature
The previous version 7 format is for Dual-Bluetooth using. This patch
is for single Bluetooth solution using. Driver will summary Wi-Fi now
status for firmware to train RF parameters & TDMA mechanism.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717065739.64124-2-pkshih@realtek.com
2026-07-24 11:08:32 +08:00
Ping-Ke Shih
b3dc0a37fd wifi: rtw89: phy: set CFR to manual mode for some 2GHz channels
The CFR (Channel Frequency Response) manual mode condition for 2GHz is
missing to limit on bandwidth for specific channels, which are channel
13 with 20MHz bandwidth and channel 11 with 40MHz bandwidth. Also add
a band check to avoid affecting 5GHz/6GHz bands.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717061910.54466-10-pkshih@realtek.com
2026-07-24 10:41:04 +08:00
Ping-Ke Shih
e738d2ac80 wifi: rtw89: 8922d: reduce IO in power-on function
To improve initial time, merge some IO to reduce IO times. Two registers
are:
 1. R_BE_SYS_PW_CTRL: 0x4[12:11]=0, 0x4[18]=1, 0x4[15]=0, and 0x4[10]=0
 2. R_BE_SYS_ADIE_PAD_PWR_CTRL: Merge 0x18[6] and 0x18[5]

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717061910.54466-9-pkshih@realtek.com
2026-07-24 10:40:58 +08:00
Ping-Ke Shih
238bc3141c wifi: rtw89: pci: set PCIe maximum TS1 for RTL8922DE
Set TS1 (training sequence 1) to 1024 when PCIe enters recovery state to
improve RF interference while entering and leaving L1ss.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717061910.54466-8-pkshih@realtek.com
2026-07-24 10:40:34 +08:00
Ping-Ke Shih
ce18a0cbc3 wifi: rtw89: wow: extend timeout unit to avoid SER false alarm
With original timeout unit, it might trigger SER false alarm causing
WiFi card lost. Extend timeout unit to avoid wrong SER.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260717061910.54466-7-pkshih@realtek.com
2026-07-24 10:40:09 +08:00