Hi,
I’m using an LVDS panel with my Apalis iMX8QM V1.0B with linux-toradex-5.4-2.3.x and the Toradex 5.x.y BSP. I’ve configured the LVDS panel in the /arch/arm64/dts/freescale/imx8qm-apalis-eval.dts file, and included the resulting patch in my Yocto custom layer. The pertinent sections of the .dts file are shown below:
&panel_lvds {
status = "okay";
compatible = "panel-lvds";
backlight = <&backlight>;
data-mapping = "vesa-24";
width-mm = <152>;
height-mm = <91>;
panel-timing {
clock-frequency = <33200000>;
hactive = <800>;
vactive = <480>;
hfront-porch = <24>;
hback-porch = <96>;
hsync-len = <72>;
vfront-porch = <3>;
vback-porch = <10>;
vsync-len = <7>;
hsync-active = <0>;
vsync-active = <0>;
pixelclk-active = <0>;
};
port {
panel_lvds_in: endpoint {
remote-endpoint = <&lvds_out>;
};
};
};
&ldb2 {
status = "okay";
lvds-channel@0 {
fsl,data-mapping = "spwg";
fsl,data-width = <24>;
status = "okay";
port@1 {
reg = <1>;
lvds_out: endpoint {
remote-endpoint = <&panel_lvds_in>;
};
};
};
};
&ldb2_phy {
status = "okay";
};
With the above device tree configuration, the display only seems to work in 16-bit mode. This has been confirmed by checking the value of the bits_per_pixel file in /sys/class/graphics/fb0/bits_per_pixel.
This is particularly evident in the severe colour banding I see when using the display. For the purposes of illustrating this point, I setup a small Qt application which just displays a gradient (from red to white) across a 480x480 pixel square:
Using the Qt QSG_INFO environment variable, I can see that the R/G/B/A buffers (as used by Qt) are set to 4 4 4 0, not the 8 8 8 8 (or 8 8 8 0) I’d expect for the configured 24/32-bit panel. Note that I can use the QT_QPA_EGLFS_FORCE888 Qt environment variable, which forces RGB888 mode, and while it drastically improves the colour banding issue, it doesn’t resolve the underlying issue that my configuration appears to be wrong. If the configuration was correct, the default bits per pixel would be correctly set to 24/32, and manual intervention within Qt wouldn’t be required.
Is there anything obviously wrong with my device tree configuration? Are there any additional ‘video’ or ‘vidargs’ flags I should be using from the u-boot command line (the Toradex article ‘Display Output, Resolution and Timings (Linux)’ suggests not, stating that all iMX8 display configuration should be performed in the device tree). I’ll also mention that trying to change the fb0 mode or bits_per_pixel (i.e. echo 24 > /sys/class/graphics/fb0/bits_per_pixel) results in a ‘echo: write error: Invalid argument’ error.
One final note: I’ve used this exact display previously on an iMX6 project, and was able to configure and use it in 24/32-bit mode. As such, I don’t believe this is a hardware issue, but an issue of device tree (or other) configuration.
Thanks!