Bug 101583 - [KBL] intel NUC6CAYH no LSPCON HDMI audio output
Summary: [KBL] intel NUC6CAYH no LSPCON HDMI audio output
Status: CLOSED FIXED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/Intel (show other bugs)
Version: DRI git
Hardware: x86-64 (AMD64) Linux (All)
: highest blocker
Assignee: shashank.sharma@intel.com
QA Contact: Intel GFX Bugs mailing list
URL:
Whiteboard: ReadyForDev
Keywords:
: 101793 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-06-25 09:04 UTC by Kuta
Modified: 2017-09-25 07:53 UTC (History)
8 users (show)

See Also:
i915 platform: KBL
i915 features: display/audio, display/LSPCON


Attachments
journalctl --dmesg output (71.83 KB, text/plain)
2017-06-27 07:31 UTC, Kuta
no flags Details
Alsa system interrogation (39.11 KB, text/plain)
2017-06-27 07:37 UTC, Kuta
no flags Details
journalctl --dmesg output 2017-07-05 (294.21 KB, text/plain)
2017-07-05 02:52 UTC, Kuta
no flags Details
dmesg from NUC6i7KYK before patch (209.44 KB, text/plain)
2017-09-01 11:39 UTC, Joseph Nuzman
no flags Details
dmesg from NUC6i7KYK after patch (223.67 KB, text/plain)
2017-09-01 11:39 UTC, Joseph Nuzman
no flags Details
Patch - enables working HDMI audio on NUC6i7KYK (2.64 KB, patch)
2017-09-01 11:40 UTC, Joseph Nuzman
no flags Details | Splinter Review

Description Kuta 2017-06-25 09:04:06 UTC
Affected : intel NUC6CAYH

Expected behavior :
HDMI audio output to TV.

Observed behavior : 
Windows 10 : No HDMI audio output at all resolutions.
Xubuntu 17.04 (Kernel 4.10x) : No HDMI audio at any resolution.
Librelec 8.02 : No HDMI audio at any resolution.

