2

The EDID sent by my monitor when directly connected to my graphic card is ok, I dumped it in /lib/firmware/edid/viewsonic.bin.

I want to access my monitor through a KVM-switch, an HDMI-audio-extractor and an HDMI splitter. With that setup, the EDID received by my computer is broken, and even the UEFI can't detect my screen is on.

I found a workaround by appending drm_kms_helper.edid_firmware=edid/viewsonic.bin video=HDMI-A-1:D to my kernel boot line. Thanks to that line, the HDMI video output is ok in Linux.

However, the HDMI audio doesn't work. Pulseaudio is set to the correct sink, which is detected as unplugged (not-available).

I tried the following without any resulting change:

  • Add the edid file in initramfs so that EDID is loaded earlier
  • xrandr --output HDMI-1 --set audio on

The only way I was able to make all this work was to boot with monitor directly plugged to the computer (without enforcing EDID) and go back to my setup once boot is completed. However, sound goes away anyway after suspend or long idling time and then I can't make it work again.

Thank you for any suggestions you'd have!


Maybe relevant:

$ pactl list sinks
Sink #0         
    State: RUNNING                                                                   
    Name: alsa_output.pci-0000_00_1f.3.hdmi-stereo
    Description: Audio interne Digital Stereo (HDMI)
    Driver: module-alsa-card.c                                      
    Sample Specification: s16le 2ch 44100Hz   
    Channel Map: front-left,front-right               
    Owner Module: 7
    Mute: no                           
    Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
            balance 0,00          
    Base Volume: 65536 / 100% / 0,00 dB
    Monitor Source: alsa_output.pci-0000_00_1f.3.hdmi-stereo.monitor
    Latency: 39654 usec, configured 40000 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS
    Properties:                 
            alsa.resolution_bits = "16"         
            device.api = "alsa"
            device.class = "sound"
            alsa.class = "generic"          
            alsa.subclass = "generic-mix"                              
            alsa.name = "HDMI 0"              
            alsa.id = "HDMI 0"                  
            alsa.subdevice = "0"                                       
            alsa.subdevice_name = "subdevice #0"
            alsa.device = "3"        
            alsa.card = "0"                         
            alsa.card_name = "HDA Intel PCH"
            alsa.long_card_name = "HDA Intel PCH at 0xdf240000 irq 325"
            alsa.driver_name = "snd_hda_intel"
            device.bus_path = "pci-0000:00:1f.3"
            sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
            device.bus = "pci"                       
            device.vendor.id = "8086"        
            device.vendor.name = "Intel Corporation"
            device.product.id = "a170"                          
            device.product.name = "Sunrise Point-H HD Audio"          
            device.form_factor = "internal"    
            device.string = "hdmi:0"                                                         
            device.buffering.buffer_size = "352800"
            device.buffering.fragment_size = "176400"
            device.access_mode = "mmap+timer"
            device.profile.name = "hdmi-stereo"                              
            device.profile.description = "Digital Stereo (HDMI)"
            device.description = "Audio interne Digital Stereo (HDMI)"
            alsa.mixer_name = "Realtek ALC1150"
            alsa.components = "HDA:10ec0900,1462da12,00100001 HDA:80862809,80860101,00100000"        
            module-udev-detect.discovered = "1"
            device.icon_name = "audio-card-pci"      
    Ports :                                  
            hdmi-output-0: HDMI / DisplayPort (priority: 5900, not available)
    Active port: hdmi-output-0                                  
    Formats:                                                          
            pcm                                

