How to use HDMI Custom EDID on XU4

Normally, the EDID is automatically parsed so that the monitor works well on ODROID-XU4.
But in the case of the very specific monitor, it doesn't work automatically. There are two reasons for that.

  1. XU4 doesn't parse the resolution we want from EDID.
  2. A pixel clock of specific resolution not supported by XU4.

In these cases, you can tweak the EDID to allow the monitor to work well on XU4.
Fortunately, the 480×1280 monitor example corresponds to both cases.
We are going to look at “case 1” so that the monitor parses a resolution we want from EDID.
And then, after check XU4 don't support the pixel clock, we will tweak some parameter of the EDID.

Check the EDID of your monitor

Let's look at the EDID we found it before. For detail finding EDID info, follow this link. How to get monitor information(Modeline)

Detailed mode: Clock 56.400 MHz, 480 mm x 1280 mm
                480  580  620  720 hborder 0
               1280 1290 1292 1302 vborder 0
               +hsync +vsync
Detailed mode: Clock 74.250 MHz, 708 mm x 398 mm
               1280 1390 1430 1650 hborder 0
                720  725  730  750 vborder 0
               +hsync +vsync

There are two detailed modes and we will use the first resolution, 480×1280 on XU4.

Determine values used to generate EDID

You can make parameters to generate custom EDID through this excel sheet.
We already filled the ModeLine information in the google sheet. If you want to make the other resolution, copy this template to your google sheet and fill the green area.

And copy this template to your google sheet and fill the green area.
https://docs.google.com/spreadsheets/d/1ZinXWeVa1h7nAAB0x5EGrKc0aJ45nwnsfvYC00a-rSc/edit?usp=sharing

We can determine the EDID parameters via the google sheet. These parameters used to build the EDID binary.

CLOCK 56400
XPIX 480
YPIX 1280
XBLANK 288
YBLANK 22
XOFFSET 5
XPULSE 13
YOFFSET 2
YPULSE 3
VFREQ 60
HSYNC_POL 1
VSYNC_POL 1

Build edid from source code on Ubuntu

You can create 480x1280_60hz.S file with the EDID parameters like this link. https://github.com/leeseungcheol/edid-generator/blob/master/480x1280_60hz.S

sudo apt install git zsh edid-decode automake dos2unix
git clone https://github.com/leeseungcheol/edid-generator.git
cd edid-generator
make

Apply your EDID binary on your XU4

Copy your edid file into "/lib/firmware" in rootfs partition
cp 480x1280_60hz.bin /lib/firmware/
Edit config.ini in boot partition

Append the videoconfig=“drm.edid_firmware=480x1280_60hz.bin” line in “config.ini” file.

...
...
 
; 480x320 without monitor data using generic information
; setenv videoconfig "drm_kms_helper.edid_firmware=edid/480x320.bin"
 
videoconfig="drm.edid_firmware=480x1280_60hz.bin"
 
; vout : hdmi or dvi
; hdmi / dvi
vout=hdmi
 
...
...

In the case of the old XU4 image that have not the “config.ini” file, add the videoconfig=“drm.edid_firmware=480x1280_60hz.bin” line in the “boot.ini” file.

...
...
 
setenv videoconfig "drm_kms_helper.edid_firmware=480x1280_60hz.bin"
 
# Boot Args
setenv bootargs "console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0 ${videoconfig} ${hdmi_phy_control} ${hid_quirks} smsc95xx.macaddr=${macaddr} ${external_watchdog}"
 
...
...

And then reboot your system.

reboot

Make sure that your EDID is applied well

After the reboot, you can verify with some command if your EDID is applied well.

You can find “edid_firmware” parameter in “cmdline”

odroid@odroid:~$ sudo cat /proc/cmdline
console=tty1 console=ttySAC2,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro fsck.repair=yes net.ifnames=0 drm.edid_firmware=480x1280_60hz.bin HPD=false vout=hdmi usbhid.quirks=0x0eef
:0x0005:0x0004 smsc95xx.macaddr=00:1e:06:61:7a:39 false drm.debug=0xff s5p_mfc.mem=16M

Verify the HDMI mode is “480×1280”.

odroid@odroid:~$ cat /sys/class/drm/card0-HDMI-A-1/modes
480x1280

