mbp-fedora icon indicating copy to clipboard operation
mbp-fedora copied to clipboard

Anyway to get sleep/suspend working?

Open lonniemmercer opened this issue 5 years ago • 17 comments

lonniemmercer avatar Jul 13 '20 04:07 lonniemmercer

My build has already been using this fix, but maybe something has gone wrong in your installation so please follow this article: https://wiki.t2linux.org/guides/dkms/#fixing-suspend

Nevertheless even with a fix, suspend sometimes works, sometimes not.

mikeeq avatar Jun 23 '21 14:06 mikeeq

@mikeeq see my fix at https://github.com/mikeeq/mbp-fedora-kernel/issues/14#issuecomment-874778928

I assume it's already working for people without a touchbar, but for me I need to unload hid_apple as well to make the keyboard working again on resume.

folke avatar Jul 06 '21 13:07 folke

Let's check if it's finally working or not.

mikeeq avatar Aug 26 '21 08:08 mikeeq

The script is fine. It's the touchbar module which is buggy and hangs the system when modprobe -r is run.

AdityaGarg8 avatar Aug 26 '21 08:08 AdityaGarg8

That seems to affect the keyboard

AdityaGarg8 avatar Aug 26 '21 08:08 AdityaGarg8

@AdityaGarg8 Is there a fix for this? I also have a keyboard with a touchbar and they both do not work after suspend. I am now having to restart my computer any time the lid closes. I would be willing to just disable my touchbar completely if that fixes something

justinpchang avatar Sep 03 '21 19:09 justinpchang

@justinpchang , remove the ibridge drivers for suspend.

AdityaGarg8 avatar Sep 04 '21 03:09 AdityaGarg8

@AdityaGarg8 I unloaded apple_ibridge driver and the other touch bar ones that use it with mod probe -r and I still get the same behavior on suspend. Is this not the correct way to remove them?

justinpchang avatar Sep 04 '21 14:09 justinpchang

@justinpchang , run

sudo dkms uninstall -m apple-ibridge -v 0.1
sudo rm -r /usr/src/apple-ibridge-0.1
sudo rm -r /var/lib/dkms/apple-ibridge
sudo rm /lib/systemd/system-sleep/rmmod_tb.sh

This will remove the driver completely alongwith the touch bar unloading script, since it won't be required now.

Restart after running the commands.

AdityaGarg8 avatar Sep 04 '21 15:09 AdityaGarg8

@AdityaGarg8 Thanks! For future people with the same issue, I think my system is set up differently so I had to find the apple-ibridge and apple-ib-tb driver locations with modinfo, then removed them and the script. Then I had to run dracut -f and after reboot, suspend works.

justinpchang avatar Sep 04 '21 20:09 justinpchang

