0

Am working on embedded Linux board with Apalis Imx6, am using a screen with a resolution of 1920x720p.

my device supports other resolutions but not mentioned one, i asked for support and below is answer i got.

You need to edit the "fb_videomode mxc_cea_mode[64]" constructor. You may need to refer the Monitor datasheet to input the refresh rate, resolution etc., into the file.

http://git.toradex.com/cgit/linux-toradex.git/tree/drivers/video/fbdev/mxc/mxc_edid.c?h=toradex_4.9-2.3.x-imx

i have monitor datasheet and everything, my monitor supports the needed resolution as well.

i just need to know how can i edit mxc_edid.c and save it then recompile the kernel to get my screen working.

any help really appreciated.

Thanks..

1 Answers1

1

The general guidelines for recompiling the Linux kernel on Toradex modules are described in the following article from Toradex developer website: Build U-Boot and Linux Kernel From Source Code

First you must have a cross-compilation toolchain installed, as described in Build U-Boot and Linux Kernel From Source Code - Toolchain

Specifically to your use case, you have to clone the correct iMX6 kernel branch as provided in the table from Build U-Boot and Linux Kernel From Source Code - Source Code - i.MX 6 Based Modules (Apalis/Colibri iMX6). From the link you provided in your question it seems to be toradex_4.9-2.3.x-imx. Then to obtain the kernel source-code follow Build U-Boot and Linux Kernel From Source Code - Kernel Source

After that you have to configure the kernel for Apalis iMX6, using the apalis_imx6_defconfig, as described in Build U-Boot and Linux Kernel From Source Code - Kernel Configuration - i.MX 6 based modules

Now is the time that you make the changes to the source-code file drivers/video/fbdev/mxc/mxc_edid.c.

After you finish, it's time to compíle the kernel, which is described in Build U-Boot and Linux Kernel From Source Code - Kernel Compilation - i.MX 6 Based Kernel (Apalis/Colibri iMX6). You may also need to recompile kernel modules as described in Build U-Boot and Linux Kernel From Source Code - Kernel Module Compilation, all Modules.

Finally update the kernel to the board as described in Build U-Boot and Linux Kernel From Source Code - Kernel Update.

Iterate the process of edit source code --> re-build the kernel --> re-deploy the kernel --> test changes until you nail it.


Alternatively, and possibly easier, you can edit the device-tree instead to add your display configuration.

The main reference for doing it is Device Tree Customization. Basically the device tree source comes with the kernel source, and Build U-Boot and Linux Kernel From Source Code also provide information how to compile the device tree.

Here is a code snippet highlighting relevant changes:

timing_wide: 1920x720 {
+                clock-frequency = <104600000>;
+                hactive = <1920>;
+                vactive = <720>;
+                hback-porch = <24>;
+                hfront-porch = <24>;
+                vback-porch = <8>;
+                vfront-porch = <57>;
+                hsync-len = <32>;
+                vsync-len = <5>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };

Once you adapt it to your display, build and deploy to the device as documented in Build U-Boot and Linux Kernel From Source Code.

Once the device tree is deployed to the module, you just need to set the correct vidargs in U-Boot:

env set vidargs video=mxcfb0:dev=ldb,1920x720M@60,if=RGB666 ldb=sin0 fbmem=32M
env save
reset

Notice that you don't need to rebuild U-Boot. You must have access to the module terminal via:

1) debug UART, a.k.a serial console or; 2) A monitor and USB keyboard attached to the module.

Upon reboot or power cycle, you have to press any key (from the serial terminal emulator application in your computer if using 1) or directly on the module if using 2)) to access the U-Boot environment, where you execute the commands described above.


For reference about the device tree customization, below is a diff of the relevant device-tree file for supporting a custom LVDS display (which is not your display but can be used as an example):

diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
index cfaaa571c158..b3c92314367b 100644
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -89,8 +89,8 @@
    mxcfb1: fb@0 {
        compatible = "fsl,mxc_sdc_fb";
        disp_dev = "ldb";
-       interface_pix_fmt = "RGB666";
-       default_bpp = <16>;
+       interface_pix_fmt = "RGB24";
+       default_bpp = <24>;
        int_clk = <0>;
        late_init = <0>;
        status = "disabled";
@@ -507,123 +507,135 @@
 };

 &ldb {
-   status = "okay";
-// split-mode;
-// dual-mode;
-
-   lvds-channel@0 {
-       reg = <0>;
-       fsl,data-mapping = "spwg"; /* "jeida"; */
-       fsl,data-width = <18>;
-       crtc = "ipu2-di1";
-       primary;
-       status = "okay";
-
-       display-timings {
-           native-mode = <&timing_xga>;
-           /* LDB-AM-800600LTNQW-A0H */
-           timing_svga: 800x600 {
-               clock-frequency = <55000000>;
-               hactive = <800>;
-               vactive = <600>;
-               hback-porch = <112>;
-               hfront-porch = <32>;
-               vback-porch = <3>;
-               vfront-porch = <17>;
-               hsync-len = <80>;
-               vsync-len = <4>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-           /* Standard XGA timing */
-           timing_xga: 1024x768 {
-               clock-frequency = <65000000>;
-               hactive = <1024>;
-               vactive = <768>;
-               hback-porch = <160>;
-               hfront-porch = <24>;
-               vback-porch = <29>;
-               vfront-porch = <3>;
-               hsync-len = <136>;
-               vsync-len = <6>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-           timing_wxga: 1280x800 {
-               clock-frequency = <68930000>;
-               hactive = <1280>;
-               vactive = <800>;
-               hback-porch = <64>;
-               hfront-porch = <64>;
-               vback-porch = <5>;
-               vfront-porch = <5>;
-               hsync-len = <40>;
-               vsync-len = <6>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-           /* LTTD1280800101-L4WH-CT1, note that it needs
-              fsl,data-mapping = "spwg"; fsl,data-width = <24>; */
-           timing_wxga1: 1280x800-1 {
-               clock-frequency = <71100000>;
-               hactive = <1280>;
-               vactive = <800>;
-               hback-porch = <60>;
-               hfront-porch = <60>;
-               vback-porch = <7>;
-               vfront-porch = <7>;
-               hsync-len = <40>;
-               vsync-len = <9>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-           timing_fullhd: 1920x1080 {
-               clock-frequency = <138500000>;
-               hactive = <1920>;
-               vactive = <1080>;
-               hback-porch = <80>;
-               hfront-porch = <48>;
-               vback-porch = <23>;
-               vfront-porch = <3>;
-               hsync-len = <32>;
-               vsync-len = <5>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-       };
-   };
-
-   lvds-channel@1 {
-       reg = <1>;
-       fsl,data-mapping = "spwg";
-       fsl,data-width = <18>;
-       crtc = "ipu1-di0";
-       status = "okay";
-
-       display-timings {
-/*         native-mode = <&timing_svga_ch2>;*/
-           /* LDB-AM-800600LTNQW-A0H */
-           timing_svga_ch2: 800x600 {
-               clock-frequency = <55000000>;
-               hactive = <800>;
-               vactive = <600>;
-               hback-porch = <112>;
-               hfront-porch = <32>;
-               vback-porch = <3>;
-               vfront-porch = <17>;
-               hsync-len = <80>;
-               vsync-len = <4>;
-               hsync-active = <0>;
-               vsync-active = <0>;
-               pixelclk-active = <0>;
-           };
-       };
-   };
+    status = "okay";
+     split-mode; // split mode on
+//    dual-mode;
+
+    lvds-channel@0 {
+        reg = <0>;
+        fsl,data-mapping = "spwg"; /* "jeida"; */
+        fsl,data-width = <24>;
+        crtc = "ipu2-di1";
+        primary;
+        status = "okay";
+
+        display-timings {
+            native-mode = <&timing_wide>;
+            /* LDB-AM-800600LTNQW-A0H */
+            timing_svga: 800x600 {
+                clock-frequency = <55000000>;
+                hactive = <800>;
+                vactive = <600>;
+                hback-porch = <112>;
+                hfront-porch = <32>;
+                vback-porch = <3>;
+                vfront-porch = <17>;
+                hsync-len = <80>;
+                vsync-len = <4>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+            /* Standard XGA timing */
+            timing_xga: 1024x768 {
+                clock-frequency = <65000000>;
+                hactive = <1024>;
+                vactive = <768>;
+                hback-porch = <160>;
+                hfront-porch = <24>;
+                vback-porch = <29>;
+                vfront-porch = <3>;
+                hsync-len = <136>;
+                vsync-len = <6>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+            timing_wxga: 1280x800 {
+                clock-frequency = <68930000>;
+                hactive = <1280>;
+                vactive = <800>;
+                hback-porch = <64>;
+                hfront-porch = <64>;
+                vback-porch = <5>;
+                vfront-porch = <5>;
+                hsync-len = <40>;
+                vsync-len = <6>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+            timing_fullhd: 1920x1080 {
+                clock-frequency = <138500000>;
+                hactive = <1920>;
+                vactive = <1080>;
+                hback-porch = <80>;
+                hfront-porch = <48>;
+                vback-porch = <23>;
+                vfront-porch = <3>;
+                hsync-len = <32>;
+                vsync-len = <5>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+            timing_wide: 1920x720 {
+                clock-frequency = <104600000>;
+                hactive = <1920>;
+                vactive = <720>;
+                hback-porch = <24>;
+                hfront-porch = <24>;
+                vback-porch = <8>;
+                vfront-porch = <57>;
+                hsync-len = <32>;
+                vsync-len = <5>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+        };
+    };
+
+    lvds-channel@1 {
+        reg = <1>;
+        fsl,data-mapping = "spwg";
+        fsl,data-width = <18>;
+        crtc = "ipu1-di0";
+        status = "okay";
+
+        display-timings {
+            native-mode = <&timing_wide_ch2>;
+            /* LDB-AM-800600LTNQW-A0H */
+            timing_svga_ch2: 800x600 {
+                clock-frequency = <55000000>;
+                hactive = <800>;
+                vactive = <600>;
+                hback-porch = <112>;
+                hfront-porch = <32>;
+                vback-porch = <3>;
+                vfront-porch = <17>;
+                hsync-len = <80>;
+                vsync-len = <4>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+            timing_wide_ch2: 1920x720 {
+                clock-frequency = <104600000>;
+                hactive = <1920>;
+                vactive = <720>;
+                hback-porch = <24>;
+                hfront-porch = <24>;
+                vback-porch = <8>;
+                vfront-porch = <57>;
+                hsync-len = <32>;
+                vsync-len = <5>;
+                hsync-active = <0>;
+                vsync-active = <0>;
+                pixelclk-active = <0>;
+            };
+        };
+    };
 };
lgraba
  • 101
  • 5
  • Thanks alot for your comprehensive answer.. the alternate way is the preferred one suggested by Toradex support, I just would like to know what steps i need to follow to edit the device tree to add my display configuration and then build the uboot as suggested. – Moataz Farrag Sep 26 '19 at 07:39
  • You don't need to rebuild U-Boot. You only need to recompile the device-tree. It comes with the kernel source-code and the article used in the first part of the answer provides instructions how to recompile and deploy the device tree to the module. There is also an article specifically about device tree customization: https://developer.toradex.com/device-tree-customization – lgraba Sep 26 '19 at 12:11
  • p.s. @MoatazFarrag I've edited the answer to make it more comprehensive, please check if it helps you. – lgraba Sep 26 '19 at 12:56
  • Thanks a lot for your great help and support! I do have access through another Linux pc to my board through serial console and I can access uboot and read all device info, i have now display data from display datasheet to be added inside device tree. My question here is. Can I edit device tree from uboot and add my display data then save it and recompile then modify video args to get everything working? – Moataz Farrag Sep 26 '19 at 15:05
  • awaiting your kind answer as I read the pages from Toradex for device tree customization but I didn't show what commands to use. – Moataz Farrag Sep 28 '19 at 16:32
  • Can you tell the exact version of embedded Linux you are working on? Instructions may be different depending on that. – lgraba Sep 30 '19 at 12:51
  • This is a copy of my Dmesg: https://www.dropbox.com/s/6kg5pchsuk1qit7/dmesg.txt?dl=0 – Moataz Farrag Sep 30 '19 at 22:27