Bug 16339

Summary: ALC889 SPDIF intermittently working
Product: Drivers Reporter: Daniel J Blueman (daniel.blueman)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Severity: normal CC: alan, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35-rc3 Tree: Mainline
Regression: No
Attachments: Output from 'alsa-info.sh' when SPDIF is working as expected
Output from 'alsa-info.sh' when SPDIF is not working as expected
Fix patch

Description Daniel J Blueman 2010-07-04 17:23:17 UTC
When booting 2.6.35-rc3 with HDA power save enabled, we see the optical SPDIF output intermittently working.

Disabling power saving in the kernel config makes it consistently work as expected.

Differences from the 'alsa-info.sh' script in both non-working and working cases show 'Pin-ctls: 0x40 OUT' in the working case, and 'Pin-ctls: 0x00' in the non-working case with the SPDIF pin complex node:

Node 0x1e [Pin Complex] wcaps 0x400300: Mono Digital
  Pincap 0x00000010: OUT
  Pin Default 0x01452120: [Jack] SPDIF Out at Ext Rear
    Conn = Optical, Color = Grey
    DefAssociation = 0x2, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Connection: 1

Other times, when the SPDIF output is enabled and the power saving mode kicks in, it will be disabled, but not reenabled.
Comment 1 Daniel J Blueman 2010-07-04 17:41:14 UTC
Created attachment 27013 [details]
Output from 'alsa-info.sh' when SPDIF is working as expected
Comment 2 Daniel J Blueman 2010-07-04 17:41:41 UTC
Created attachment 27014 [details]
Output from 'alsa-info.sh' when SPDIF is not working as expected
Comment 3 Daniel J Blueman 2010-07-04 18:52:29 UTC
Looking at patch_realtek.c, it looks like there is nothing to enable the SPDIF pin complex in the verb array at alc880_pin_5stack_init_verbs, which would explain the non-deterministic state when the chip is brought out of sleep/power-down state.

We need:

Comment 4 Takashi Iwai 2010-07-05 14:53:59 UTC
OK, that's a problem indeed.
Could you try the patch below?  It'll restore the cleared pin controls.
Comment 5 Takashi Iwai 2010-07-05 15:03:57 UTC
Created attachment 27024 [details]
Fix patch
Comment 6 Takashi Iwai 2010-07-08 14:54:49 UTC
Comment 7 Daniel J Blueman 2010-07-08 15:05:29 UTC
Ack. Just saw the mail and preparing to test your patch. Thanks, Takashi!
Comment 8 Daniel J Blueman 2010-07-08 22:16:57 UTC
Excellent - this addresses the bug, Takashi-san. I cross-checked both failing and non-failing cases with the patch a number of times, and it looks good for -rc5. Many thanks!

This has potential to address quite a lot of HDA power_save regressions people experience with this feature enabled, which I think has kept this good feature disabled in distros.

If you feel this will address a significant number of these cases, is it worth general heads-up LKML and eg kernel-team@lists.ubuntu.com for their evaluation?

Thanks again, Daniel
Comment 9 Daniel J Blueman 2010-07-08 22:23:29 UTC
late-night typos fixed:

If you feel this will address a significant number of these cases, is it worth a general heads-up on LKML and a quick post to eg kernel-team@lists.ubuntu.com for their evaluation?
Comment 10 Takashi Iwai 2010-07-09 06:59:39 UTC
Is power_save disabled on distros due to this bug?  I've never heard it, and if so, it's really a communication problem...

There are potential problems hit by this bug, but I think most people didn't notice, because it's mostly unused SPDIF or such pins.  Of course, more tests are welcome, though.

Anyway, I merged it now and it'll be included in the next pull request.