Other Parts Discussed in Thread: DS90C385A
Tool/software: Linux
I’m having a problem getting LVDS video working.
Background:We’ve got a custom AM335x board that supports LVDS and HDMI video output (note: we use only one of these two video outputs at a time based on which product the board is placed in – there is no need to be able to switch between outputs; EDIT: we don't even have a configuration for HDMI in the device tree when using LVDS). We’ve had HDMI working for a while and are now trying to get LVDS to work.
The CPU’S LCD video pins go to three mux chips (one for the red pins and video control signals – e.g. vsync – one for the green pins, and one for blue pins), and then the mux is switched to send the video signals to either an LVDS transmitter chip or an HDMI transmitter chip. The upshot of this is that the LCD pin mappings out of the CPU are the same for both HDMI and LVDS.
The Problem:Display timing appears to be set correctly in the device tree – the simple QT GUI I’m displaying for testing is steady and positioned correctly – but I appear to be having color issues. More specifically:
- Red and blue are swapped.
- The LVDS display wants RGB888, and the data path between the CPU and LVDS display is wired for this. I’ve put some prints into the DRM and TILCDC code, and it’s reporting a pixel format of DRM_MODE_RGB888. But not only are red and blue swapped, it appears that something is set for 6-bit color depth (maybe RGB565?).
I know the above because using my test GUI, I had Qt ramp the red channel of the window background from 0-255, but instead of seeing a steadily brightening red color, I saw a blue that brightened as the value stepped from 0 – 63, then went black at 64, ramped in brightness to 127, went black at 128, ramped until 191, black at 192, and then ramped up until 255.
At this point, I should mention that I’m aware of the AM335x LCD pin errata for red and blue pins being swapped when using 24 bpp (see AM335x errata document at https://tinyurl.com/y8y48dk9, page 8) and that our board has swapped the red and blue pins as described in the document to support RGB888 on the HDMI display. Given that video sent to our HDMI display is displaying correctly, I think the swap was done correctly (and our schematic bears this out).
I’ve spent several days messing around with this and can provide various information that any responders may want, but I’ll start with the following.
Device Tree:
Relevant device tree nodes.
panel {
compatible = "ti,tilcdc,panel";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&lcd_pins_default>;
/*pinctrl-1 = <&lcd_pins_sleep>;*/
status = "okay";
panel-info {
ac-bias = <255>;
ac-bias-intrpt = <0>;
dma-burst-sz = <16>;
bpp = <24>;
fdd = <0x80>;
sync-edge = <0>;
sync-ctrl = <1>;
raster-order = <0>;
fifo-th = <0>;
};
display-timings {
800x600 {
clock-frequency = <40000000>;
hactive = <800>;
vactive = <600>;
hfront-porch = <40>;
hback-porch = <88>;
hsync-len = <128>;
vback-porch = <23>;
vfront-porch = <1>;
vsync-len = <4>;
hsync-active = <1>;
vsync-active = <1>;
de-active = <1>;
pixelclk-active = <1>;
};
};
};
&lcdc {
status = "okay";
};
Note: I’ve omitted the pinctrl mapping.
I also tried setting bpp in the device tree to 16, just for giggles, and saw no difference in the behavior.
Modetest:
Another thing that’s going on is that the LVDS display does not show any video at all until I run modetest at least once. This was not needed when using the HDMI display.
Speaking of modetest, I’ve also used it to display its color bar test image. This shows up fine when using the HDMI display, but when using the LVDS display, not only are the colors off (as expected based on the other color problems I’m seeing) but the color bars are appear to be offset to the bottom of the screen, with only a small portion of the showing. This would imply that maybe the display resolution or timing is not correct, but when I display my Qt test GUI, which is specially sized for the display, everything appears in the correct location.
There is some other information I could relate – some things I’m seeing in driver printing that don’t make sense to me, but given that I’m completely unfamiliar with the DRM video subsystem, and thus don’t really know if what I think is wrong is actually wrong, I’ll hold off on that for now.
Any help would be greatly appreciated.