Warning
This project is now discontinued. Mediatek has released official patches to support MT7902 on mt76 driver including both SDIO & PCIe. I can finally put this project to rest. mt76 support will available soon, or you can check out my backporting attempt here.
Caution
This driver is still in Work-In-Progress state ! Using it requires extra work which will be explained below. It is not suitable for everyday use yet !
This is a driver for the Mediatek MT7902 PCIe card based on the gen4-mt79xx driver Mediatek gave for Android OEMs. This driver is extracted from Xiaomi's rodin BSP and is being modified to focusing on supporting the MT7902 card only. The main goal of the project is to provide an usable driver for this particular M.2 PCIe card which is not available on the mt76 driver yet.
The driver is buildable and loadable. It can be able to connect to 2.4Ghz wifi so far. However, upon testing, I've noticed these issues:
- Can't switch to 5Ghz if you are on a SSID with both 2.4/5. (it could be because I test this card without antenna !)
- WPA3 broken when using
iwdaccording to this finding, so usewpa_supplicantinstead. - Can't create wifi hotspot to act as a repeater.
- Chunky compiled size with almost ~100mb, might be due to the debug code it has.
- Suspend using s2idle is working thanks to kadenslater95, S3 suspend is broken and will show black screen when waking up.
- There are some reports about the driver causing kernel panic, mostly on ASUS hardware with the AW-XB552NF card. The panic looks like this
Warning
If the wifi is ever flaky just restart your device and it should kick back on. If it doesn't work or the card power management is broken, use sudo rmmod mt7902 whenever you wanna sleep or shut down the device !
There are some features that are untested such as Bluetooth (which is not covered by this driver) and WIFI 6/6E.
Important
Before building & installing this driver, remember to install essential packages to build a kernel driver like linux kernel's headers & toolchain. I will not cover it here.
- Get the source by using
git
git clone https://github.com/hmtheboy154/gen4-mt7902
cd gen4-mt7902- To only build the driver, use this command
make -j$(nproc)- To build the driver & install it, use this command
sudo make install -j$(nproc)- To install the firmware required for the driver, use this command
sudo make install_fwOnce you got the driver & firmware installed, reboot to see changes.
If you want the driver to be automatically rebuilt after each kernel update, use DKMS:
- Install DKMS:
# Debian/Ubuntu
sudo apt install dkms
# Fedora
sudo dnf install dkms
# Arch
sudo pacman -S dkms- Copy the source to
/usr/src:
sudo mkdir -p /usr/src/gen4-mt7902-0.1
sudo cp -r * /usr/src/gen4-mt7902-0.1/- Register, build, and install the driver with DKMS:
sudo dkms add -m gen4-mt7902 -v 0.1
sudo dkms build -m gen4-mt7902 -v 0.1
sudo dkms install -m gen4-mt7902 -v 0.1- To install the firmware required for the driver, use this command (if you didn't install it before)
sudo make install_fwAfter reboot, the driver should be loaded automatically, and DKMS will rebuild it for any future kernel updates.
Currently the driver is being tested on some of these models:
- WMDM-257AX (tested without antenna connected)
- AW-XB552NF
Caution
For AW-XB552NF, you might want to read Status again
I'm thinking 5.4+. Older version may work, but you're on your own.
I will try, but my knowledge & abilities are very limited. Not to mention I am very busy right now due to spending time on BlissOS & focusing most of my time on university's capsule project.
Any contributions to the project especially during these times are like ✨gold✨ to me, thank you very much. 🙏
Yes and No. Yes you can and I already did some attempt before. However, No because it is not as easy as adding mt7902 info to the driver and expecting it to run smoothly. It turned out that Mediatek gave a very special firmware to the MT7921 family and you will have to spend extra time to figuring out how to use the Windows firmware on the mt76 driver.
I don't know, I never tested Bluetooth before. I did make a patch for btmtk based on the info I gathered from rodin's BSP. If you planned to build the kernel on your own or making OOT driver for btmtk, you can find it here:
https://gist.github.com/hmtheboy154/b2675e02d5f9a0bb861598e77ec2f38f
I noticed there's this newer gen4m driver which looks more active. Can we bring MT7902 info to that driver and use it instead ?
Maybe ? I've tried to compare gen4m's MT7961 to the gen4-mt79xx one before and looks like there're a lot of changes. It doesn't look impossible though, maybe you can try :).
There's this Discord group that I found.
There's one on the Discord group above.