EDIT: When booting with the edid_firmware option, eld are not set (result is the same for eld#2.0 as for other 2.*):

$ grep eld_valid /proc/asound/card0/eld#2.0
monitor_present         0
eld_valid               0

But when booting with the monitor directly connected and with or without the boot parameters, result for eld#2.0 is now a valid eld:

$ cat /proc/asound/card0/eld\#2.0 
monitor_present         1
eld_valid               1
monitor_name            VX2703 SERIES
connection_type         HDMI
eld_version             [0x2] CEA-861D or below
edid_version            [0x3] CEA-861-B, C or D
manufacture_id          0x635a
product_id              0xf62b
port_id                 0x0
support_hdcp            0
support_ai              0
audio_sync_delay        0
speakers                [0x1] FL/FR
sad_count               1
sad0_coding_type        [0x1] LPCM
sad0_channels           2
sad0_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
sad0_bits               [0xe0000] 16 20 24

aplay -l output

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1150 Digital [ALC1150 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ edid-decode /lib/firmware/edid/viewsonic.bin
Extracted contents:
header:          00 ff ff ff ff ff ff 00
serial number:   5a 63 2b f6 01 01 01 01 19 17
version:         01 03
basic params:    80 3c 22 78 2e
chroma info:     b2 05 a3 56 4f 9e 28 0f 50 54
established:     bf ef 80
standard:        b3 00 a9 40 95 00 90 40 81 80 81 40 71 4f 01 01
descriptor 1:    02 3a 80 18 71 38 2d 40 58 2c 45 00 55 50 21 00 00 1e
descriptor 2:    00 00 00 ff 00 54 38 47 31 33 32 35 30 30 34 32 30 0a
descriptor 3:    00 00 00 fd 00 32 4c 0f 53 12 00 0a 20 20 20 20 20 20
descriptor 4:    00 00 00 fc 00 56 58 32 37 30 33 20 53 45 52 49 45 53
extensions:      01
checksum:        f2

Manufacturer: VSC Model f62b Serial Number 16843009
Made week 25 of 2013
EDID version: 1.3
Digital display
Maximum image size: 60 cm x 34 cm
Gamma: 2.20
DPMS levels: Off
Supported color formats: RGB 4:4:4, YCrCb 4:4:4
Default (sRGB) color space is primary color space
First detailed timing is preferred timing
Established timings supported:
  720x400@70Hz
  640x480@60Hz
  640x480@67Hz
  640x480@72Hz
  640x480@75Hz
  800x600@56Hz
  800x600@60Hz
  800x600@72Hz
  800x600@75Hz
  832x624@75Hz
  1024x768@60Hz
  1024x768@70Hz
  1024x768@75Hz
  1280x1024@75Hz
  1152x870@75Hz
Standard timings supported:
  1680x1050@60Hz
  1600x1200@60Hz
  1440x900@60Hz
  1400x1050@60Hz
  1280x1024@60Hz
  1280x960@60Hz
  1152x864@75Hz
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Serial number: T8G132500420
Monitor ranges (GTF): 50-76Hz V, 15-83kHz H, max dotclock 180MHz
Has 1 extension blocks
Checksum: 0xf2 (valid)

CEA extension block
Extension version: 3
30 bytes of CEA data
  Video data block
    VIC  16 1920x1080@60Hz (native)
    VIC   5 1920x1080i@60Hz 
    VIC   4 1280x720@60Hz 
    VIC   3 720x480@60Hz 
    VIC   2 720x480@60Hz 
    VIC   7 1440x480i@60Hz 
    VIC   6 1440x480i@60Hz 
    VIC  31 1920x1080@50Hz 
    VIC  20 1920x1080i@50Hz 
    VIC  19 1280x720@50Hz 
    VIC  18 720x576@50Hz 
    VIC  17 720x576@50Hz 
    VIC  22 1440x576i@50Hz 
    VIC  21 1440x576i@50Hz 
    VIC   1 640x480@60Hz 
  Audio data block
    Linear PCM, max channels 2
    Supported sample rates (kHz): 192 176.4 96 88.2 48 44.1 32
    Supported sample sizes (bits): 24 20 16
  Speaker allocation data block
    Speaker map: FL/FR
  Vendor-specific data block, OUI 000c03 (HDMI)
    Source physical address 1.0.0.0
Underscans PC formats by default
Basic audio support
Supports YCbCr 4:4:4
Supports YCbCr 4:2:2
1 native detailed modes
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Detailed mode: Clock 74.250 MHz, 597 mm x 336 mm
               1920 2008 2052 2200 hborder 0
                540  542  547  562 vborder 0
               +hsync +vsync interlaced 
Detailed mode: Clock 74.250 MHz, 597 mm x 336 mm
               1280 1390 1430 1650 hborder 0
                720  725  730  750 vborder 0
               +hsync +vsync 
Detailed mode: Clock 27.000 MHz, 597 mm x 336 mm
                720  736  798  858 hborder 0
                480  489  495  525 vborder 0
               -hsync -vsync 
Detailed mode: Clock 148.500 MHz, 597 mm x 336 mm
               1920 2448 2492 2640 hborder 0
               1080 1084 1089 1125 vborder 0
               +hsync +vsync 
Checksum: 0x4d (valid)

EDID block does NOT conform to EDID 1.3!
    Name descriptor not terminated with a newline

EDIT: Digging kernel side

After some more digging, it appears that it all begins in linux-source-4.12/drivers/gpu/drm/i915/intel_ddi.c. The return value of I915_READ(HSW_AUD_PIN_ELD_CP_VLD) & AUDIO_OUTPUT_ENABLE(intel_crtc->pipe) determines whether the output "has_audio" or not. Since it hasn't, the function intel_audio_codec_enable isn't called. I tried forcing the call to it. After that, the ELD got configured properly and reported valid in /proc/asound/card0/eld#2.0. Pulseaudio no longer says the output is unplugged. But it still doesn't work, and I get an error: [drm:pipe_config_err [i915]] ERROR mismatch in has_audio (expected 0, found 1) which is normal since I tempered with it. So, I don't know, maybe can I manually change HSW_AUD_PIN_ELD_CP_VLD with intel gpu tools, but I prefer to ask people who know better.

2

Partial answer:

The EDID contains audio information, in particular the CEA audio extension block you have listed with edid-decode. This data is extracted by the kernel drivers and made available to ALSA as ELD ("EDID-like data"). You see the current ELDs (and test if they are present at all) with

cat /proc/asound/card*/eld\#*

You can also change some of the ELD data using this interface, e.g.

echo 'audio_sync_delay 23' | sudo tee /proc/asound/card0/eld#3.2

So if for some reason your kernel boot EDID doesn't get converted to an ELD, the HDMI sound output won't work.

There may be other reasons why it doesn't work; in that case, I recommend stopping Pulseaudio completely (or use pasuspender), and try to investigate on the ALSA level. aplay --dump-hw-params -D ... may help.

I don't know of any way to force an overwrite of the ELD with a custom ELD like you can do with the EDID, and I am not sure if such a way even exists.

In other words, I don't know how to fix the problem, but maybe this information gives you some idea where to look to find out more.

  • Thanks for your answer. I dug into the kernel sources and found a drm_edid_to_eld function. I assume this is the function you're referring to. The function loading edid from firmware is drm_load_edid_firmware, the one trying to get it from monitor is, I think, drm_do_get_edid. I'll probably have to track their use and try to understant why isn't edid_to_eld called when the edid is loaded from file… – captnfab Sep 9 '17 at 19:22
  • The first thing to test is to see whether you have working ELDs without (for comparison) and with the KVM switch. That should determine if the ELD is the problem, or something else is. – dirkt Sep 9 '17 at 20:35
  • No I have not: cat /proc/asound/card0/eld* gives two lines: monitor_present 0 and eld_valid 0 repeated 9 times. And that's strange because this function drm_edid_to_eld should be called from the edid firmware loader... – captnfab Sep 10 '17 at 7:12
  • But you do get a valid ELD when you connect it directly? On which file (eld#...) do you get it? – dirkt Sep 10 '17 at 7:22
  • Oh, good thinking. I just ran the test and edited my question to add the output. eld#2.0 has a valid ELD on direct connection without kernel parameter. – captnfab Sep 10 '17 at 7:48
2

I got an answer on IRC from #intel-gfx on freenode. The problem is that i915 module as well as others are calling the drm_(do_)get_edid which ignores the edid firmware given to the drm_kms_helper.

There exists a patch for linux (I applied it to linux 4.12 with minor conflict resolution) to change that behavior. It requires to rebuild all modules under the linux-source/drivers/gpu/drm/ and add a new boot parameter: drm.edid_firmware=edid/viewsonic.bin After that, the audio output is marked as available and the sound works. So the problem is solved. I hope this patch will be accepted!

  • I'd still think it would convenient to override the ELD itself if necessary .... but at least that way it's better than nothing. – dirkt Sep 10 '17 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.