cancel
Showing results for 
Search instead for 
Did you mean: 

Display customization

nataut
Associate III

Hi All,

In my currently yocto image I want to customize a LCD TFT RGB 7" 1024x600 24bpp display. At the moment, I have a dts patch file where there are all image customizations. In this file the currently display settings (LCD TFT RGB 7" 800x480) are the following 

panel_rgb: panel-rgb {             

compatible = "ampire,am800480r3tmqwa1h";   

status = "okay";               

power-supply = <&lcd_3v3>;          

//backlight = <&panel_backlight>;       

bits-per-pixel = <16>;            

bus-width = <18>;               

//data-shift = <0>;

                        

display-timings {               

native-mode = <&timing0>;       

timing0: timing0 {          

clock-frequency = <33300000>;     

hactive = <800>;          

vactive = <480>;          

hfront-porch = <210>;        

hback-porch = <46>;         

hsync-len = <46>;          

vback-porch = <23>;         

vfront-porch = <22>;        

vsync-len = <23>;          

hsync-active = <0>;         

vsync-active = <0>;         

de-active = <0>;          

pixelclk-active = <1>;       

                        

};                     

The new display don't use HSINK and VSINK but DE only.

First question: I don't understand how to manage the "compatible" property. Is this property needed? What I have to write in the "compatible" property if my new display is not in the linux devicetree official list? 

Second question: what is the difference between "bit-per-pixel" and "bus-width"? In my case all RGB data lines (R0-R7; B0-B7; G0-G7) are used. I tried to set

bits-per-pixel = <24>

bus-width = <24>

but I have a sintax error

Below, in my opinion, the new display settings based on the display datasheet 

panel_rgb: panel-rgb {                                                    

compatible = "ampire,am800480r3tmqwa1h";                                          

status = "okay";                                                      

power-supply = <&lcd_3v3>;                                                 

backlight = <&panel_backlight>;                                             

bits-per-pixel = <24>;

bus-width = <24>;

data-shift = <0>;

                                                               

display-timings {                                                     

native-mode = <&timing0>;                                             

timing0: timing0 {                                                 

clock-frequency = <51200000>; 

hactive = <1024>;    

vactive = <600>;     

hfront-porch = <0>;   

hback-porch = <0>;    

hsync-len = <320>;    

vback-porch = <0>;    

vfront-porch = <0>;   

vsync-len = <35>;    

hsync-active = <0>;   

vsync-active = <0>;     

de-active = <1>;      

pixelclk-active = <1>;                                              

The build fails with "sintax error"

Any suggestions?

Many thanks

8 REPLIES 8
Erwan SZYMANSKI
ST Employee

Hello @nataut​ ,

Different things to say concerning your message.

First, let's talk about compatible. You have usually 3 cases when you want to add your own display in the Linux device tree.

1) your panel already have a linux driver (/drivers/gpu/drm/panel) and then the compatible should be aligned with the one included in this driver.

2) your panel does not have its own driver, and you want to create it by yourself from scratch, or from an already public project from someone who already used the same panel as yours (with some luck).

3) your panel does not have its own driver, and you decide to use panel-simple.c driver to control it. This is the most common case.

Secondly, your syntax error raised is probably due, as it says, to a syntax error in your DT. You can put me your complete DTS attached here.

Finally, I see that a lot of timings are set to 0 concerning hfront-porch, hsync etc... This is very strange, I do not see how your panel will be able to work like this. But I have a very good solution for you ! Please take a look at the very well done presentation from Bootlin, concerning Graphics on Linux here. I advice you to read it of course, as it is very well done and interesting, but you can also jump on slide 81 to see how to calculate the different timings, thanx to your panel documentation !

I hope that this information will help you.

Kind regards,

Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
nataut
Associate III

Hello @erwan SZYMANSKI​ 

Thank you for your answer and useful suggestions.

I found the sintax problem. In the ".patch" file there was a semi colon instead a comma. Now the build work fine. 

Regard to display timings, in my case the display works in "DE mode". If I well understood in this working mode the HSINK e VSINK signals are internally generated by the display, is this correct? If this is correct, I don't know if the HSINK and VSINK signals have to be managed by the LCD controller or have to be set as I/O pins.  

Regard to hfront-pork, hback-pork, vfront-pork, vback-pork timings value, the display datasheet doesn't indicate any value for this timings if the "DE mode" is set (see image below) so I set them to 0.


_legacyfs_online_stmicro_images_0693W00000bkvXMQAY.png

Hello @nataut​,

Anyway for the timings. In the worst case, if they are bad, you will be able to change it after easily in the DT. I think the first step for you is to ensure that you are able to probe properly your panel, and that you can detect it from the Linux world.

As soon as this step is successful, if you have timing issue, you will see artifact or bad rendering on the screen, but it will mean that the Linux Graphic stack/framework has everything properly configured to work.

Kind regards,

Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello @Erwan SZYMANSKI 

Regard to my own display (JENSON model JT60396-01) customization, I want to try your suggestion number 3),  that is, modify the panel-simple.c driver.

If I have understood correctly, in the panel-simple.c driver I have to do the following:

  • create a new structure drm_display_mode or display_timing (which one?)
  • create a new structure panel_desc
  • modify the structure of_device_id platform_of_match[] adding the new .compatible and .data property

is it right?

What is the difference between drm_display_mode structure and display_timing structure? Which one to use? Supposing to choice the drm_display_mode structure, in panel-simple.c driver I added the following two structures 

first structure

static const struct drm_display_mode jenson_1024x600jt60396_01_mode = {
	.clock = 51200,
	.hdisplay = 1024,
	.hsync_start = 1024 + 0,
	.hsync_end = 1024 + 0 + 320,
	.htotal = 1024 + 0 + 320 + 0,
	.vdisplay = 600,
	.vsync_start = 600 + 0,
	.vsync_end = 600 + 0 + 35,
	.vtotal = 600 + 0 + 35 + 0,
	.vrefresh = 60,
	.flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
};

 second structure

static const struct panel_desc jenson_1024x600jt60396_01 = {
	.modes = &jenson_1024x600jt60396_01_mode,
	.num_modes = 1,
	.bpc = 8,
	.size = {
		.width = 154,
		.height = 85,
	},
	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,

then in the of_device_id platform_of_match[] structure I added the following part

{
  .compatible = "jenson,jt60396-01",
  .data = &jenson_jt60396_01,
}

A this point, the last operation is to add the following code in the devicetree configuration file 

panel_rgb: panel-rgb {
	compatible = "jenson,jt60396-01";
	status = "okay";
	power-supply = <&lcd_3v3>;
	backlight = <&panel_backlight>;
	bits-per-pixel = <24>;
	bus-width = <24>;
	data-shift = <0>;	
};

  It is right?

Attached the display datasheet

Thanks

I correct myself.

in the of_device_id platform_of_match[] structure I added the following part

{
  .compatible = "jenson,jt60396-01",
  .data = &jenson_1024x600jt60396_01,
}

 

This is the panel-simple.c patch that I created

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 654fea2..4216a48 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1439,6 +1439,32 @@ static const struct panel_desc innolux_zj070na_01p = {
 	},
 };
 
+static const struct drm_display_mode jenson_1024x600jt60396_01_mode = {
+	.clock = 51200,
+	.hdisplay = 1024,
+	.hsync_start = 1024 + 0,
+	.hsync_end = 1024 + 0 + 320,
+	.htotal = 1024 + 0 + 320 + 0,
+	.vdisplay = 600,
+	.vsync_start = 600 + 0,
+	.vsync_end = 600 + 0 + 35,
+	.vtotal = 600 + 0 + 35 + 0,
+	.vrefresh = 60,
+	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc jenson_1024x600jt60396_01 = {
+	.modes = &jenson_1024x600jt60396_01_mode,
+	.num_modes = 1,
+	.bpc = 8,
+	.size = {
+		.width = 154,
+		.height = 85,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+
+};
+
 static const struct display_timing koe_tx31d200vm0baa_timing = {
 	.pixelclock = { 39600000, 43200000, 48000000 },
 	.hactive = { 1280, 1280, 1280 },
@@ -2480,6 +2506,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "innolux,zj070na-01p",
 		.data = &innolux_zj070na_01p,
 	}, {
+		.compatible = "jenson,jt60396-01",
+		.data = &jenson_1024x600jt60396_01,
+	}, {
 		.compatible = "koe,tx31d200vm0baa",
 		.data = &koe_tx31d200vm0baa,
 	}, {

The build process ends correctly and the /drivers/gpu/drm/panel/panel-simple.c file seems to be correctly changed by the patch.but, despite that, the boot log shows the following errors 

[   74.729750] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:32:crtc-0] flip_done timed out
[   84.969742] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:29:DPI-1] flip_done timed out
[   95.209739] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

and the display screen is black.

Any suggestion?

nataut
Associate III

I created the following patch

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 654fea2..4216a48 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1439,6 +1439,32 @@ static const struct panel_desc innolux_zj070na_01p = {
 	},
 };
 
+static const struct drm_display_mode jenson_1024x600jt60396_01_mode = {
+	.clock = 51200,
+	.hdisplay = 1024,
+	.hsync_start = 1024 + 0,
+	.hsync_end = 1024 + 0 + 320,
+	.htotal = 1024 + 0 + 320 + 0,
+	.vdisplay = 600,
+	.vsync_start = 600 + 0,
+	.vsync_end = 600 + 0 + 35,
+	.vtotal = 600 + 0 + 35 + 0,
+	.vrefresh = 60,
+	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc jenson_1024x600jt60396_01 = {
+	.modes = &jenson_1024x600jt60396_01_mode,
+	.num_modes = 1,
+	.bpc = 8,
+	.size = {
+		.width = 154,
+		.height = 85,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+
+};
+
 static const struct display_timing koe_tx31d200vm0baa_timing = {
 	.pixelclock = { 39600000, 43200000, 48000000 },
 	.hactive = { 1280, 1280, 1280 },
@@ -2480,6 +2506,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "innolux,zj070na-01p",
 		.data = &innolux_zj070na_01p,
 	}, {
+		.compatible = "jenson,jt60396-01",
+		.data = &jenson_1024x600jt60396_01,
+	}, {
 		.compatible = "koe,tx31d200vm0baa",
 		.data = &koe_tx31d200vm0baa,
 	}, {

the build process ends correctly, the drivers/gpu/drm/panel/panel-simple.c file seems to be correctly patched but, despite that, the boot log shows the following errors

[  144.489781] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:32:crtc-0] flip_done timed out
[  154.729834] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:29:DPI-1] flip_done timed out
[  164.969889] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

 and the display screen doesn't show anything

Any suggestion?

Thanks

nataut
Associate III

I created the following patch for the panel-simple.c

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 654fea2..8e4234f 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1439,6 +1439,31 @@ static const struct panel_desc innolux_zj070na_01p = {
 	},
 };
 
+static const struct drm_display_mode jenson_1024x600jt60396_01_mode = {
+	.clock = 51200,
+	.hdisplay = 1024,
+	.hsync_start = 1024 + 0,
+	.hsync_end = 1024 + 0 + 320,
+	.htotal = 1024 + 0 + 320 + 0,
+	.vdisplay = 600,
+	.vsync_start = 600 + 0,
+	.vsync_end = 600 + 0 + 35,
+	.vtotal = 600 + 0 + 35 + 0,
+	.vrefresh = 60,
+	.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc jenson_1024x600jt60396_01 = {
+	.modes = &jenson_1024x600jt60396_01_mode,
+	.num_modes = 1,
+	.bpc = 8,
+	.size = {
+		.width = 154,
+		.height = 85,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+};
+
 static const struct display_timing koe_tx31d200vm0baa_timing = {
 	.pixelclock = { 39600000, 43200000, 48000000 },
 	.hactive = { 1280, 1280, 1280 },
@@ -2480,6 +2505,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "innolux,zj070na-01p",
 		.data = &innolux_zj070na_01p,
 	}, {
+		.compatible = "jenson,jt60396-01",
+		.data = &jenson_1024x600jt60396_01,
+	}, {
 		.compatible = "koe,tx31d200vm0baa",
 		.data = &koe_tx31d200vm0baa,
 	}, {

the build process ends correctly but the boot log shows the following errors

[11066.089809] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:32:crtc-0] flip_done timed out
[11076.329852] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:29:DPI-1] flip_done timed out
[11086.569810] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out

and the display screen doesn't show anything

Any suggestion?

Regards