Verify the EDID with “edid-decode” util.

odroid@odroid:~$ sudo apt install edid-decode
odroid@odroid:~$ sudo edid-decode /sys/class/drm/card0-HDMI-A-1/edid
edid-decode (hex):
 
00 ff ff ff ff ff ff 00 21 6c 00 00 00 00 00 00 
0c 1b 01 03 80 0c 21 78 ea 5e c0 a4 59 4a 98 25 
20 50 54 00 00 00 1d 80 01 01 01 01 01 01 01 01 
01 01 01 01 01 01 08 16 e0 f0 10 00 16 50 64 28 
a2 00 7d 4d 01 00 00 1e 00 00 00 ff 00 4c 69 6e 
75 78 20 23 30 0a 20 20 20 20 00 00 00 fd 00 3b 
3d 4d 4f 06 00 0a 20 20 20 20 20 20 00 00 00 fc 
00 34 38 30 78 31 32 38 30 0a 20 20 20 20 00 e1 
 
----------------
 
EDID version: 1.3
Manufacturer: HKL Model 0 Serial Number 0
Made in week 12 of 2017
Digital display
Maximum image size: 12 cm x 33 cm
Gamma: 2.20
DPMS levels: Standby Suspend Off
RGB color display
First detailed timing is preferred timing
Color Characteristics
  Red:   0.6416, 0.3486
  Green: 0.2919, 0.5957
  Blue:  0.1474, 0.1250
  White: 0.3125, 0.3281
Established Timings I & II: none
Standard Timings
    480x384    60.001 Hz   5:4    23.880 kHz  13.755 MHz (GTF)
Detailed mode: Clock 56.400 MHz, 125 mm x 333 mm
                480  580  620  720 (100  40 100)
               1280 1290 1292 1302 ( 10   2  10)
               +hsync +vsync
               VertFreq: 60.164 Hz, HorFreq: 78.333 kHz
Display Product Serial Number: Linux #0
Display Range Limits
  Monitor ranges (GTF): 59-61 Hz V, 77-79 kHz H, max dotclock 60 MHz
Display Product Name: 480x1280
Checksum: 0xe1

In the case of some specific monitor use the pixel clock that is not supported on XU4.
First of all, we should check the pixel clock of a monitor from EDID, and then we have to find the corresponding pixel clock in the code below.
https://github.com/hardkernel/linux/blob/odroid-5.4.y/drivers/gpu/drm/exynos/exynos_hdmi.c#L396-L740

Tewak your EDID

If the clock does not exist in the code you have to modify the pixel clock and some parameters in EDID.

For example, we already check the pixel clock of 480×1280 example monitor before.
The pixel clock is “56.400 MHz” and it has not supported on XU4. But you can find any clock near the “56.400 MHz” in the code.
There are two options we have, 50 Mhz and 65 MHz. We will use the 65 MHz because we prefer higher clocks than lower ones.

And you have to determine the htotal and vtotal again.
htotal = pixel clock / hfreq, 830 = 65000000/78333
vtotal = pixel clock / htotal / vfreq, 1305 = 65000000/830/60

Before we modify it

Detailed mode: Clock 56.400 MHz, 125 mm x 333 mm
                480  580  620  720 (100  40 100)
               1280 1290 1292 1302 ( 10   2  10)
               +hsync +vsync
               VertFreq: 60.164 Hz, HorFreq: 78.333 kHz

After we modify it

Detailed mode: Clock 65.0 MHz, 125 mm x 333 mm
                480  580  620  830 (100  40 100)
               1280 1290 1292 1305 ( 10   2  10)
               +hsync +vsync
               VertFreq: 60.164 Hz, HorFreq: 78.333 kHz

We have already filled the modified clock, htotal and vtotal in the google sheet.
https://docs.google.com/spreadsheets/d/1ZinXWeVa1h7nAAB0x5EGrKc0aJ45nwnsfvYC00a-rSc/edit#gid=1326610967

And the new example EDID.S file also here. https://github.com/leeseungcheol/edid-generator/blob/master/480x1280_tweaks.S

Rebuild the 480x1280_tweaks.S file and apply it again.
Finally, you can see the LCD screen.