Rtw89

From ThinkWiki
Jump to: navigation, search

rtw89 is the Linux driver for Realtek 802.11ax WiFi devices starting with the Realtek 8852AE ASIC. Rather than updating the exiting rtw88 driver, Realtek engineers wrote and contributed a completely rewritten one for their redesigned wireless chipset of the 8852AE, which will be used in future Realtek WiFi chips as well.

The driver is included in Linux kernel 5.16 (released Jan 2022), patches for kernels 5.4 (Nov 2019) to 5.15 are available.

For example, the Lenovo ThinkPad P14s Gen2 series from 2021 requires the new driver.

Kernel configuration

The rtw89 driver may be built into the kernel [*] or as a loadable kernel module <M> and can be selected in the kernel configuration as follows (example: make menuconfig):

Device Drivers  --->
  [*] Network device support  --->  (NETDEVICES [=y])
        [*]   Wireless LAN  --->  (WLAN [=y])
            <M>     Realtek 802.11ax wireless chips support  --->  (RTW89 [=m])
                --- Realtek 802.11ax wireless chips support
                <M>   Realtek 8852AE PCI wireless network adapter  (RTW89_8852AE [=m])
                [*]   Realtek rtw89 debug message support  (RTW89_DEBUGMSG [=y])
                [ ]   Realtek rtw89 debugfs support  (RTW89_DEBUGFS [=n])

Kernel patches

The patch series to get the rtw89 driver into the kernel sources requires the kernel and/or its modules to be compiled by the end-user, alternatively some distributions may provide a pre-compiled DKMS package for the driver as well.

One way to patch an existing kernel is to download the v6 patch from lore.kernel.org; It is sufficient to copy&paste the whole message into one file, e.g. rtw89v6.patch. Alternatively, using links or lynx (example with links) the v6 patch series can be downloaded from the shell:

# links -dump "https://lore.kernel.org/all/482cc641-7ba1-7d7a-f2eb-5d39aea9a5cd@lwfinger.net/T/" > /tmp/rtw89v6.patch

Applying the whole patch series to an existing kernel source tree:

$ cd /usr/src/linux
$ patch -p1 < /tmp/rtw89v6.patch

After patching the kernel, the rtw89 driver is available for selection in the kernel configuration.

The driver will be automatically loaded on compatible hardware (example where rtw89 was build as a loadable module), for proper function the required firmware files have to be provided.

$ uname -r
5.12.0
$ lspci -d :8852 -nn
03:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8852AE 802.11ax PCIe Wireless Network Adapter [10ec:8852]
$ lsmod | grep rtw89
rtw89_pci              45056  0
rtw89_core            880640  1 rtw89_pci

Firmware

The driver requires specific firmware, which should be supplied by the general (non-free) firmware package of any Linux distribution. If a firmware blob is missing, it can be downloaded manually and put in the required path (normally /lib/firmware).

For the Realtek 8852AE the firmware binary file is rtw89/rtw8852a_fw.bin (in freedesktop.org drm-firmware since Feb 2021).

External links

  • Phoronix article about initial rtw89 development
  • rtw89 GitHub repository