Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boot setup the codec during resume to fix s3 sleep mode #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ydzhou
Copy link

@ydzhou ydzhou commented May 13, 2023

Re-setup the whole codec to fix s3 sleep mode

@meichthys
Copy link

Does this seem to work? Everything i've read indicates that resuming from sleep won't work.

@ydzhou
Copy link
Author

ydzhou commented Jun 23, 2023

Does this seem to work? Everything i've read indicates that resuming from sleep won't work.

It is working on my iMac like a month now on a daily basis.

Why do you think it wont work?

@meichthys
Copy link

I just wasn't sure since the PR had not been merged. I also saw that hibernation works for you (#87 (comment)), but it does not work for me, so this fish may be limited to a specific model(s) of MBPs(?)

Im running a 13,3

@ydzhou
Copy link
Author

ydzhou commented Jun 28, 2023

I just wasn't sure since the PR had not been merged. I also saw that hibernation works for you (#87 (comment)), but it does not work for me, so this fish may be limited to a specific model(s) of MBPs(?)

Im running a 13,3

Yeah, if hibernation is not working for you, then you are most likely in a different problem than mine. The idea of this PR is really straightforward. It just reboot the whole codec module as if your Mac has been restarted or woke up from hibernation. Mine is an iMac, which behaves more like a desktop PC. I suspect for Macbook, it would be more tricky to make sleep work because when restarting the Macbook, it is still powered on by battery and maybe memory or kernel modules are not reset. It is very hard to tell what's going.

If you are interested to solve the sleep problem. Please feel free to open a new issue and post your kernel log there. I can help take a look.

Also another way is to set your sleep mode to be s2idle. That is a software-level sleep. The problem of davidjo's codec module is that we do not know a proper way to power on the codec device from sleep. So setting s2idle will keep the codec device always not powered off. It works for me and I think it should also work for you.

The downside is that some thunderbolt module may act oddly and s2idle is just idling your hardware, your battery will drain much more than regular sleep.

@meichthys
Copy link

Thanks for now i'll deal with no sleep, but i'm curious about the s2idle option. Where would i set that to test it?

@davidjo
Copy link
Owner

davidjo commented Jun 28, 2023

The reason I have not merged this yet is because Id like to see what other issues this might raise - if it does work on other machines - based on the above maybe it should be made imac specific.

@BrianValente
Copy link

After attempting this fix, I noticed that after several suspends and resumes, the speakers began to sound muffled, even affecting macOS and the boot chime. This issue appears to be linked to this thread in the Apple forums. I'm uncertain whether it's reversible.

I can't recall if the bug originated from the @ydzhou branch, or if it occurred when I cherry-picked their change into the master branch, as I tried both approaches.

Here are two videos demonstrating the issue, one on Linux and the other on macOS. The symptoms sound different in each case.

IMG_7077.MOV
video_2024-03-01_03-33-09.mp4

Using QjackCtl, I found out that if I set the audio configuration to 4.0 and I use the "rear" speakers, it doesn't glitch, the problem seems to be in the "front" speakers.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants