1024x600 Display

Hi there everyone,
I’m trying to run 7" LCD display with 1024x600 resolution without success on Khadas VIM3, either on Android Pie (Vims-Pie-V200103, V200320, V200617, build from sources or ready images) and Ubuntu with kernel 4.9. Display doesn’t work also on U-Boot 2015 (hdmitx command). Display starts, but doesn’t show properly - HDMI parameters seems to be set invalid.

Display is working properly on U-Boot 2020 and Ubuntu with kernel 5.6.

As far as I can see values for registers for HDMI PLL CLOCK for 1024x600p60hz seems to be missing in kernel 4.9 and earliers:

localhost kernel: [ 3860.826498@2] hdmitx: video: already init VIC = 0 Now VIC = 773
localhost kernel: [ 3860.826503@2] hdmitx: video: rx edid only support RGB format
localhost kernel: [ 3860.826505@2] hdmitx: hdmitx: VESA only support RGB format
localhost kernel: [ 3860.826508@2] hdmitx: hw: div40: 0
localhost kernel: [ 3860.856337@0] hdmitx: ddc w1b error 0x54 0x20 0x00
localhost kernel: [ 3860.856350@0] hdmitx: frac_rate = 1
localhost kernel: [ 3860.856357@0] hdmitx: config HPLL = 4115866 frac_rate = 1
localhost kernel: [ 3860.856362@0] hdmitx: error hpll clk: 4115866
localhost kernel: [ 3860.856365@0] hdmitx: config HPLL done
localhost kernel: [ 3860.856371@0] hdmitx: set_hpll_od3_clk_div[610] div = 6
localhost kernel: [ 3860.856378@0] hdmitx: j = 16 vid_clk_div = 2
localhost kernel: [ 3860.856385@0] hdmitx: set enc for VIC: 773
localhost kernel: [ 3860.978352@0] hdmitx: hw: config hdmitx IP vic = 773 cd:4 cs: 0
localhost kernel: [ 3860.988455@0] hdmitx: video: Sink is DVI device
localhost kernel: [ 3860.989080@0] hdmitx: system: irq 80000001 0
localhost kernel: [ 3861.090336@0] hdmitx: [0x10000103]: 0x00000008
localhost kernel: [ 3861.090341@0] hdmitx: [0x10000104]: 0x00000001
localhost kernel: [ 3861.090347@0] hdmitx: [0x10000170]: 0x00000010
localhost kernel: [ 3861.090351@0] hdmitx: [0x10000180]: 0x000000ff
localhost kernel: [ 3861.090354@0] hdmitx: [0x10000181]: 0x000000ff
localhost kernel: [ 3861.090358@0] hdmitx: [0x10000182]: 0x00000003
localhost kernel: [ 3861.090362@0] hdmitx: [0x10000183]: 0x00000007
localhost kernel: [ 3861.090366@0] hdmitx: [0x10000184]: 0x0000003f
localhost kernel: [ 3861.090369@0] hdmitx: [0x10000185]: 0x00000002
localhost kernel: [ 3861.090374@0] hdmitx: [0x10000187]: 0x000000ff
localhost kernel: [ 3861.090377@0] hdmitx: [0x10000188]: 0x00000003

I see there is a 1024x600 resolution in setting_enc_clk_val_24 table in drivers\amlogic\vout\hdmitx\hdmi_tx_20\hw\hw_clk.c:

{{HDMIV_1024x600p60hz,
HDMI_VIC_END},
4115866, 4, 2, 1, VID_PLL_DIV_5, 2, 1, 1, -1},

But in set_g12a_hpll_clk_out(…) in drivers\amlogic\media\vout\hdmitx\hdmi_tx_20\hw\hw_12a.c I don’t see 4115866 clock.

I’ve tried to add values calculated by myself, but without success.

case 4115866:
hd_write_reg(P_HHI_HDMI_PLL_CNTL0, 0x3b0004ab);
hd_write_reg(P_HHI_HDMI_PLL_CNTL1, 0x0000fd3a);
hd_write_reg(P_HHI_HDMI_PLL_CNTL2, 0x00000000);
hd_write_reg(P_HHI_HDMI_PLL_CNTL3, 0x0a691c00);
hd_write_reg(P_HHI_HDMI_PLL_CNTL4, 0x33771290);
hd_write_reg(P_HHI_HDMI_PLL_CNTL5, 0x39270000);
hd_write_reg(P_HHI_HDMI_PLL_CNTL6, 0x50540000);
printk(“HPLL: 0x%lx\n”, hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
hd_set_reg_bits(P_HHI_HDMI_PLL_CNTL0, 0x0, 29, 1);
printk(“HPLL: 0x%lx\n”, hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
WAIT_FOR_PLL_LOCKED(P_HHI_HDMI_PLL_CNTL0);
printk(“HPLL: 0x%lx\n”, hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
break;

I’ve also tried to change change to values received from U-Boot 2020 (values are not hardcoded, but calculated in hdmi driver). Clock is changed to 4900000, of course I’ve changed it in setting_enc_clk_val_24:

    case 4900000:
            hd_write_reg(P_HHI_HDMI_PLL_CNTL0, 0x3b3a04a3);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL1, 0x0000aaaa);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL2, 0x00000000);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL3, 0x0a691c00);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL4, 0x33771290);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL5, 0x39270000);
            hd_write_reg(P_HHI_HDMI_PLL_CNTL6, 0x50540000);
            printk("HPLL: 0x%lx\n", hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
            hd_set_reg_bits(P_HHI_HDMI_PLL_CNTL0, 0x0, 29, 1);
            printk("HPLL: 0x%lx\n", hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
            WAIT_FOR_PLL_LOCKED(P_HHI_HDMI_PLL_CNTL0);
            printk("HPLL: 0x%lx\n", hd_read_reg(P_HHI_HDMI_PLL_CNTL0));
            break;

After listed above changes register applies and display shows “something”, but for sure it is not the expected result.

echo 1024x600p60hz > /sys/class/amhdmitx/amhdmitx0/disp_mode
[ 101.299354@0] hdmitx: video: already init VIC = 16 Now VIC = 773
[ 101.299833@0] hdmitx: video: rx edid only support RGB format
[ 101.305751@0] hdmitx: hdmitx: VESA only support RGB format
[ 101.311379@0] hdmitx: hw: div40: 0
[ 101.340577@0] hdmitx: ddc w1b error 0x54 0x20 0x00
[ 101.340622@0] hdmitx: frac_rate = 1
[ 101.343276@0] hdmitx: config HPLL = 4900000 frac_rate = 1
[ 101.349018@0] hdmitx: HPLL: 0xdb3a04a3
[ 101.352440@0] hdmitx: config HPLL done
[ 101.356063@0] hdmitx: set_hpll_od3_clk_div[643] div = 6
[ 101.361411@0] hdmitx: j = 16 vid_clk_div = 2
[ 101.368299@0] hdmitx: set enc for VIC: 773
[ 101.410566@0] hdmitx: hw: config hdmitx IP vic = 773 cd:4 cs: 0
[ 101.421123@0] hdmitx: video: Sink is DVI device
[ 101.421619@0] hdmitx: system: irq 80000001 0
[ 101.526670@0] hdmitx: [0x10000103]: 0x00000008
[ 101.526723@0] hdmitx: [0x10000104]: 0x00000001
[ 101.529928@0] hdmitx: [0x10000170]: 0x00000010
[ 101.534450@0] hdmitx: [0x10000180]: 0x000000ff
[ 101.538795@0] hdmitx: [0x10000181]: 0x000000ff
[ 101.543660@0] hdmitx: [0x10000182]: 0x00000003
[ 101.547605@0] hdmitx: [0x10000183]: 0x00000007
[ 101.552054@0] hdmitx: [0x10000184]: 0x0000003f
[ 101.556485@0] hdmitx: [0x10000185]: 0x00000002
[ 101.560867@0] hdmitx: [0x10000187]: 0x000000ff
[ 101.567929@0] hdmitx: [0x10000188]: 0x00000003

echo 1024x600p60hz > sys/class/display/mode
[ 355.682900@4] vout: vmode set to 1024x600p60hz
[ 355.689811@4] fb: current vmode=1024x600p60hz, cmd: 0x10000
[ 355.689865@4] vlock: event MODE_CHANGE_PRE 0
[ 355.694284@4] hdmitx: hdmitx_set_current_vmode[4722]
[ 355.699233@4] hdmitx: system: recalc before 1024x600p60hz 60 1
[ 355.704970@4] hdmitx: system: recalc after 1024x600p60hz 2997 50
[ 355.711285@4] hdmitx: system: get current mode: 1024x600p60hz
[ 355.716695@4] hdmitx: system: update physcial size: 150 100
[ 355.724714@4] hdmitx: video: already init VIC = 0 Now VIC = 773
[ 355.728145@4] hdmitx: video: rx edid only support RGB format
[ 355.733675@4] hdmitx: hdmitx: VESA only support RGB format
[ 355.739177@4] hdmitx: hw: div40: 0
[ 355.768613@0] hdmitx: ddc w1b error 0x54 0x20 0x00
[ 355.768670@0] hdmitx: frac_rate = 1
[ 355.771621@0] hdmitx: config HPLL = 4900000 frac_rate = 1
[ 355.777098@0] hdmitx: HPLL: 0xdb3a04a3
[ 355.780645@0] hdmitx: config HPLL done
[ 355.784151@0] hdmitx: set_hpll_od3_clk_div[643] div = 6
[ 355.789578@0] hdmitx: j = 16 vid_clk_div = 2
[ 355.794105@0] hdmitx: set enc for VIC: 773
[ 355.839034@0] hdmitx: hw: config hdmitx IP vic = 773 cd:4 cs: 0
[ 355.849693@0] hdmitx: video: Sink is DVI device
[ 355.849891@0] hdmitx: hw: set audio
[ 355.852363@0] hdmitx: hw: hdmitx tx_aud_src = 0
[ 355.856711@0] hdmitx: system: irq 80000001 0
[ 355.862634@0] hdmitx: fs = 0, cd = 4, tmds_clk = 50400
[ 355.866034@0] hdmitx: hw: aud_n_para = 6144
[ 355.870413@0] hdmitx: hw: set channel status
[ 355.874594@0] hdmitx: system: update rx hdr info 0
[ 355.879298@0] vout: new mode 1024x600p60hz set ok
[ 355.886217@0] fb: current vmode=1024x600p60hz, cmd: 0x20000
[ 355.889634@0] DOLBY: vout_notify_callback: VOUT_EVENT_MODE_CHANGE
[ 355.895552@0] vlock: event MODE_CHANGE
[ 355.901530@5] vout: vout_io_open
[ 355.902453@5] vout: vout_ioctl: cmd_dir = 0x2, cmd_nr = 0x0
[ 355.913805@5] vout: vout_io_release
[ 355.958548@0] hdmitx: [0x10000103]: 0x00000008
[ 355.958578@0] hdmitx: [0x10000104]: 0x00000001
[ 355.961783@0] hdmitx: [0x10000170]: 0x00000010
[ 355.966228@0] hdmitx: [0x10000180]: 0x000000ff
[ 355.970664@0] hdmitx: [0x10000181]: 0x000000ff
[ 355.975175@0] hdmitx: [0x10000182]: 0x00000003
[ 355.979490@0] hdmitx: [0x10000183]: 0x00000007
[ 355.983900@0] hdmitx: [0x10000184]: 0x0000003f
[ 355.988322@0] hdmitx: [0x10000185]: 0x00000002
[ 355.992840@0] hdmitx: [0x10000187]: 0x000000ff
[ 355.997167@0] hdmitx: [0x10000188]: 0x00000003

I’ve modified /vendor/etc/mesondisplay.cfg:

130|console:/vendor/etc # cat mesondisplay.cfg
MID g12b 1024 600 32 1 1024 600 32 1
busybox fbset -fb /dev/graphics/fb0 -g 1024 600 1024 600 32
busybox fbset -fb /dev/graphics/fb1 -g 1024 600 1024 600 32

I was trying adding resolution by fbset in console and changing wm size to 1024x600, but still it looks like this.

Any ideas how to solve it?

1 Like

Hi, and welcome
please continue on this specific thread…

good day !

hi, it looks like there is something with the cable connection between vim3 and the display, also note the sufficient voltage

Yes, it kind of reminds me of the touchscreen problem I had…
:thinking:

Thanks :slight_smile:
If it would be the problem with cable or power supply, why with U-Boot 2020 and Kernel 5.6 it is working?

But just to be sure, I’ve already triple checked (other cables HDMI and USB, same cable with other board, other power supply), so for sure cable and power supply is not the problem.

I’ve moved to HDMI Resolution discussion, please close this topic :slight_smile:

Khadas team will be able to do that, I will tell them here…
@numbqq, or @Frank please close this topic, Thank you

these are different situations, here you connect an additional device

Uboot 2020 and kernel 5.6 have totally different display driver with uboot 2015 and kernel 4.9.

Yes, I’ve already found that driver codes are totally different. Do you have any ideas how to add 1024x600 support to 4.9?

(I’ve moved to HDMI resolutions testing topic, I don’t know If you want to discuss here or there? :slight_smile: )

1 Like