Bug 93881

Summary: HDMI sometimes muted at boot
Product: Drivers Reporter: guillaume-florianx.vidal
Component: Sound(ALSA)Assignee: Mengdong Lin (mengdong.lin)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: intel-gfx-bugs, jinliangx.wang
Priority: P2    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.0-rc1 Linux mainline Subsystem:
Regression: No Bisected commit-id:
Attachments: Logs from working and muted configuration
dmesg and audio info
04_17_15-4.0-logs
Patch to request power from Gfx for Baytrail HD-A controller
Pacth to only sync BCLK for Haswell and Broadwell
After_inactivity_OK-with2patches

Description guillaume-florianx.vidal 2015-02-26 11:04:40 UTC
Created attachment 168301 [details]
Logs from working and muted configuration

HDMI audio initialization seems uncomplete. HDMI playback is in progress but no sound goes out from the monitor although volume is correctly set.
$ speaker-test -D hw:PCH,3 -c 2 -t wav

Reproducing steps are unclear, but it is more likely to occur before first playback. Opening Ubuntu Audio settings UI fixes the problem (without changing any setting).
It is not necessarily a regression as the bug is rare, we can have missed it in the past.

I took snapshots of audio components states when HDMI is muted and working, please find them attached.
Differences seems to show that in Codec: Intel Valleyview2 HDMI, Node 0x02 [Audio Output] is not Enabled, and IEC958 is Off. Intel_audio_dump output shows also some differences.

My environment is:
BAY TRAIL M / Notebook ACER Aspire ES1-512
*Hardware*
Platform: Aspire ES1-512 (ACER) - Notebook
Processor Family : ATOM
CPU Type: Intel(R) Celeron(R) CPU  N2840  @ 2.16GHz 
Signature : Type ,  Family: 6, Model: 55, stepping: 8
(SoC : VLV2 C0)
*Software*
Linux distribution: Ubuntu 14.04 LTS 64 bits
Kernel: 4.0-rc1 from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
BIOS : v1.09
Comment 1 Jani Nikula 2015-02-26 13:20:58 UTC
Possibly related https://bugs.freedesktop.org/show_bug.cgi?id=75038
Comment 2 guillaume-florianx.vidal 2015-02-27 17:38:44 UTC
It looks similar at first sight, but playing 48kHz won't help. I just reproduced it with analog audio so graphics are not necessarily involved.
It can be a missing configuration as 78038. 
Moreover, I cannot reproduce the issue on Haswell atm.
Comment 3 jinliangx.wang 2015-03-09 08:14:12 UTC
Hi Guillaume,

I tried latest one weeks' drm-intel-nightly kernel on BYT-M / Notebook ACER Aspire E1-410G. Not found this bug.

Could you please give the fixed reproduce steps?
What's the bug reproducibility? or how many times of boot up would let the bug appear?
Comment 4 guillaume-florianx.vidal 2015-03-09 15:55:29 UTC
Created attachment 169971 [details]
dmesg and audio info

Hello,

The steps to reproduce are:
speaker-test -D hw:PCH,3 -l 1 -c 2 -s 1 -t wav		(sound okay)
xrandr --output HDMI1 --off
xrandr --output HDMI1 --auto
speaker-test -D hw:PCH,3 -l 1 -c 2 -s 1 -t wav		(sound okay)
Ubuntu - system settings - Brightness & Lock - Turn Screen off when inactive for "1 minute"
Wait 1 minute, HDMI turns off, press a key and log in again. 
speaker-test -D hw:PCH,3 -l 1 -c 2 -s 1 -t wav       Try playing audio, no sound from HDMI or analog.
This issue is not triggered by suspend to freeze or mem.

ELD (not valid + errors in dmesg) and audio codec seems involved. Please see attached logs for investigations.
Comment 5 jinliangx.wang 2015-03-16 02:26:45 UTC
Try to reproduce this bug again on latest drm-intel-nightly kernel.

The test result is slightly different from Guillaume.

As Guillaume's test step, press any key to wake up the monitor and log in, play audio, I could hear sound from HDMI monitor no matter playing through HDMI or Analog, It's incorrect behaviour.

