Bug 204477 - Scratchy, thin and static audio output on MacBook Pro 7.1
Summary: Scratchy, thin and static audio output on MacBook Pro 7.1
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: Intel Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-04 20:29 UTC by Peter
Modified: 2020-03-16 18:53 UTC (History)
10 users (show)

See Also:
Kernel Version: 5.2
Tree: Mainline
Regression: No


Attachments
comparison of alsa-info.sh for 4.19 & 5.2 kernel (72.39 KB, text/plain)
2019-08-04 20:29 UTC, Peter
Details
Test fix patch (2.81 KB, patch)
2019-11-26 08:41 UTC, Takashi Iwai
Details | Diff
alsa-info.txt (35.33 KB, text/plain)
2019-11-27 01:09 UTC, Michael Pobega
Details
Revised fix patch (3.62 KB, patch)
2019-11-27 08:54 UTC, Takashi Iwai
Details | Diff
Additional test fix (1.07 KB, patch)
2019-12-14 15:51 UTC, Takashi Iwai
Details | Diff
alsa-info.sh output (54.91 KB, text/plain)
2019-12-14 16:36 UTC, nvertigo
Details
alsa-info.sh output (52.27 KB, text/plain)
2019-12-14 16:50 UTC, Manuel Lauss
Details

Description Peter 2019-08-04 20:29:42 UTC
Created attachment 284173 [details]
comparison of alsa-info.sh for 4.19 & 5.2 kernel

