1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 03:19:42 +01:00

gigabyte b550: suspend fix (#884)

fixes b550 suspend bug by setting up systemd services that disable GPP0 and GPP8 in /proc/acpi/wakeup

Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
Nire Bryce 2024-03-25 07:40:22 +00:00 committed by GitHub
parent 7559df1e4a
commit 474549f841
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 88 additions and 0 deletions

View file

@ -145,6 +145,7 @@ See code for all available configurations.
| [FriendlyARM NanoPC-T4](friendlyarm/nanopc-t4) | `<nixos-hardware/friendlyarm/nanopc-t4>` |
| [FriendlyARM NanoPi R5s](friendlyarm/nanopi-r5s) | `<nixos-hardware/friendlyarm/nanopi-r5s>` |
| [Focus M2 Gen 1](focus/m2/gen1) | `<nixos-hardware/focus/m2/gen1>` |
| [Gigabyte B550](gigabyte/b550) | `<nixos-hardware/gigabyte/b550>`
| [GPD MicroPC](gpd/micropc) | `<nixos-hardware/gpd/micropc>` |
| [GPD P2 Max](gpd/p2-max) | `<nixos-hardware/gpd/p2-max>` |
| [GPD Pocket 3](gpd/pocket-3) | `<nixos-hardware/gpd/pocket-3>` |

47
gigabyte/b550/README.md Normal file
View file

@ -0,0 +1,47 @@
# B550 suspend bug
Gigabyte B550-family motherboards have a hard to diagnose (At least, from the system log events) suspend bug.
As of the F18 bios for the b550m-d3sh (My machine), released in 2024-02-27, this is still unfixed by the manufacurer and has been for over 4 years.
Symptoms:
- Suspend PC
- It goes into suspend, then seems to boot and hang. Sometimes it suspends successfully, but waking it from suspend puts it in the "zombie" state.
- By playing chicken with volatile storage and flicking the power switch on the back of power supply, you can sometimes get it to wake from suspend as the card un-powers before volatile storage does.
Fix: disable GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup
- To do this permanently, a systemd service is provided
## This affects at least:
- Gigabyte b550m-d3sh (my machine)
- Gigabyte B550i AORUS Pro Ax https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
- Gigabyte B550 Vision D https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/
- Gigabyte B550 Aorus Pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ijsx8ia/
- Gigabyte B550 Aorus Pro AC https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j6cbnwq/
- Gigabyte B550 Aorus Pro v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/imx7sz0/
- B550 Aorus Pro may need GPP0 and PTXH instead of GPP8, I don't have hardware to test
- Gigabyte B550 Aurus Elite v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/k2psbgu/
- Gigabyte B550m pro https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/huocd81/
- Gigabyte B550m Aorus Elite https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hzngaa7/
- Gigabyte B550 Gaming X v2 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hvojl44/
- Gigabyte B550 Aorus Master v1.0 https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/j1alpxk/
### Anecdotes of other boards:
- Gigabyte A520M https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/i57jpjw/
## Shoutouts:
- thanks to [/u/dustythermals's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/hb32elw/) for the systemd service blueprint
- thanks to help from [@ToxicFrog](https://github.com/ToxicFrog) for advice on making it not toggle when `nixos-rebuild switch` is ran
- thanks to [/u/Demotay's reddit comment](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/) for how to make it check and only fire if these are enabled
- Huge thanks to /u/theHugePotato who found the [root cause](https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/h9plj88/) and put it where everyone could find
## Breadcrumbs:
https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
https://www.reddit.com/r/archlinux/comments/11urtla/systemctl_suspend_hibernate_and_hybridsleep_all/
https://forum.manjaro.org/t/system-do-not-wake-up-after-suspend/76681/2

View file

@ -0,0 +1,35 @@
{ pkgs, lib, ... } :
{
systemd.services.bugfixSuspend-GPP0 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root"; # root may not be necessary
# check for gppN, disable if enabled
# lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'";
RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran
};
wantedBy = ["multi-user.target"];
};
systemd.services.bugfixSuspend-GPP8 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root";
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi''";
RemainAfterExit = "yes";
};
wantedBy = ["multi-user.target"];
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./b550-fix-suspend.nix
];
}