ELD and codec are invalid:
1. cat /proc/asound/card0/eld*
monitor_present         0
eld_valid               0

2. cat /proc/asound/card0/codec#0
Codec: Realtek ALC282
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0282
Subsystem Id: 0x1025083d
Revision Id: 0x100003
No Modem Function Group found
Default PCM:
N/A
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power: setting=UNKNOWN, actual=UNKNOWN, Error, Clock-stop-OK, Setting-reset
Invalid AFG subtree

3. cat /proc/asound/card0/codec#2
Codec: Intel Valleyview2 HDMI
Address: 2
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x80862882
Subsystem Id: 0x80860101
Revision Id: 0x100000
No Modem Function Group found
Default PCM:
N/A
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power: setting=UNKNOWN, actual=UNKNOWN, Error, Clock-stop-OK, Setting-reset
Invalid AFG subtree

Software:
Linux distribution: Ubuntu 14.04 LTS 64 bits
Kernel: 4.0.0-rc3
Branch: git://anongit.freedesktop.org/drm-intel  drm-intel-nightly
Commit: f7def439e21cacf7656539edc55a4884734743de
BIOS:   v2.05
Comment 6 jinliangx.wang 2015-03-16 02:28:07 UTC
The test behaviour is similar with https://jira01.devtools.intel.com/browse/VIZ-5118.
Comment 7 guillaume-florianx.vidal 2015-04-15 13:23:20 UTC
Issue is still reproducible on latest drm-intel kernel. (Had no problem to boot).

My environment is:
BAY TRAIL M / Notebook ACER Aspire ES1-512
*Hardware*
Platform: Aspire ES1-512 (ACER) - Notebook
Processor Family : ATOM
CPU Type: Intel(R) Celeron(R) CPU  N2840  @ 2.16GHz 
Signature : Type ,  Family: 6, Model: 55, stepping: 8
(SoC : VLV2 C0)
*Software*
Linux distribution: Ubuntu 14.04 LTS 64 bits
Kernel: 4.0.0 from drm-intel/nightly - commit 5ea91de4 Apr 14 20:00:06 2015 
BIOS : v1.09
Comment 8 Mengdong Lin 2015-04-16 01:58:28 UTC
Thank you, Guillaume! I'll install a clean Ubuntu 14.04 on an ACER Aspire E1-410G and verify this issue again.

Now, this machine cannot start UI automatically on boot.
If I enable x and gnome after boot, I cannot reproduce this issue:
- HDMI audio playback is okay if I turn off/on the single HDMI output or turn off/on all displays.

- If I turn off all displays and turn on HDMI only, the HDMI display cannot light up.
Comment 9 Mengdong Lin 2015-04-17 02:25:38 UTC
I Cannot reproduce this issue on ACER Aspire E1-410G, with Ubuntu 14.04.2 LTS, and the following kernels:
- native kernel v3.16 carried by the Ubuntu release
- DRM nightly v4.0 on 04-14
- Mainline kernel v4.0 and v3.19, from Guillaume's debian package (so Kconfig is not the factor)

Next step:
- try to find a Aspire ES1-512, same as Guillaume
- try Old Ubuntu 14.04 LTS with the same kernels.
- Compare the audio info from Guillaume
Comment 10 Mengdong Lin 2015-04-17 04:22:51 UTC
Hi Guillaume,

I cannot find the same Aspire ES1-512 as you.
Could you help to share more info?

- Can this issue be reproduced on Braswell RVP with Ubuntu 14.04 LTS? And how often?
  
- Does this issue happen for other HDMI monitors in addtion to ASUS PB238?

- Could you share me the ALSA info and IAD dump with the latest DRM kernel?
Comment 11 Mengdong Lin 2015-04-17 07:49:29 UTC
Hi Guillaume,

I installed a clean 14.04 LTS
Comment 12 Mengdong Lin 2015-04-17 07:57:49 UTC
Hi Gullame,

