Support external MIPI DSI display

Which Khadas SBC do you use?

Khadas VIM3 V12

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu

Which version of system do you use? Khadas official images, self built images, or others?

Self built image
U-Boot 2015.01
Linux version 4.9.241
Ubuntu 22.04 with gnome

Please describe your issue below:

I used to have a working VIM4 and display pair. But it broken :frowning:
Now i have VIM3 board and another display. I build image and apply patches from Support external MIPI DSI display on Android 11. It doesn’t work, I only see a gray screen.
I found information about the display, it has different settings:

MIPI CLK Speed:340Mbps(170MHZ)
H period time:1344
H back porch:160
H front porch:160
H pulse width:10
V period time:635
V back porch:23
V front porch:12
V pulse width:1

MIPI command:
regw(0x80,0x40);
regw(0x81,0xCF);
regw(0x82,0x87);
regw(0x83,0x5D);
regw(0x84,0x40);
regw(0x85,0x11);
regw(0x86,0x82); 

I change parameters in khadas-ts050-panel.dtsi:

		 lcd_2{
			model_name = "TS101";
			interface = "mipi";
			basic_setting = <1024 600 /*h_active, v_active*/
				1344 635 /*h_period, v_period*/
				8 /*lcd_bits*/
				154 86>; /*screen_widht, screen_height*/
			lcd_timing = <10 160 0 /*hs_width, hs_bp, hs_pol*/
				1 23 0>; /*vs_width, vs_bp, vs_pol*/
			clk_attr = <0xff /*fr_adj_type(0=clk, 1=htotal, 2=vtotal)*/
				0 /*clk_ss_level */
				1 /*clk_auto_generate*/
				170000000>; /*pixel_clk(unit in Hz)*/
			mipi_attr = <4 /*lane_num*/
				1000 /*bit_rate_max(MHz)*/
				0 /*factor(*100, default 0 for auto)*/
				1 /*operation_mode_init(0=video, 1=command)*/
				0 /*operation_mode_display(0=video, 1=command)*/
				2 /*
				   *video_mode_type
				   *(0=sync_pulse,1=sync_event,2=burst)
				   */
				1 /*clk_always_hs(0=disable,1=enable)*/
				0>; /*phy_switch(0=auto,1=standard,2=slow)*/

			/* dsi_init: data_type, num, data... */

			/* dsi_init: data_type, num, data... */
			dsi_init_on = <
					0x15 2	0x80 0x40
					0x15 2	0x81 0xCF
					0x15 2	0x82 0x87
					0x15 2	0x83 0x5D
					0x15 2	0x84 0x40
					0x15 2	0x85 0x11
					0x15 2	0x86 0x82

					0xff 0>; /*ending*/
			dsi_init_off = <
					0xff 0>; /*ending*/
			extern_init = <0xff>; /*0xff for invalid*/

			/* power step: type, index, value, delay(ms) */
			power_on_step = <
					4 1 1 60
					4 0 1 10
					4 0 0 10
					4 0 1 10
					2 0 0 0
					0xff 0 0 0>; /*ending*/
			power_off_step = <
					2 0 0 0
					4 0 0 0
					4 1 0 20
					0xff 0 0 0>; /*ending*/
			backlight_index = <0>;
		};

After that I saw an image with a lot of noise.


I’ve tried different time settings, only thing that gave a positive result it is a doubling of the vertical settings:
root@Khadas:/sys/class/lcd# echo "basic 1024 1200 1344 1270 8" > debug
But it’s still bad

Can you please help me, what could be the problem?

Hello @EvgenSen

Can you try to setup the resolution in file /usr/local/bin/panel_setup.sh? Changes like below:

--- /usr/local/bin/panel_setup.sh.orignal       2023-12-01 14:09:30.216785337 +0800
+++ /usr/local/bin/panel_setup.sh       2023-12-01 14:12:02.056683816 +0800
@@ -33,16 +33,16 @@
        echo panel > /sys/class/display/mode
 
        if [ $panel_type = lcd_2 ]; then
-               fbset -fb /dev/fb0 -g 1920 1200 1920 2400 32
+               fbset -fb /dev/fb0 -g 1024 600 1024 1200 32
 
-               echo "0 0 1919 1119" > /sys/class/graphics/fb0/free_scale_axis
-               echo "0 0 1919 1119" > /sys/class/graphics/fb0/window_axis
+               echo "0 0 1023 599" > /sys/class/graphics/fb0/free_scale_axis
+               echo "0 0 1023 599" > /sys/class/graphics/fb0/window_axis
 
        else
-               fbset -fb /dev/fb0 -g 1088 1920 1088 3840 32
+               fbset -fb /dev/fb0 -g 1024 600 1024 1200 32
 
-               echo "0 0 1087 1919" > /sys/class/graphics/fb0/free_scale_axis
-               echo "0 0 1087 1919" > /sys/class/graphics/fb0/window_axis
+               echo "0 0 1023 599" > /sys/class/graphics/fb0/free_scale_axis
+               echo "0 0 1023 599" > /sys/class/graphics/fb0/window_axis
        fi

And then reboot.

1 Like

I changed script. I also changed the pull-up to inversion signal, because the image was mirrored. Here is the result.


Hello @EvgenSen

Does your screen resolution is 1024x600? Are you sure all the timing you filled in dts is correct?

Does your screen resolution is 1024x600?

Yes

Are you sure all the timing you filled in dts is correct?

I’m not sure if I translated the values from the display specification into the dtsi file correctly. I’ll check again

Changing the timing settings didn’t help me.
As a result, I changed the number of lanes from 4 to 2, and the display worked correctly.