"panel-simple.c" display driver clarification

nataut

New Member
Joined
Jun 25, 2023
Messages
2
Reaction score
0
Credits
28
Hello Everyone.

I have to write a new display driver for my embedded board. If I well understood, in the "panel-simple.c" file ("drivers/gpu/drm/panel/panel-simple.c") I have to create a new "panel_desc" struct with the new display timings/parameters. Inside the "panel_desc" structure there are two structures that can be used to descrive the display features. These structures are:
  • "drm_display_mode"
  • "display_timing"
I udersstood that can be used only one of the two but I didn't understand when choose "drm_display_mode" and when choose "display_timing". Can someone explain me the selection criteria?

Another question. The "display_timing" structure has the "display_flags" enum named "flags". The "drm_display_mode" structure has the unsigned integer named "flags". The "panel_desc" structure has the unsigned integer named "bus_flags". What is the difference between "bus_flags" (of the "panel_desc") and "flags" (of the "drm_display_mode"/"display_timing")? How to correctly setting these flags?

Many thanks
 


If you want to by-pass the user-space API and interface with some other kernel code or driver directly, you need to write a kernel module that runs in the kernel space and here, you can link against functions exported by the common kernel driver from vendor. This was just to give you a basic idea, there are a lot of underlying details that will be unveiled once you actually start writing some code interfacing with drivers.
Might want to have a look here - http://derekmolloy.ie/writing-a-linux-kernel-module-part-2-a-character-device/#Introduction
 
Hello @Lord Boltar

I explain better what I have to do. I'm working with a Yocto openSTLinux version. I have to modify my own ".dts" devicetree file to add a new 1024x600 RGB888 parallel display. I have done the following

In my ".dts" file

Code:
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>;   
};

Then I created the following "panel-simple.c" patch

Code:
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 many times the following errors

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

I don't know if I wrote a bad display driver or there are other reasons.

Thanks
 
From what I know of drm_atomic_helper errors is with the grub - but I am no expert in this area
Access the grub menu during boot-up and modify the below line as follows and see if those errors go away

GRUB_CMDLINE_LINUX_DEFAULT="intremap=off quiet splash button.lid_init_state=open"
 

Members online


Top