Could you try enable the amixer control 'IEC958 Playback Switch' when there is no HDMI sound after a display off/on cycle, on the drm nightly kernel on 04/14?

From your shared info, it seems the digtal transmission through digital converter (Node 0x02) is disabled and so the audio data cannot be sent to GPU display pipeline: 

Codec: Intel Valleyview2 HDMI
...
Node 0x02 [Audio Output] wcaps 0x6611: 8-Channels Digital
  ...
  Digital:         ... this bit should be 'Enabled' for playback          
  Digital category: 0x0
  IEC Coding Type: 0x0
  


In addtion, I installed a clean Ubuntu 14.04 LTS on BSW RVP, still cannot reproduce this issue, no matter HD-A power save is enabled or not.
Comment 13 guillaume-florianx.vidal 2015-04-17 14:00:24 UTC
Hi Mengdong,
This is not reproducible on BSW-M, but eDP is off when I plug HDMI (with Eywa, drm or mainline kernels).

Tested with AOC 2369M monitor, same result, same logs.

I take new snapshot on 4.0.0 mainline kernel, attached files are in "04_17_15-4.0-logs.zip"
What is new is that we can see invalid AFG subtree in latest kernel, meaning codec lost response.
IEC958 Playback switch is already on with latest kernel. Root cause is elsewhere.

Your patch "i915-not-disable-power-well.patch" fixes the issue.
$cat sys/module/i915/parameters/disable_power_well
0

The issue is not reproducible when i915 power well is disabled.
Comment 14 guillaume-florianx.vidal 2015-04-17 14:02:05 UTC
Created attachment 174291 [details]
04_17_15-4.0-logs
Comment 15 Mengdong Lin 2015-04-20 09:32:55 UTC
Created attachment 174521 [details]
Patch to request power from Gfx for Baytrail HD-A controller
Comment 16 Mengdong Lin 2015-04-20 09:33:47 UTC
Created attachment 174531 [details]
Pacth to only sync BCLK for Haswell and Broadwell
Comment 17 Mengdong Lin 2015-04-20 09:37:13 UTC
Hi Guillaume,

Would you please try the two patches above (comment #15,16)?

The 1st patch is to request power supply from Gfx when audio is initialized or resume from S3 for Baytrail. Thus the power is always available in S0.

The 2nd patch is a bug fix, not setting BCLK for non-HSW/BDW platforms.
Comment 18 guillaume-florianx.vidal 2015-04-20 12:56:59 UTC
Created attachment 174551 [details]
After_inactivity_OK-with2patches

Hi Mengdong,
I applied these two patches on top of stable 4.0 mainline kernel, they fix the issue.
I compared before and after inactivity audio configuration and they are the same.
Comment 19 Mengdong Lin 2015-04-21 01:32:32 UTC
Many thanks, Guillaume! I will submit the patch today.
Comment 20 Mengdong Lin 2015-04-21 06:25:04 UTC
Hi Guilluame,

Would you please close this bug?

Two bug fixing patches are accepted by ALSA:
-  ALSA: hda - only sync BCLK to the display clock for Haswell & Broadwellfor
   same as the one in comment #16.


- ALSA: hda - add AZX_DCAPS_I915_POWERWELL to Baytrail
   Just accepted. Only has a very small refactoring change from the one in comment #15.
Comment 21 guillaume-florianx.vidal 2015-04-21 06:41:15 UTC
I close this bug because it is fixed by the two patches:
    ALSA: hda - only sync BCLK to the display clock for Haswell & Broadwell
    ALSA: hda - add AZX_DCAPS_I915_POWERWELL to Baytrail

My environment is:
Hardware
Platform: Aspire ES1-512 (ACER) - Notebook
Processor Family : ATOM
CPU Type: Intel(R) Celeron(R) CPU N2840 @ 2.16GHz
Signature : Type , Family: 6, Model: 55, stepping: 8
(SoC : VLV2 C0)
Software
Linux distribution: Ubuntu 14.04 LTS 64 bits ( Window 8.1 dual Boot)
Kernel: 4.0.0 from mainline git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git + 2patches mentioned above
BIOS : v1.09