Pi 4 + LE 10.0.1: Need help set custom EDID to fix audio white noise

  • Hi all,

    I'm running LE 9.2.8 on a Pi 2 and with this setup I am able to fix an issue with my TV/Soundbar by providing a custom EDID file, which is what I do since I started using LE with my Soundbar in 2017.
    I decided to upgrade so I bought a Pi 4 and installed LE 10.0.1 using the LibreELEC USB-SD Creator.

    Setup:
    Pi -> Teufel Cinebar 11 2.1 Soundbar+Subwoofer -> Sony Bravia KDL 42W655A

    Goal:

    Use Kodi Audio setting "Optimized" to be able to use passthrough and have Dolby and DTS decoded by the soundbar.

    Issue:

    My TV/Soundbar is claiming to support 44.1 kHz sample rate but produces white noise if used with 44.1 kHz.
    Diagnosed in Kodi itself using Audio setting "Fixed", which gives me clear sound except when setting sample rate fixed to 44.1 kHz.

    So with Audio set to "Optimized" I get constant white noise while navigating Kodi UI. White noise is gone during playback of music or video.

    Solution working so far on Pi 2 running LE 9.2.8:

    Grabbed the EDID file with tvservice -d edid.dat, removed the reported 32 and 44.1 kHz sample rates leaving only 48 kHz in the EDID file, put that file in /flash and set hdmi_edid_file=1 in /flash/config.txt.

    I understand the solution can't be carried over to the Pi 4 running LE 10.0.1 by doing the same steps as described above, because that hdmi setting in config.txt is not supported anymore. So I tried to reproduce the steps in a Pi 4 / LE 10.0.1 compatible way.

    What I did so far on Pi 4 running LE 10.0.1:

    Installed LE 10.0.1 on a fresh SD card, plugged it into a Pi 4 connected to my Soundbar using the Pi's HDMI port labelled HDMI 0 on the board (the one closer to the USB-C power input).

    SSHed into LE and executed getedid create.

    Replaced edid-HDMI-A-1.bin in /storage/.config/firmware/edid/ with my custom file (keeping the name edid-HDMI-A-1.bin).

    Replaced edid-HDMI-A-1.bin contained in the edid.cpio archive with my custom file (again keeping the name edid-HDMI-A-1.bin).

    Rebooted.

    I assume the edid should have been picked up that way, but the white noise is still there.

    Attached you can find my edid-HDMI-A-1.bin.zip which has exactly the same contens as the EDID file on my Pi 2, where things work as expected.
    Here is the debug log output: http://ix.io/3FbV
    It shows among other edid related things that loading the provided firmware failed with error -2.
    I have no idea what that error means and where to find related documentation that could explain the error and how to fix it.
    Guessing the edid file itself is fine based on the fact that edid-decode is happy to output what I would expect.

    I'm at a loss here with no documentation on how to customize the edid file for a Raspberry Pi.
    Wasn't able to find anything similar in this forum either.

    Removing the 44.1 kHz sample rate from the EDID file and have that EDID file be picked up by LE is the only approach I know to fix my specific problem.
    However, I'm open to other approaches as long as I can get rid of the white noise in the UI while being able to use passthrough.
    Any help is greatly appreciated!


    Thanks in advance!

  • Your edid.cpio is not correct. To recreate it do:

    Code
    cd /storage/.config/firmware/
    find edid | cpio -H newc -o >edid.cpio
    mount -o remount,rw /flash
    cp edid.cpio /flash
  • Thank you for your reply!

    I followed your instructions and rebooted, but with no effect. The white noise is still there. Debug log: http://ix.io/3FhS


    I assume what you mean is:
    Kernel command line defines drm.edid_firmware=HDMI-A-1:edid/edid-HDMI-A-1.bin, but the edid.cpio created by getedid create contained the path /usr/lib/firmware/edid/edid-HDMI-A-1.bin.
    So following your directions I'm left with a edid.cpio containing the path /edid/edid-HDMI-A-1.bin. Find it attached: edid.cpio.zip.

    However the debug log still shows the same error messages regarding the edid.

    Did I miss something or do you have any idea what else to try?

    Thank you for taking the time!

  • There seem to be no error in the edid.cpio.

    But there is only Trying to unpack rootfs image as initramfs... without Freeing initrd memory: xxxK in the log. It is likely the cpio file is not passed correctly to the kernel.

    Not owning any RPI I'm out of ideas. Maybe someone will take over if you can reproduce the error with an unmodified getedid procedure.

  • Thanks again for replying.

    sadly for me it does not look like the error is reproducible with the "standard" procedure, that is without modifying the generated edid file.
    Here is what I did.

    And here is the resulting debug log:
    http://ix.io/3Fyx

    In the log Trying to unpack rootfs image as initramfs... is still there and Freeing initrd memory: xxxK is still missing.
    So I'm not sure if the edid file is picked up correctly, but I guess so since the line *ERROR* Requesting EDID firmware "edid/edid-HDMI-A-1.bin" failed (err=-2) is gone from the debug log.

    I don't know what could be wrong with the edid.cpio once I provide my custom edid file and without that I can't fix my problem :-/

    I will try to edit the edid file that is generated by the getedid create command rather than providing the one generated a few years ago with tvservice and see if that makes any difference. However I will have to find an application (preferably for linux) to edit edid files first, because I did not modify my old edid file myself, but got it from a helping friend.

    I will update this thread with results.

    In the meantime, if you mglae or anyone else has any idea what I could try, please just let me know. I'll be happy to try anything ^^

  • Small update:

    I just used the edid file generated by getedid create as a baseline and the edid tools found in https://github.com/rpavlik/cros-chameleon to edit that edid file by converting it to json, editing it and converting it back to binary.
    I put that modified file into /storage/.config/firmware/edid/ (overwriting the one created by getedid create) and into /flash/edid.cpio (without changing the path inside the cpio archive). Files are attached.
    After reboot the white noise is still there and journalctl again shows [drm:edid_load] *ERROR* Requesting EDID firmware "edid/edid-HDMI-A-1.bin" failed (err=-2).

    So I'm still failing to have LE use my custom edid file to fix my specific problem :-/

  • I have another update on this issue:

    I have now "analyzed" the following:

    Seems to me that my edid.cpio has the same filename and also the same structure as in the original edid.cpio, which is created with getedid create and seems to work, but mine has only 2 blocks and not 3 blocks as in the original. Whatever this may mean...

    I just assume that it was wrong of me to open the original edid.cpio with the Gnome Archive Manager and to exchange the contained edid-HDMI-A-1.bin this way and so I did the following now:

    - unpacked the archive with cpio -i -F edid.cpio, which gives me usr/lib/firmware/edid/edid-HDMI-A-1.bin

    - exchanged the file edid-HDMI-A-1.bin in the extracted path with my modified file

    - recreated the archive with find usr -print | cpio -ov -H newc > maybe_working_edid.cpio

    That seems to make a difference:

    Code
    backups/pi4-libreelec/added
    ➜ cpio -it -F byMelo/maybe_working_edid.cpio
    usr
    usr/lib
    usr/lib/firmware
    usr/lib/firmware/edid
    usr/lib/firmware/edid/edid-HDMI-A-1.bin
    3 blocks

    I renamed this cpio archive back to edid.cpio and put it in /flash/ and booted the Pi with it and you can find exactly this edid.cpio.zip attached.

    The debug log looks good now regarding loading my edid file: http://ix.io/3G6H

    But unfortunately I still have the white noise, because ALSA still initializes the sink with sample rate 44.1 kHz, which you can also see in the log. I double checked that the file inside edid.cpio indicates only 48 kHz as supported sample rate.

    This raises the question:
    Is this working as designed or do we have a bug that causes ALSA to ignore audio related information from the provided EDID file?

    Should I raise an issue over at https://github.com/LibreELEC/LibreELEC.tv?

  • popcornmix the output of edid-decode /sys/devices/platform/gpu/drm/card0/card0-HDMI-A-1/edid contains this audio block:

    Sample rates show only 48 kHz which is what I wanted.
    Full output attached.

    I tried doing some more research, since I don't know that much about EDID files, drm module, ALSA and everything involved in all this.
    Not sure if it is actually worth mentioning but /proc/asound/card*/eld\#* does not find any files.
    From what I did read I thought that kernel drivers would extract the audio block from the EDID and pass it to ALSA as ELD in the corresponding /proc/asound/card* path...