Actions :
Updated BIOS to latest AYAPLCEL.86A.0038 (http://intel.ly/2t4MscK)
Updated Megachip HDMI Firmware to 1.66 via Windows only software (http://intel.ly/2tI9kwH)

Repeat test observed behavior:
Windows 10 : HDMI audio output as expected at all resolutions.
Xubuntu 17.04 (Kernel 4.10x) : No HDMI audio at any resolution.
Librelec 8.02 : No HDMI audio at any resolution.

Reference:
MCDP28x0 DisplayPort1.2a-to-HDMI 2.0 Converter
http://www.megachips.com/products/displayport/MCDP28x0

...
Comment 1 Elizabeth 2017-06-26 17:05:41 UTC
Hello, 
Could you please be so kind to provide a full dmesg log with the parameter drm.debug=0xe on grub, from boot to the moment the bug is present? Thank you.
Comment 2 Kuta 2017-06-27 07:31:29 UTC
Created attachment 132273 [details]
journalctl --dmesg output
Comment 3 Kuta 2017-06-27 07:37:52 UTC
Created attachment 132274 [details]
Alsa system interrogation
Comment 4 Kuta 2017-06-27 07:42:15 UTC
Target device is Polaroid 49" UHD (4K) Television. HDMI v1.4H HDCP v2.2
Comment 5 Kuta 2017-07-01 11:54:00 UTC
Ok, short answer : It works - sorta...ish

Longer answer : Its very, VERY flakey. Breathe on it & sound stops working again. Totem kills the sound reliably so uninstall it & use VLC.
 

I've tried to document the process of getting sound via HDMI on Ubuntu 16.10 clearly for the next person.
 

Note 1 : The package 'oem-audio-hda-daily-dkms' does not exist in the Graphics drivers PPA.

Note 2 : Ubuntu 16.10 is the most recent being packaged for by the ALSA PPA guys.

Note 3 : Keep your resolution no higher than 1920x1080 or no sound via HDMI again..

Note 4 : When sound via inevitably stops, Log out & back in. Check sound mixer settings & return them to  HDMI/Display port/Stereo etc again.


Follow these steps to resolve the issue:


1.  Make sure that your system is up-to-date using the Update Manager.

    In a Terminal window, run the following:

    sudo apt-get update && sudo apt-get upgrade

    Reboot the system.
 

2.  Add the following groups to your account:

    audio, pulse, pulse-access, video, voice

    Install the better user/groups gui to manage this:
    sudo apt-get install gnome-system-tools

   
3.  Add the Graphics Drivers PPA

    [ Oibaf : Updated and Optimized Open Graphics Drivers repo ]
    [ https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers ]

    In a Terminal window, run the following:

    sudo add-apt-repository ppa:oibaf/graphics-drivers
    sudo apt-get update

    Reboot the system.

4.  Add the ALSA PPA (all versions of Ubuntu up to 16.10, 17.04 NOT supported)

    [ ALSA daily build snapshots repo ]
    [ https://code.launchpad.net/~ubuntu-audio-dev/+archive/ubuntu/alsa-daily/+index ]

    In a Terminal window, run the following:

    sudo add-apt-repository ppa:ubuntu-audio-dev/alsa-daily
    sudo apt-get update && sudo apt-get install oem-audio-hda-daily-dkms

    Reboot the system.


5.  Make this directory if it does not exist under /etc/X11:
    sudo mkdir xorg.conf.d

    Create this new file:
    sudo nano /etc/X11/xorg.conf.d/20-intel.conf

    Paste this contecnt into the newly created file:

     Section "Device"
     Identifier "Intel Graphics"
     Driver "intel"
     # Option "SwapbuffersWait" "true"
     Option "AccelMethod" "SNA"
     # Option "AccelMethod" "UXA"
     Option "TearFree" "true"
     Option "DRI" "3"
     EndSection


To revert to standard Ubuntu graphics drivers type the following in a prompt shell:

$ sudo apt-get install ppa-purge
$ sudo ppa-purge ppa:oibaf/graphics-drivers

 

To revert to standard Ubuntu ALSA drivers type the following in a prompt shell:

$ sudo apt-get install ppa-purge
$ sudo ppa-purge ppa:ubuntu-audio-dev
Comment 6 Jani Nikula 2017-07-04 08:03:37 UTC
Please add drm.debug=14 module parameter and redo the dmesg.
Comment 7 Kuta 2017-07-05 02:50:16 UTC
Thank You Jani. I have added the requested kernel parameter to the grub configuration. Output of journalctl --dmesg attached.

Please note, as the packages in Ubuntu are old I have installed a fresh copy of an Arch based distro (manjaro v 17.02). This has latest stable versions of Alsa & Xorg.

I can get sound output without modification on this distro via HDMI at screen resolution 1920x1080 but no higher. Sound output is applicaion dependent, Kodi for example stops sound output for itself & all other apps. Logging out/in restores sound at 1920x1080 for Audacious & Smplayer.
Comment 8 Kuta 2017-07-05 02:52:35 UTC
Created attachment 132446 [details]
journalctl --dmesg output 2017-07-05
Comment 10 Elizabeth 2017-07-05 17:57:17 UTC
Adding tag into "Whiteboard" field - ReadyForDev
*Status is correct
*Platform is included
*Feature is included
*Priority and Severity correctly set
*Logs included
Comment 11 Jani Nikula 2017-07-31 13:43:45 UTC
Apparently the problems is in the LSPCON handling.
Comment 12 Jani Nikula 2017-08-07 07:21:53 UTC
*** Bug 101793 has been marked as a duplicate of this bug. ***
Comment 13 Jani Nikula 2017-08-07 07:25:14 UTC
(In reply to Jani Nikula from comment #12)
> *** Bug 101793 has been marked as a duplicate of this bug. ***

Some extra clues in the dupe.
Comment 14 Jani Nikula 2017-08-07 07:26:43 UTC
*** Bug 101835 has been marked as a duplicate of this bug. ***
Comment 15 Jani Nikula 2017-08-07 07:45:43 UTC
*** Bug 101056 has been marked as a duplicate of this bug. ***
Comment 16 shashank.sharma@intel.com 2017-08-09 03:36:10 UTC
With the local validation, we are able to hear HDMI audio on a SKL NUC / SKL RVP using Ubuntu 17.04. This seems to  be  a configuration problem. Linux audio team is looking into it.

- Shashank
Comment 17 Kuta 2017-08-12 01:19:34 UTC
Retest with Ubuntu 16.04.03 clean install:

Kernel 4.11 - no HDMI audio audible from any application.
Kernel 4.10 - no HDMI audio audible from any application.
Kernel 4.9 - no HDMI audio audible from any application.
Kernel 4.8 - no HDMI audio audible from any application.
Kernel 4.4 - *HDMI audio audible from subset of applications.

* Kodi works once then sound stops until logout/login or reboot.
Comment 18 Kuta 2017-08-12 01:25:47 UTC
Retest with Manjaro 17.02 following latest rolling updates.

Kernel 4.11 - *HDMI audio audible.

* Kodi works exactly once with subsequent relaunch of the application displayiong no audible audio. Other apps do not display this behavior but are affected when Kodi kills sound.

Using identical distro Kodi works with out issue on systems lacking the DP/HDMI converter chip.
Comment 19 Kuta 2017-08-12 01:34:36 UTC
Note: intel has released another BIOS update [AYAPLCEL.86A] for the intel NUC6CAYH. http://intel.ly/2hSW3Q4

Applied & retested : no change.
Comment 20 Kuta 2017-08-12 01:51:55 UTC
(In reply to shashank.sharma@intel.com from comment #16)
> With the local validation, we are able to hear HDMI audio on a SKL NUC / SKL
> RVP using Ubuntu 17.04. This seems to  be  a configuration problem. Linux
> audio team is looking into it.
> 
> - Shashank

Perhaps someone could enlighten end users as the the minimum Linux driver/library/kernel required to support reliable HDMI audio output via DP-HDMI convert chip equipped NUC6CAYH please?
Comment 21 Kuta 2017-08-12 01:52:37 UTC
(In reply to shashank.sharma@intel.com from comment #16)
> With the local validation, we are able to hear HDMI audio on a SKL NUC / SKL
> RVP using Ubuntu 17.04. This seems to  be  a configuration problem. Linux
> audio team is looking into it.
> 
> - Shashank

Perhaps someone could enlighten end users as the the minimum Linux driver/library/kernel required to support reliable HDMI audio output via DP-HDMI converter chip equipped NUC6CAYH please?
Comment 22 Zach 2017-08-16 15:30:49 UTC
Confirmed no audio output over HDMI on 7th gen Intel NUC (NUC7i5BNB) with resolution over 1920x1080. Setting resolution to 1920x1080 immediately makes audio output work. Then setting the resolution back higher (2560x1080 in this case) the audio continues to work, making a viable but cumbersome workaround.

OS: Linux Mint 18.2 XFCE
Kernel: 4.10.0-32-generic

Attempting to install oem-audio-hda-daily-dkms from ppa:ubuntu-audio-dev/alsa-daily results in message "Error!  The dkms.conf for this module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch.  This indicates that it should not be built" and does not solve the issue even after reboot.
Comment 23 Zach 2017-08-16 22:27:16 UTC
Here's a quick and dirty bash script that you can launch at login or run manually to work around the no sound issue by bringing it back to life. Be sure to change to the device and target resolution you want to use.


#!/bin/bash

videodevice=DP1
targetres=2560x1080
saferes=1920x1080

xrandr --output ${videodevice} --mode ${saferes}
xrandr --output ${videodevice} --mode ${targetres}
Comment 24 Jani Nikula 2017-08-17 09:40:59 UTC
Please try this patch http://patchwork.freedesktop.org/patch/msgid/1495778837-6722-1-git-send-email-quanxian.wang@intel.com

N.b. that's Kabylake specific and won't help any other platforms.
Comment 25 Joseph Nuzman 2017-09-01 11:39:09 UTC
Created attachment 133925 [details]
dmesg from NUC6i7KYK before patch
Comment 26 Joseph Nuzman 2017-09-01 11:39:38 UTC
Created attachment 133926 [details]
dmesg from NUC6i7KYK after patch
Comment 27 Joseph Nuzman 2017-09-01 11:40:47 UTC
Created attachment 133927 [details] [review]
Patch - enables working HDMI audio on NUC6i7KYK
Comment 28 Joseph Nuzman 2017-09-01 11:56:21 UTC
Posting to this bug, as https://bugs.freedesktop.org/show_bug.cgi?id=101793 was marked as duplicate.

I found some time to track down why ELD connector type was coming up as HDMI rather than DP.

The ELD for a connector is set using the drm_edid_to_eld() routine (in i915, reached by get_modes helper).  This drm routine leaves the connector type field of the ELD for the driver to set.

[    2.172863] [drm:drm_edid_to_eld [drm]] ELD monitor SAMSUNG

Later, the intel_audio_codec_enable() routine sets the connector type field in ELD correctly as DP.  Note, however, that the enable routine is only called once.

[    2.429813] [drm:intel_audio_codec_enable [i915]] ELD on [CONNECTOR:48:DP-1], [ENCODER:47:DDI B]

The audio driver will request a copy of the ELD.  But before that happens, the drm_edid_to_eld() routine is invoked again, overwriting the ELD and resetting the connector type previously set.

[    2.877015] [drm:drm_edid_to_eld [drm]] ELD monitor SAMSUNG

After this, the audio driver invokes a call back to get a copy of the ELD.  This is already missing the corrected connector type field.

[    3.020995] [drm:i915_audio_component_get_eld [i915]] Not valid for port B

Both the drm_edid_to_eld() and i915_audio_component_get_eld() routines will be called multiple times later, but the connector type field is never set again.

The attached patch sets the connector type field after each time the intel_connector_update_modes() helper rewrites the ELD.  With the patch applied, connector type is detected correctly by the audio driver as DP, and HDMI audio works on my SKL NUC.

$ cat /proc/asound/card0/eld#2.0
monitor_present		1
eld_valid		1
monitor_name		SAMSUNG
connection_type		DisplayPort
eld_version		[0x2] CEA-861D or below
edid_version		[0x3] CEA-861-B, C or D
manufacture_id		0x2d4c
product_id		0xa7a
port_id			0x0
support_hdcp		0
support_ai		1
audio_sync_delay	0
speakers		[0x1] FL/FR
sad_count		1
sad0_coding_type	[0x1] LPCM
sad0_channels		2
sad0_rates		[0xe0] 32000 44100 48000
sad0_bits		[0xe0000] 16 20 24


Note that the intel_audio_codec_enable() routine is also setting the audio delay field in the ELD.  It may be that this field should also be set by the intel_connector_update_modes() routine.  It seems that the audio driver only uses this field to expose the audio_sync_delay in procfs.
Comment 29 dCrypt 2017-09-01 12:40:28 UTC
Did you also try if this patch also solves the HD audio passthrough bug?

https://bugs.freedesktop.org/show_bug.cgi?id=98797
Comment 30 Joseph Nuzman 2017-09-01 14:10:00 UTC
No, I'm using PCM audio.
Comment 31 mleczan 2017-09-02 08:03:59 UTC
Thank you @Joseph.
After applying your patch to kernel 4.10 on Ubuntu 16.04 HDMI audio works like a charm!
Comment 32 Jani Nikula 2017-09-04 13:47:15 UTC
(In reply to Joseph Nuzman from comment #28)
> I found some time to track down why ELD connector type was coming up as HDMI
> rather than DP.

The original reason for that has been clear all along: With LSPCON the port looks like DP to the driver, but the ELD comes all the way from the display, which is HDMI.

So I didn't track down all the paths in your description or your patch, but is this really not enough:

https://bugs.freedesktop.org/show_bug.cgi?id=98797#c94
Comment 33 Joseph Nuzman 2017-09-04 21:10:14 UTC
(In reply to Jani Nikula from comment #32)
> The original reason for that has been clear all along: With LSPCON the port
> looks like DP to the driver, but the ELD comes all the way from the display,
> which is HDMI.
> 
> So I didn't track down all the paths in your description or your patch, but
> is this really not enough:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=98797#c94

No.  The ELD does not come directly from the display.  The ELD is built from the EDID by the drm_edid_to_eld routine.  This routine explicitly clears the conn_type field (effectively leaving the conn_type set as "HDMI", regardless of the monitor).  

The graphics driver is supposed to fill in the conn_type field.  At least in my setup, that is done correctly by the intel_audio_codec_enable routine.  (It sets conn_type of DP, as it is talking to the LSPCON.)

The problem is, after intel_audio_codec_enable sets the conn_type field, the entire ELD is overwritten by subsequent invocations of drm_edid_to_eld.  It is this overwritten version of ELD that makes its way to the audio driver.
Comment 34 Jani Nikula 2017-09-19 15:45:07 UTC
Joseph, thanks for all your input, and sorry for the delay in getting back. We can't use the attached encoder like you do in your patch, but I posted an alternative version:

http://patchwork.freedesktop.org/patch/msgid/20170919153813.29808-1-jani.nikula@intel.com

Please give it a go.
Comment 35 Joseph Nuzman 2017-09-20 05:19:20 UTC
(In reply to Jani Nikula from comment #34)
> Joseph, thanks for all your input, and sorry for the delay in getting back.
> We can't use the attached encoder like you do in your patch, but I posted an
> alternative version:
> 
> http://patchwork.freedesktop.org/patch/msgid/20170919153813.29808-1-jani.
> nikula@intel.com
> 
> Please give it a go.

Thanks, Jani.  Your patch works perfectly on my setup.
Comment 36 Jani Nikula 2017-09-20 12:16:15 UTC
Presumed fixed by

commit d81fb7fd9436e81fda67e5bc8ed0713aa28d3db2
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Tue Sep 19 18:38:13 2017 +0300

    drm/i915: always update ELD connector type after get modes

in drm-tip, with cc: stable.

I acknowledge there may be conflated issues in this bug report. However, this fixes a class of problems with DP audio (and HDMI audio via LSPCON), so please file new bugs for remaining issues.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.