When running manjaro / xfce on a macbook pro 7.1 (13", mid 2010) on kernel 5.x series, I experience scratchy and thin audio output with loads of static.
I have experienced this on both kernel 5.1 and 5.2.
Switching back to kernel 4.19 this symptom vanishes. 

I have found others reporting this issue, too: https://bbs.archlinux.org/viewtopic.php?id=246826

I have compared the outputs from alsa-info.sh and found only some differences on the section !!All Loaded Modules:
despite the order of the items, following differences:
- new in 5.2: ecc, ledtrig_audio
- missing in 5.2: fscrypto

For your reference, please find the output of the two runs attached as diff (-y)
Comment 1 Takashi Iwai 2019-08-12 10:12:18 UTC
Both ledtrig and fscrypto are likely irrelevant with such a problem.  The symptom sounds more like some power-saving stuff, but I don't see any obvious changes.

I'm afraid that git bisection is the way to go for now...
Comment 2 Thomas Scheller 2019-09-20 09:13:22 UTC
I have the same issue on my MacBook Pro 7,1. For me it sounds like the sound is comming from the microphone instead of the speaker.

On "Front Right" I can't here anything.

On "Front Left" it is very overdriven, no bass.

I have tried several options as described here:

https://github.com/torvalds/linux/blob/master/Documentation/sound/hd-audio/models.rst

-> nothing changes


And also turning off powersave does not change anything

echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save

echo N | sudo tee /sys/module/snd_hda_intel/parameters/power_save_controller 


alsa-info output:
http://alsa-project.org/db/?f=09e1a411c2aa452f2d240b1c0439b4f6253ed767
Comment 3 Maximilian Claus 2019-10-04 14:26:28 UTC
I am new to linux and encountered the same issue while installing Arch on my MacBook 7,1. Sound is extremely scratchy and occasionally audio plays only on the left channel.

I tried narrowing it down by downgrading the kernel as much as possible:

linux 5.0.13.arch1-1   audio is fine

linux 5.1.arch1-1      audio is scratchy

Maybe somebody with the same problem can confirm this?
Comment 4 Jae Hak Kim 2019-10-23 15:01:31 UTC
Having the same issue on my MacBook Air running 5.2.0-kali3-amd64

root@kashyyyk:~# lspci | grep Audio
00:08.0 Audio device: NVIDIA Corporation MCP89 High Definition Audio (rev a2)
root@kashyyyk:~# 

I cannot switch back to 4.19 due to nouveau issues with GeForce 320M causing Xorg to crash:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898102
Comment 5 Nicklas Nylund 2019-11-11 13:29:19 UTC
I'm having the same problem with distorted sound on a Mac Mini4.1 (late 2010) on kernel 5.3.8-3 (Manjaro).
Switched back to 4.19.81-1 and the problem was gone. However, I have issues with the nouveau driver in 4.19 forcing me to install the proprietary nvidia driver.
Comment 6 Michael Pobega 2019-11-25 23:27:08 UTC
Hi Takashi,

I did a bisect on the Macbook 7,1 we have here and I was able to trace it to 9b6f7e7a296e17990aae298c809b001e99ddd151 ("ALSA: hda: program stripe bits for controller").

With this commit reverted audio plays without any static.

I can provide any additional information you need to get this looked at.
Comment 7 Takashi Iwai 2019-11-26 08:40:35 UTC
Thanks, this is a great finding!

Could you upload the alsa-info.sh output on your machine to Bugzilla?
Please run the script with --no-upload option and attach the output.

I guess the patch like below should work, but it's a blind shot for now.
Comment 8 Takashi Iwai 2019-11-26 08:41:05 UTC
Created attachment 286061 [details]
Test fix patch
Comment 9 Michael Pobega 2019-11-27 01:09:05 UTC
Created attachment 286075 [details]
alsa-info.txt

That patch seems to resolve the issue, sound is MUCH better with that applied.

I've attached the alsa-info to the ticket (from before applying your patch), let me know if there's anything else you need from me.

Note that I will not have access to the machine over the US Holiday weekend
Comment 10 Takashi Iwai 2019-11-27 08:54:34 UTC
Thanks!  The problem is seen on your machine likely because it's a single Nvidia HD-audio controller for both the onboard analog and HDMI.

In anyway, there was one typo in the previous patch.  Although it should be harmless, could you retest with the revised patch below?  It has a proper patch description.  If you prefer, I can add you to Tested-by tag in the patch; please give the line to add in this report.
Comment 11 Takashi Iwai 2019-11-27 08:54:59 UTC
Created attachment 286085 [details]
Revised fix patch
Comment 12 Michael Pobega 2019-12-02 22:01:01 UTC
Hi Takashi,

I retested and the revised patch works fine. And feel free to add me to the Tested-by, the line should be the same as Signed-off-by for patches I've submitted in the past:

Tested-by: Michael Pobega <mpobega@neverware.com>
Comment 13 Takashi Iwai 2019-12-03 06:49:12 UTC
Thanks, the patch was merged now, will be included in 5.5-rc1 in this week, and backported to stable tree later.
Comment 14 Manuel Lauss 2019-12-14 12:19:38 UTC
Commit e38e486d66e2a3b902768fd71c32dbf10f77e1cb  ("ALSA: hda: Modify stream stripe mask only when needed") hit stable 5.4.3, and this now causes scratchy audio over HDMI (nvidia codec).  Reverting this one commit on 5.4.3 fixes it.
Comment 15 Takashi Iwai 2019-12-14 15:50:57 UTC
(In reply to Manuel Lauss from comment #14)
> Commit e38e486d66e2a3b902768fd71c32dbf10f77e1cb  ("ALSA: hda: Modify stream
> stripe mask only when needed") hit stable 5.4.3, and this now causes
> scratchy audio over HDMI (nvidia codec).  Reverting this one commit on 5.4.3
> fixes it.

Which codec?  Please give the alsa-info.sh output.

Also, could you try the patch below?
Comment 16 Takashi Iwai 2019-12-14 15:51:29 UTC
Created attachment 286287 [details]
Additional test fix
Comment 17 nvertigo 2019-12-14 16:34:25 UTC
Hit the same garbled sound as Manuel with linux-5.4.3, gts450 and nvidia proprietary driver 390.132. Takashi's proposed fix is working for my setup.
Comment 18 nvertigo 2019-12-14 16:36:07 UTC
Created attachment 286289 [details]
alsa-info.sh output
Comment 19 Manuel Lauss 2019-12-14 16:50:14 UTC
Your test patch fixes the issue on 5.4.3.
Comment 20 Manuel Lauss 2019-12-14 16:50:55 UTC
Created attachment 286291 [details]
alsa-info.sh output
Comment 21 Takashi Iwai 2019-12-14 17:57:29 UTC
Thanks, the fix patch is now merged to sound git tree, and will be included in the next pull request to 5.5-rc3 (and eventually to stable trees, too).
Comment 22 nvertigo 2019-12-14 18:54:38 UTC
(In reply to Takashi Iwai from comment #21)
> Thanks, the fix patch is now merged to sound git tree, and will be included
> in the next pull request to 5.5-rc3 (and eventually to stable trees, too).

This should be tested on more platforms before merging to avoid breakimg something else, while fixing this - as the original commit should have been tested on platforms formerly working. Just my oppinion, of course.
Comment 23 Peter 2019-12-30 16:55:57 UTC
Today I have updated Manjaro which contained a kernel update to 5.4.6-2 and thus your patch. I can confirm this is working fine. Thank you very much for your work!
Comment 24 Brunno Vert 2020-03-16 18:53:46 UTC
(In reply to Takashi Iwai from comment #11)
> Created attachment 286085 [details]
> Revised fix patch

Hey, i have the same issue!
How can i do use this path? 
Iḿ using manjaro kernel 5.4 Thanks!!

Note You need to log in before you can comment on or make changes to this bug.