Setting up Wi-Fi 7 and Realtek ALC4080 on Linux

Gagarine Yaikhom

26 April 2024, Friday

Abstract

How to set up Ubuntu Mate on a PC build with the MSI Pro Z790-A Max WiFi motherboard.

This concerns setting up Ubuntu Mate on a PC build with the MSI Pro Z790-A Max WiFi motherboard.

I initially installed Ubuntu Mate 22.04 LTS (Jammy Jellyfish), and everything worked except for Wi-Fi 7 and the front panel headphone/microphone jack. Solving all of the issues required upgrading to Ubuntu Mate 23.10 (Mantic Minotaur).

Setting up the front panel headphone/microphone jack

The motherboard uses a Realtek ALC4080 codec chipset for the audio, which the kernel handles using the snd_hda_intel module. Making this work requires alsa-libs version 1.2.7 or above, since alsa-ucm-conf from this version onwards describes the configuration to correctly use the chipset.

Solution:

  1. First check that your front panel headphone/microphone jack is connected to the motherboard correctly. When you run the following, which accesses the chipset directly, you should hear a voice on your headphone (connected to the front panel):
aplay -D plughw:Audio,1 /usr/share/sounds/alsa/Front_Left.wav
  1. Upgrade to Ubuntu Mate 23.10 (could have tried upgrading ALSA instead, but, didn’t bother).

  2. Add the following at the end of /etc/modprobe.d/alsa-base.conf:

options snd-hda-intel dmic_detect=0
  1. Restart the computer.

In alsamixer, I now have HDA Intel PCH and Generic USB Audio. The front panel headphone jack is controlled by the later. I haven’t tested the microphone yet.

Source:

Setting up Wi-Fi 7

The motherboard uses a Qualcomm FastConnect 7850 chipset to provide Wi-Fi 7 (802.11be) support.

This required a little bit of experimentation, but I now have Wi-Fi 7 working.

Solution:

Linux 6.5 onwards implement the ath12k module, which can handle this chipset for Wi-Fi 7.

The following are the minimal steps (I think) distilled from various sources by trial-and-error:

  1. Ensure that you have Linux kernel 6.5, or later. Mine is 6.5.0.28, which is the default kernel that came with Ubuntu Mate 24.10.

  2. Download the firmware binaries (I am not using git clone etc. here; just straight to what is needed):

mkdir ~/ath12k_firmware
cd ~/ath12k_firmware
wget https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware/-/raw/main/WCN7850/hw2.0/board-2.bin
wget https://github.com/kvalo/ath11k-firmware/raw/master/ath12k-testing/WCN7850/hw2.0/regdb.bin
wget https://github.com/kvalo/ath11k-firmware/raw/master/ath12k-testing/WCN7850/hw2.0/board.bin
wget https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware/-/raw/main/WCN7850/hw2.0/1.0.c5/WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3/Notice.txt
wget https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware/-/raw/main/WCN7850/hw2.0/1.0.c5/WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3/m3.bin
wget https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware/-/raw/main/WCN7850/hw2.0/1.0.c5/WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3/amss.bin
  1. The following are the SHA256 checksums I have:
$ sha256sum *
b15b21fd99baafd5dad81b6d6fa054df023363029821eb67dd674a438b9fd78d  amss.bin
92357946083541fc3370a152df57cb5a74cd28adcdc78339e57d8c98e42526cd  board-2.bin
b8ed1b7a38713a107591b1e627fb344e0a6ce222446b242670de72dbd6fe468c  board.bin
97eca0829a1da06bfcb000863f585e2c64ee7febae29f4822097dea1986d919b  m3.bin
515bf4c9d620a87458e4447fe01a0e9bc384d1c3e0037cc4c3d2037b1ff25525  Notice.txt
b3fb3706c9ba0617c547ad42720445d4745cff6a2daf0414a53fc426179ba642  regdb.bin
  1. I noticed that in the other firmware folders, the binaries were compressed using zstd, so I did that (leaving the original as well):
$ zstd *
  1. Set everything up:
sudo mkdir -p /lib/firmware/ath12k/WCN7850/hw2.0
sudo cp * /lib/firmware/ath12k/WCN7850/hw2.0
  1. Check the contents:
$ tree /lib/firmware/ath12k/WCN7850/hw2.0/
/lib/firmware/ath12k/WCN7850/hw2.0/
├── amss.bin
├── amss.bin.zst
├── board-2.bin
├── board-2.bin.zst
├── board.bin
├── board.bin.zst
├── m3.bin
├── m3.bin.zst
├── Notice.txt
├── Notice.txt.zst
├── regdb.bin
└── regdb.bin.zst

1 directory, 12 files
  1. Not sure if this is needed, but I did do it while experimenting. Create a file /etc/iwd/main.conf, with the following as content:
[General]
ControlPortOverNL80211=false
  1. Restart the computer, and don’t forget to enable both WiFi and bluetooth in the BIOS (there are options to enable these on the motherboard).

If everything is working, you should see something similiar to the following. In fact, I just experimented with this (researching the error messages it produced) until all the errors were gone.

$ sudo dmesg | grep ath12k
[sudo] password for ***: 
[    6.470422] ath12k_pci 0000:06:00.0: BAR 0: assigned [mem 0x81200000-0x813fffff 64bit]
[    6.470440] ath12k_pci 0000:06:00.0: enabling device (0000 -> 0002)
[    6.470601] ath12k_pci 0000:06:00.0: Hardware name: wcn7850 hw2.0
[    7.018765] ath12k_pci 0000:06:00.0: qmi dma allocation failed (7077888 B type 1), will try later with small size
[    7.026886] ath12k_pci 0000:06:00.0: chip_id 0x2 chip_family 0x4 board_id 0xff soc_id 0x40170200
[    7.026890] ath12k_pci 0000:06:00.0: fw_version 0x100301e1 fw_build_timestamp 2023-12-06 04:05 fw_build_id QC_IMAGE_VERSION_STRING=WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
[    7.032998] ath12k_pci 0000:06:00.0: failed to fetch board data for bus=pci,qmi-chip-id=2,qmi-board-id=255 from ath12k/WCN7850/hw2.0/board-2.bin
[    7.244475] ath12k_pci 0000:06:00.0 wlp6s0: renamed from wlan0
[   11.912982] UBSAN: array-index-out-of-bounds in /build/linux-JS8sCa/linux-6.5.0/drivers/net/wireless/ath/ath12k/mac.c:2777:17
[   11.913137]  ath12k_mac_op_hw_scan+0x392/0x3d0 [ath12k]

Source:

Cannot enter BIOS after MSI Fast Boot was enabled

This was one of those panic inducing situations. I enabled MSI Fast Boot (a boot option inside the BIOS), without thinking too much about it, and realised too late that this meant the peripherals such as USB are not scanned during boot (it says so on the BIOS info, Duh!). So, after restarting the computer, I could no longer enter the BIOS setup (pressing Del no longer works because the USB keyboard is unusable).

If you can at least log into Linux, and your distro uses systemd,

$ ps --no-headers -o comm 1
systemd

you can run the following, which will reboot the computer into UEFI Firmware settings mode (i.e., your BIOS setup):

systemctl reboot --firmware-setup

If this is not an option, there are Clear CMOS (reset BIOS) pins (marked as JBAT1 on the motherboard) that you can use with a jumper. See page 44 of the user’s manual for details.

Source:

Slow restart and shutdown

If restart or shutdown takes a long time, modify /etc/systemd/system.conf and uncomment the following:

DefaultTimeoutStopSec=5s

Set value to your requirement.