leifliddy / macbook12-audio-driver

WIP audio driver for the cs4208 codec found in the 12" MacBook (MacBook9,1, MacBook10,1).
84 stars 9 forks source link

no sound after sleep/resume (KDE) #18

Open Madman600 opened 2 years ago

Madman600 commented 2 years ago

Sound works until I sleep and resume the macbook (April 2016 12" - Version 9,1)

leifliddy commented 2 years ago

Suspend and resume is working for you with the internal nvme ssd?

Madman600 commented 2 years ago

Yes.

On Mon, Jun 27, 2022 at 5:43 PM Leif Liddy @.***> wrote:

Suspend and resume is working for you with the internal nvme ssd?

— Reply to this email directly, view it on GitHub https://github.com/leifliddy/macbook12-audio-driver/issues/18#issuecomment-1168000757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJHXEFOV7OBVBD2QBTNIFFLVRIVCFANCNFSM5YSWNARA . You are receiving this because you authored the thread.Message ID: @.***>

leifliddy commented 2 years ago

Really!? AFAIK, this issue has never been solved. REF: https://github.com/Dunedan/mbp-2016-linux/issues/133 https://github.com/cb22/macbook12-spi-driver/pull/2 https://github.com/cb22/macbook12-spi-driver/pull/30

Can you please provide the details on how you managed to get suspend/resume working while booted to the nvme drive? How are you suspending and resuming the laptop (via the gui, closing the lid, pressing the power button, command line...etc) Are you using grub to boot the system?

Can you please post the output of the following commands?

cat /sys/class/dmi/id/product_name
cat /sys/class/dmi/id/bios_version
uname -a
grep PRETTY_NAME /etc/os-release
lsblk
leifliddy commented 2 years ago

I'm running kernel 5.18.9 and if I suspend via systemctl suspend and then resume the system -- the filesystems on the nvme drive become read-only and can no longer be written to. This is the same issue we were running into before. As far as I can tell, nothing has changed.

Madman600 commented 2 years ago

I'm booting using efi.

MacBook10,1 447.80.3.0.0 Linux frank 5.18.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 09 Jun 2022 16:14:10 +0000 x86_64 GNU/Linux PRETTY_NAME="Arch Linux" NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS nvme0n1 259:0 0 465.9G 0 disk ├─nvme0n1p1 259:1 0 300M 0 part /boot └─nvme0n1p2 259:2 0 465.6G 0 part / nvme0n2 259:3 0 8K 0 disk

leifliddy commented 2 years ago

So you actually have a MacBook10,1 which is the 2017 model. That shouldn't make a difference though. >I'm booting using efi. Can you be more specific? If you run blkid /dev/nvme0n1p1 what is value of TYPE? Are you using systemd-boot as the bootloader?

Madman600 commented 2 years ago

*resume

On Tue, Jul 5, 2022, 6:47 AM Adam E @.***> wrote:

I used efibootmgr to add UEFI entry to boot directly. I used this fix to get result working: https://github.com/Dunedan/mbp-2016-linux/issues/37.

On Tue, Jul 5, 2022, 3:27 AM Leif Liddy @.***> wrote:

So you actually have a MacBook10,1 which is the 2017 model. That shouldn't make a difference though.

I'm booting using efi. Can you be more specific? If you run blkid /dev/nvme0n1p1 what is value of TYPE? Are you using systemd-boot as the bootloader?

— Reply to this email directly, view it on GitHub https://github.com/leifliddy/macbook12-audio-driver/issues/18#issuecomment-1174769428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJHXEFN7ZNELRFNDWRNVKCTVSPWWDANCNFSM5YSWNARA . You are receiving this because you authored the thread.Message ID: @.***>

Madman600 commented 2 years ago

https://github.com/Dunedan/mbp-2016-linux/issues/37#issuecomment-540202102

On Tue, Jul 5, 2022, 6:47 AM Adam E @.***> wrote:

I used efibootmgr to add UEFI entry to boot directly. I used this fix to get result working: https://github.com/Dunedan/mbp-2016-linux/issues/37.

On Tue, Jul 5, 2022, 3:27 AM Leif Liddy @.***> wrote:

So you actually have a MacBook10,1 which is the 2017 model. That shouldn't make a difference though.

I'm booting using efi. Can you be more specific? If you run blkid /dev/nvme0n1p1 what is value of TYPE? Are you using systemd-boot as the bootloader?

— Reply to this email directly, view it on GitHub https://github.com/leifliddy/macbook12-audio-driver/issues/18#issuecomment-1174769428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJHXEFN7ZNELRFNDWRNVKCTVSPWWDANCNFSM5YSWNARA . You are receiving this because you authored the thread.Message ID: @.***>

leifliddy commented 2 years ago

I've tried that method before. It doesn't work on the Macbook9,1

DumbGameMaker commented 2 years ago

tried adding acpiphp.disable=1 to grub?

leifliddy commented 2 years ago

It's been years since I last revisited this topic. So acpiphp.disable=1 doesn't work, but this does

echo 0 > /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/nvme/nvme0/device/d3cold_allowed

That's pretty cool. So it looks like the audio does not work after resuming from suspend. Unfortunately, it's been ages since I've worked on this driver and I simply don't have the desire to develop it any further at the moment.

ronnygroenhaug commented 2 years ago

Hello there, I am not an experienced Linux user, but have managed to get this far on my Early 2016 MacBook - Ubuntu 22.04 installed and (thanks to this github page) I also have sound now, THANK YOU!! I have been looking and trying all sort of things, but this is the one that works for me. As I understand from your comment above, you will no longer work on this project. As the inexperienced user that I am, what does the echo-command do, and what do you mean by that "its working" ? Can I have this command run on startup, and have sound? As of now I head into Terminal and run your magic commands+reboot when I need sound (as it dissapears after sleep and reboot). Sorry for my poor knowledge.

DumbGameMaker commented 2 years ago

The echo command fixes sleep/wake nvme locking by (i think) disabling something in the controller (maybe like a sleep mode?)Sleep mode still will break audio. After a restart audio should work again though.Sent from my iPhoneOn Jul 25, 2022, at 4:19 PM, ronnygroenhaug @.***> wrote: Hello there, I am not an experienced Linux user, but have managed to get this far on my Early 2016 MacBook - Ubuntu 22.04 installed and (thanks to this github page) I also have sound now, THANK YOU!! I have been looking and trying all sort of things, but this is the one that works for me. As I understand from your comment above, you will no longer work on this project. As the inexperienced user that I am, what does the echo-command do, and what do you mean by that "its working" ? Can I have this command run on startup, and have sound? As of now I head into Terminal and run your magic commands+reboot when I need sound (as it dissapears after sleep and reboot). Sorry for my poor knowledge.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

DumbGameMaker commented 2 years ago

Also you should not have to run the command before a reboot for sound to workSent from my iPhoneOn Jul 25, 2022, at 5:34 PM, Opal B @.> wrote:The echo command fixes sleep/wake nvme locking by (i think) disabling something in the controller (maybe like a sleep mode?)Sleep mode still will break audio. After a restart audio should work again though.Sent from my iPhoneOn Jul 25, 2022, at 4:19 PM, ronnygroenhaug @.> wrote: Hello there, I am not an experienced Linux user, but have managed to get this far on my Early 2016 MacBook - Ubuntu 22.04 installed and (thanks to this github page) I also have sound now, THANK YOU!! I have been looking and trying all sort of things, but this is the one that works for me. As I understand from your comment above, you will no longer work on this project. As the inexperienced user that I am, what does the echo-command do, and what do you mean by that "its working" ? Can I have this command run on startup, and have sound? As of now I head into Terminal and run your magic commands+reboot when I need sound (as it dissapears after sleep and reboot). Sorry for my poor knowledge.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

leifliddy commented 2 years ago

>As I understand from your comment above, you will no longer work on this project. I'm not a kernel developer and had a ton of help writing this driver. I did spend several hours attempting to get resume/suspend working. It's just a really difficult problem (for me anyway), even just reloading the snd_hda_codec_cirrus module causes it to stop working.

>what does the echo-command do So that echo command prevents the internal nvme drive from going into a low-powered state. Which is the state it normally goes into when suspending a system. So when you run that echo command and then suspend the system, the nvme drive will remain powered on. If I don't run that echo command and try to suspend my 2016 macbook, the nvme drive does not come back online and I have to power cycle the system.

Several MBP models also have this issue: https://github.com/Dunedan/mbp-2016-linux#suspend--hibernation

>As of now I head into Terminal and run your magic commands+reboot when I need sound (as it dissapears after sleep and reboot).

So when you run those command, it's simply create a new sound module here: /lib/modules/$(uname -r)/updates/snd-hda-codec-cirrus.ko

when you suspend and resume the system, yes the sound will no longer work. But simply rebooting the system shouldn't affect anything. Try powering down the system and powering it back on (as opposed to just rebooting it) and see if that works.

Also anytime you update your kernel, you'll need to run run those magic commands again (on the next reboot) -- as that module needs to be built for every new kernel that's installed.

x5444 commented 1 year ago

Suspend-to-RAM breaks audio on my 2017 MacBook 10,1 the same way as reported.

However, I found that Suspend-to-Idle keeps the driver functional! I don't yet know what exactly that means for power consumption but to me it's a better solution than having to reboot on every lid-open. Overall I'm happy with this. I hope this isn't stating the obvious for you all.

Practically, that means replacing the systemd-suspend.service with a call to something like echo freeze > /sys/power/state, since sadly systemd-logind doesn't seem to support Suspend-to-Idle as a target by itself.

I also noticed some weird behavior when closing the lid while audio is playing but I can work around that. Finally, you still seem to need the NVMe fix (disabling it's sleep state) or it'll crash on resume from idle.

Information on the various sleep states can be found in the Kernel doc.

Madman600 commented 1 year ago

I used efibootmgr to add UEFI entry to boot directly. I used this fix to get result working: https://github.com/Dunedan/mbp-2016-linux/issues/37.

On Tue, Jul 5, 2022, 3:27 AM Leif Liddy @.***> wrote:

So you actually have a MacBook10,1 which is the 2017 model. That shouldn't make a difference though.

I'm booting using efi. Can you be more specific? If you run blkid /dev/nvme0n1p1 what is value of TYPE? Are you using systemd-boot as the bootloader?

— Reply to this email directly, view it on GitHub https://github.com/leifliddy/macbook12-audio-driver/issues/18#issuecomment-1174769428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJHXEFN7ZNELRFNDWRNVKCTVSPWWDANCNFSM5YSWNARA . You are receiving this because you authored the thread.Message ID: @.***>

Madman600 commented 1 year ago

Ok but how do I make the sound work on resume with your code?

On Tue, Jul 5, 2022, 6:57 AM Leif Liddy @.***> wrote:

I've tried that method before. It doesn't work on the Macbook9,1

— Reply to this email directly, view it on GitHub https://github.com/leifliddy/macbook12-audio-driver/issues/18#issuecomment-1174974766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJHXEFPKDTDJ6UPQASUJOEDVSQPKTANCNFSM5YSWNARA . You are receiving this because you authored the thread.Message ID: @.***>