Hi, With a fresh install (F37 from here) on a MBP 13 2019 any pointer how to get suspend working? Tried it with Ubuntu, and suspend was working fine with that (https://github.com/AdityaGarg8/T2-Ubuntu/releases/tag/v6.0.7-1) The system suspends properly - based on logs, but I cannot wake it up. Not with keyboard, power button, lid, external input. Only solution is to keep the power button pressed to power cycle the machine. Thanks!

szilardx avatar Nov 15 '22 18:11 szilardx

Hi, With a fresh install (F37 from here) on a MBP 13 2019 any pointer how to get suspend working? Tried it with Ubuntu, and suspend was working fine with that (https://github.com/AdityaGarg8/T2-Ubuntu/releases/tag/v6.0.7-1) The system suspends properly - based on logs, but I cannot wake it up. Not with keyboard, power button, lid, external input. Only solution is to keep the power button pressed to power cycle the machine. Thanks!

same behavior with mbp 15 2019 + F37

lsimonis avatar Jan 04 '23 23:01 lsimonis

MacBookPro16,1 / Fedora 37 / 6.2.13-300.mbp.fc38,x86_64 lsmod output here - https://pastebin.com/SXZfnNQM dmesg -T output here - https://pastebin.com/qAGmADpi

Suspend/resume issue - takes long time for the system to come back on wake and keyboard/touchpad not working.

vassil-one avatar May 07 '23 03:05 vassil-one

I would be really happy if it was possible to get this working. It's sort of essential for a laptop to go to sleep.

I've just installed the latest version, 38, and it still seems broken.

I switched from T2-Ubuntu, and like other user have reported here, over there, it is working.

I'm happy to help and provide logs :).

Elias-Graf avatar Jun 19 '23 18:06 Elias-Graf

Hi! I believe it is the brcmfmac module. I read your dmesg logs and I have a similar problem.

After runing systemctl suspend, my screen goes blank for a second and then comes back up for a second, then again goes black and then comes back up again...

What worked for me is i ran this: modprobe -r brcmfmac_wcc brcmfmac and then i did the systemctl suspend

This worked. But obviously there must be a better way to do it or automate it. For some reason, when I suspend, the systemd just skips the rmmod.sh in /lib/systemd/system-sleep/rmmod.sh Will try a systemctl approach and let you know soon.

rydymth avatar Aug 09 '23 03:08 rydymth

Hello there! Sorry for late reply... Well I got the suspend working... The resume takes like around 5-7 secs AFTER the screen lights up. What i did was the same as i have commented above. I just put it in the right folder this time which is: /usr/lib/systemd/system-sleep/rmmod.sh Inside this folder i have the pre and post config as follows :

#!/bin/bash
[ "$1" = "post" ] && exec bash /usr/local/sbin/post.sh
[ "$1" = "pre" ] && exec bash /usr/local/sbin/pre.sh
exit 0

The pre.sh contains:

#!/bin/bash
systemctl stop NetworkManager.service
modprobe -r brcmfmac_wcc
modprobe -r brcmfmac

The post.sh contains :

modprobe brcmfmac_wcc
modprobe brcmfmac
systemctl start NetworkManager.service
bash /usr/local/sbin/power.sh

And finally the power.sh contains:

sudo modprobe msr
sudo rdmsr 0x1FC
sudo wrmsr 0x1FC value

The above script, tho might be incorrect or not well optimised, just increases the frequency mac runs at. Following the guide on this github page which was there on the t2linux website. Also a similar solution was already given at the t2linux-fedora-kernel. But Ive have got 2 other problems... My trackpad and keyboard dont work sometimes and bluetooth is buggy.(Sometimes it works sometimes it doesnt)... So ill try to see what and where the issue is. But Im unable to figure what module is responsible for the apple's keyboard and trackpad. Will update soon.... Edit after 5 hours of posting the above: Everything works just fine... I believe this is a good solution that works.

rydymth avatar Aug 13 '23 11:08 rydymth

Hello there! Sorry for late reply... Well I got the suspend working... The resume takes like around 5-7 secs AFTER the screen lights up. What i did was the same as i have commented above. I just put it in the right folder this time which is: /usr/lib/systemd/system-sleep/rmmod.sh Inside this folder i have the pre and post config as follows :

#!/bin/bash
[ "$1" = "post" ] && exec bash /usr/local/sbin/post.sh
[ "$1" = "pre" ] && exec bash /usr/local/sbin/pre.sh
exit 0

The pre.sh contains:

#!/bin/bash
systemctl stop NetworkManager.service
modprobe -r brcmfmac_wcc
modprobe -r brcmfmac

The post.sh contains :

modprobe brcmfmac_wcc
modprobe brcmfmac
systemctl start NetworkManager.service
bash /usr/local/sbin/power.sh

And finally the power.sh contains:

sudo modprobe msr
sudo rdmsr 0x1FC
sudo wrmsr 0x1FC value

The above script, tho might be incorrect or not well optimised, just increases the frequency mac runs at. Following the guide on this github page which was there on the t2linux website. Also a similar solution was already given at the t2linux-fedora-kernel. But Ive have got 2 other problems... My trackpad and keyboard dont work sometimes and bluetooth is buggy.(Sometimes it works sometimes it doesnt)... So ill try to see what and where the issue is. But Im unable to figure what module is responsible for the apple's keyboard and trackpad. Will update soon.... Edit after 5 hours of posting the above: Everything works just fine... I believe this is a good solution that works.

Thanks, that worked.

I've combined all your scripts into one :

#!/usr/bin/env bash
if [ "${1}" = "pre" ]; then
        systemctl stop NetworkManager
        modprobe -r brcmfmac_wcc brcmfmac
elif [ "${1}" = "post" ]; then
        modprobe brcmfmac_wcc brcmfmac
        systemctl start NetworkManager
        modprobe -r apple-bce & modprobe apple-bce

        modprobe msr
        rdmsr 0x1FC
        wrmsr 0x1FC value
fi

For the keyboard and trackpad, I had to add this line to the post actions:

modprobe -r apple-bce & modprobe apple-bce

06Games avatar Sep 01 '23 12:09 06Games