Skip to content

Instantly share code, notes, and snippets.

@pmdevita
Last active June 25, 2021 16:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmdevita/1e28ac0de8b97b4be7821828bb1102ff to your computer and use it in GitHub Desktop.
Save pmdevita/1e28ac0de8b97b4be7821828bb1102ff to your computer and use it in GitHub Desktop.
Linux Broadcom BCM4350/DW1820A/XPS 9350 Wi-Fi breaking on sleep fix

BCM4350/DW1820A/XPS 9350 Wi-Fi Fix

If you are using a BCM4350/DW1820A Wi-Fi card or an XPS 13 9350 on Linux, you may have run into an issue where your Wi-Fi stops working after suspension/sleep. Hopefully my hours of research can help you.

The Problem

It appears there is some kind of power management problem with this card. There are several different threads documenting these issues (I'll link them below). These issues were officially resolved sometime around kernel 4.19 but I'm still experiencing them and I imagine some other people might be too.

For me, most times when my laptop goes to sleep, it resumes with the wi-fi in a strange broken state. It doesn't respond and it can't search for networks. Rebooting straight into Windows creates a blue screen and rebooting straight to Mac (hackintosh gang) results in funny business with the wi-fi as well. Sometimes the only solution is to completely turn off the computer and then turn it back on.

Look through the linked threads if you want more details. I'm just going to give the solution here. It's a bit of a hack but it's 99% close enough.

The Solution

Unload the brcmfmac kernel module before sleep and load it back up after sleep. It adds a couple seconds extra to getting wi-fi back on after resuming but otherwise acts normal. Unfortunately, this only fixes Wi-Fi in Linux for me, rebooting to other OSes still causes the aforemented issues. The solution is to shutdown first, not reboot.

Copy these two services into your /etc/systemd/system folder and then run

sudo systemctl enable wifi-before-sleep.service
sudo systemctl enable wifi-after-sleep.service

From there you should be good to go.

The New Problem

So I'm not sure if this was there before but after I started using these services I started getting a weird problem where the wifi drivers would, at random, crash so bad, the computer would be unable to sleep or even shutdown and restart, requiring a hard reset. I think the only resolution we're really going to see from this is if the kernel devs patch the wifi drivers.

Threads about the problem

https://bugs.launchpad.net/ubuntu/+source/broadcom-sta/+bug/1765036
https://bbs.archlinux.org/viewtopic.php?id=242382
https://bugzilla.kernel.org/show_bug.cgi?id=201853
https://bugs.archlinux.org/task/60832

[Unit]
Description=Enable wifi after sleep so it doesn't freak out
After=suspend.target
[Service]
ExecStart=/usr/bin/modprobe brcmfmac
[Install]
WantedBy=suspend.target
[Unit]
Description=Disable wifi before sleep so it doesn't freak out
Before=suspend.target
[Service]
ExecStart=/usr/bin/rmmod brcmfmac
[Install]
WantedBy=suspend.target
@pmdevita
Copy link
Author

My solution to this problem was to uninstall Manjaro and install Arch (specifically EndeavourOS). You still need a service to disable before shutdown to not freak out Windows and Mac but it works completely fine otherwise.

@pmdevita
Copy link
Author

Nevermind, Arch itself may not be free from the problem. MIght have to do with power management of the wifi card

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment