Bug 204727

Summary: No sound from speakers since kernel 5.1.4 on Positivo Mobile W98
Product: Drivers Reporter: xenobro (hcdorn)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: high CC: tiwai
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.1.4 Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info.txt, kernel 5.1.3
alsa-info.txt, kernel 5.1.4
lscpu
lshw
dmesg|grep snd
Test fix patch
Revised fix patch
alsa-info, 5.1.3, coef, unpatched, speakers work.
alsa-info, 5.1.3 127f4cbfbe5b, coef, unpatched, speakers work
alsa-info, 5.1.3 7d2e0a8c884f, coef, unpatched, no speakers
alsa-info, 5.1.4, coef, unpatched, no speakers
alsa-info, 5.2.11, coef, unpatched, no speakers
alsa-info, 5.1.3 7d2e0a8c884f, coef, 2nd patch, speakers work
alsa-info, 5.1.4, coef, 2nd patch, speakers work
alsa-info, 5.2.11, coef, 2nd patch, speakers work

Description xenobro 2019-08-29 00:09:32 UTC
Created attachment 284679 [details]
alsa-info.txt, kernel 5.1.3

The speakers on my ~10 year old Positivo Mobile W98, motherboard Clevo M520N, audio chipset Intel NM10/ICH7, have stopped working since kernel 5.1.4. All other channels work.
Git bisecting blames this commit:

(v5.1.3.r52)
"7d2e0a8c884f2d74ee6cca4b333a1628242b8a60 is the first bad commit
commit 7d2e0a8c884f2d74ee6cca4b333a1628242b8a60
Author: Kailang Yang <kailang@realtek.com>
Date:   Fri Apr 26 16:35:41 2019 +0800

    ALSA: hda/realtek - EAPD turn on later
    
    commit 607ca3bd220f4022e6f5356026b19dafc363863a upstream.
    
    Let EAPD turn on after set pin output.
    
    [ NOTE: This change is supposed to reduce the possible click noises at
      (runtime) PM resume.  The functionality should be same (i.e. the
      verbs are executed correctly) no matter which order is, so this
      should be safe to apply for all codecs -- tiwai ]
    
    Signed-off-by: Kailang Yang <kailang@realtek.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

 sound/pci/hda/patch_realtek.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)"
Comment 1 xenobro 2019-08-29 00:14:14 UTC
Steps to reproduce the issue:
1. Boot/Install any Linux with sound support and any kernel up to 5.1.3
2. speaker-test -c2 -twav (<-speakers work)
3. Boot/Install any Linux with sound support and any kernel since 5.1.4
4. speaker-test -c2 -twav (<-speakers don't work)

If any other info is needed, just tell me and I'll post it.
Thank you in advance, xenobro.
Comment 2 xenobro 2019-08-29 00:16:27 UTC
Created attachment 284681 [details]
alsa-info.txt, kernel 5.1.4
Comment 3 xenobro 2019-08-29 00:18:21 UTC
Created attachment 284683 [details]
lscpu
Comment 4 xenobro 2019-08-29 00:19:17 UTC
Created attachment 284685 [details]
lshw
Comment 5 xenobro 2019-08-29 00:21:04 UTC
Created attachment 284687 [details]
dmesg|grep snd
Comment 6 Takashi Iwai 2019-08-29 05:36:32 UTC
And reverting the commit 7d2e0a8c884f2 fixes the problem?
Comment 7 Takashi Iwai 2019-08-29 05:46:21 UTC
Also, could you enable COEF dump like
  echo 1 > /sys/module/snd_hda_codec/parameters/dump_coef

and get alsa-info.sh outputs on both kernels to compare the difference of COEF?
Comment 8 Takashi Iwai 2019-08-29 08:06:21 UTC
... and below is the potential fix patch.  Let me know if this works.
Comment 9 Takashi Iwai 2019-08-29 08:06:53 UTC
Created attachment 284689 [details]
Test fix patch
Comment 10 Takashi Iwai 2019-08-30 10:09:28 UTC
There are changes not only EAPD COEF but also BTLENABLE verb.  It's easier to simply move the verb calls instead of papering over all places.

The revised patch is below.  I've tested with hdaemu, and confirmed that it fixes for various devices.  I'm going to submit and merge to upstream at the next occasion.
Comment 11 Takashi Iwai 2019-08-30 10:09:53 UTC
Created attachment 284703 [details]
Revised fix patch
Comment 12 xenobro 2019-08-31 00:54:10 UTC
Thank you very much for your help, Mr. Iwai.
I've tested the previous patch with kernels 5.1.3 commit 7d2e0a8c884f (blamed by git bisect for the issue), 5.1.4 and 5.2.11 (the latest stable) and it worked perfectly, it solved the issue. I'll test the new one and report until Monday.
I ran alsa-info.sh with dump_coef enabled for each mentioned kernel with and without the previous patch, but since there's a new one, I'll upload the unpatched results now and the newly patched ones later.
Finally, downgrading the kernel to 5.1.3 commit  127f4cbfbe5b (the last unpatched version with working speakers) does solve the issue, though I'm not sure if "pacman -U" in Arch Linux is what you meant by reverting the commit.

Thank you once again and I'll report the results soon,
xenobro.
Comment 13 xenobro 2019-08-31 00:56:53 UTC
Created attachment 284711 [details]
alsa-info, 5.1.3, coef, unpatched, speakers work.
Comment 14 xenobro 2019-08-31 01:07:02 UTC
Created attachment 284713 [details]
alsa-info, 5.1.3 127f4cbfbe5b, coef, unpatched, speakers work
Comment 15 xenobro 2019-08-31 01:09:47 UTC
Created attachment 284715 [details]
alsa-info, 5.1.3 7d2e0a8c884f, coef, unpatched, no speakers
Comment 16 xenobro 2019-08-31 01:11:36 UTC
Created attachment 284717 [details]
alsa-info, 5.1.4, coef, unpatched, no speakers
Comment 17 xenobro 2019-08-31 01:14:26 UTC
Created attachment 284719 [details]
alsa-info, 5.2.11, coef, unpatched, no speakers
Comment 18 Takashi Iwai 2019-08-31 16:09:05 UTC
Good to hear, and thank you for testing.

The patch will be included in 5.3-rc7 in the next week, and will be backported to stable trees after that.
Comment 19 xenobro 2019-09-03 18:23:54 UTC
Mr. Iwai, I'm just here to upload the results of alsa-info.sh with dump_coef enabled for kernels 5.2.11 (latest stable), 5.1.4 (the 1st to have the issue) and 5.1.3 7d2e0a8c884f (blamed by git bisect) with the 2nd patch applied and speakers working again, as I said I'd do it.

Once again, thank you very much,
xenobro.
Comment 20 xenobro 2019-09-03 18:25:54 UTC
Created attachment 284799 [details]
alsa-info, 5.1.3 7d2e0a8c884f, coef, 2nd patch, speakers work
Comment 21 xenobro 2019-09-03 18:26:43 UTC
Created attachment 284801 [details]
alsa-info, 5.1.4, coef, 2nd patch, speakers work
Comment 22 xenobro 2019-09-03 18:27:38 UTC
Created attachment 284803 [details]
alsa-info, 5.2.11, coef, 2nd patch, speakers work