mxc_edid.c、嵌入式 Linux 支持 1920x720

1920x720 support in mxc_edid.c, Embedded Linux

我正在使用 Apalis Imx6 开发嵌入式 Linux 开发板,我使用的是分辨率为 1920x720p 的屏幕。

我的设备支持其他分辨率,但没有提到一个,我寻求支持,下面是我得到的答案。

您需要编辑 "fb_videomode mxc_cea_mode[64]" 构造函数。您可能需要参考显示器数据表以将刷新率、分辨率等输入到文件中。

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

我有显示器数据表和所有东西,我的显示器也支持所需的分辨率。

我只需要知道如何编辑 mxc_edid.c 并保存它然后重新编译内核以使我的屏幕正常工作。

非常感谢任何帮助。

谢谢..

在 Toradex 模块上重新编译 Linux 内核的一般指南在 Toradex developer website 的以下文章中有所描述: Build U-Boot and Linux Kernel From Source Code

首先你必须安装交叉编译工具链,如Build U-Boot and Linux Kernel From Source Code - Toolchain

中所述

具体到您的用例,您必须从 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

中克隆 table 中提供的正确的 iMX6 内核分支

之后,您必须使用 apalis_imx6_defconfig 为 Apalis iMX6 配置内核,如 Build U-Boot and Linux Kernel From Source Code - Kernel Configuration - i.MX 6 based modules

中所述

现在是您对源代码文件进行更改的时候了 drivers/video/fbdev/mxc/mxc_edid.c.

完成后,就可以编译内核了,这在 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 中有描述。

最后按照Build U-Boot and Linux Kernel From Source Code - Kernel Update.

中的描述更新内核到开发板

重复edit source code --> re-build the kernel --> re-deploy the kernel --> test changes的过程,直到搞定。


或者,您可以编辑设备树来添加显示配置,这可能更简单。

主要参考设备树自定义。基本上设备树源码是内核源码自带的,Build U-Boot and Linux Kernel From Source Code也提供了如何编译设备树的信息。

这是突出显示相关更改的代码片段:

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>;
+            };

根据 Build U-Boot and Linux Kernel From Source Code.

中的说明,根据您的显示进行调整后,构建并部署到设备

将设备树部署到模块后,您只需在 U-Boot 中设置正确的 vidargs:

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

请注意,您不需要重建 U-Boot。您必须通过以下方式访问模块终端:

1) 调试 UART,a.k.a 串行控制台或; 2) 显示器和 USB 键盘连接到模块。

重新启动或重启时,您必须按任意键(如果使用 1,则从计算机中的串行终端仿真器应用程序)或如果使用 2),则直接在模块上)访问 U-Boot 环境,其中您执行上述命令。


关于设备树定制的参考,下面是支持自定义 LVDS 显示器的相关设备树文件的差异(这不是您的显示器,但可以用作示例):

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>;
+            };
+        };
+    };
 };