mikeeq / mbp-fedora

326 stars 24 forks source link

Anyway to get sleep/suspend working? #23

Open lonniemmercer opened 4 years ago

mikeeq commented 3 years ago

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.

folke commented 3 years ago

@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.

mikeeq commented 3 years ago

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

AdityaGarg8 commented 3 years ago

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

AdityaGarg8 commented 3 years ago

That seems to affect the keyboard

justinpchang commented 3 years ago

@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

AdityaGarg8 commented 3 years ago

@justinpchang , remove the ibridge drivers for suspend.

justinpchang commented 3 years ago

@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?

AdityaGarg8 commented 3 years ago

@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.

justinpchang commented 3 years ago

@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.

szilardx commented 1 year ago

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!

lsimonis commented 1 year ago

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

vassil-one commented 1 year ago

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.

Elias-Graf commented 1 year ago

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 :).

rydymth commented 1 year ago

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 commented 1 year ago

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.

06Games commented 1 year ago

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