T30 LVDS and HDMI support with Mainline 4.14x

I am trying to get both LVDS and HDMI output in both U-boot and Linux mainline 4.14.x Kernel. I am not using X11 in Linux, just framebuffer with QT as per tezi, as I don’t need accelerated graphics.

From this, I have:
https://developer.toradex.com/knowledge-base/display-output-resolution-and-timings-linux#Tegra_2_3_based_module

vidargs=video=tegrafb0:1024x600-16@60 video=tegrafb1:1024x768-16@60

That works to turn on the HDMI after the kernel boots, but doesn’t turn on LVDS. So I tried exporting the GPIO as noted here, and setting the pins:
https://www.toradex.com/community/questions/3829/linux-kernel-262-lvds-display.html
That didn’t turn on the LVDS display.

At this point, I’ll guess I need to edit a custom U-boot and kernel device tree to support my display. Which approach should I take for this LCD, provided I want HDMI and LVDS both to come on right away in U-boot and with mainline kernel? Ive attached the equivalent WEC7 LVDS settings and display manual below.

Also, I noted that in my WEC7 build, I had to turn off audio over HDMI. Is there a setting for that on Linux as well, or is that WEC7 specific? If I didn’t do that on WEC, I couldn’t get the speaker/sound to work.

And lastly, my backlight is sort of custom control. I have to send a string of hex bytes out a serial port to set the brightness. I should probably do this for the LVDS display in the bootloader, as we don’t typically have HDMI or console access in the field. Not sure the best place to put this?

I’ve attached my equivalent T30-WEC7 registry settings that work, and user manual for the LCD.
link text

I am trying to get both LVDS and HDMI output in both U-boot

Assuming you are talking about our downstream U-Boot it only supports parallel RGB. HDMI is not supported. Mainline U-Boot would not support any graphics on T30 at all.

and Linux mainline 4.14.x Kernel. I am not using X11 in Linux, just framebuffer with QT as per tezi, as I don’t need accelerated graphics.

From this, I have: https://developer.toradex.com/knowledge-base/display-output-resolution-and-timings-linux#Tegra_2_3_based_module

vidargs=video=tegrafb0:1024x600-16@60 video=tegrafb1:1024x768-16@60

Unfortunately, in mainline the configuration is done slightly differently via so-called modesetting e.g. as may be seen here:

http://git.toradex.com/cgit/u-boot-toradex.git/tree/board/toradex/apalis_t30/apalis_t30.c?h=2016.11-toradex#n68

For parallel RGB use LVDS-1 (see ls /sys/kernel/debug/dri/0/) rather than HDMI-A-1.

That works to turn on the HDMI after the kernel boots, but doesn’t turn on LVDS.

HDMI actually uses DDC/EDID by default while parallel RGB uses the following simple-panel:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/boot/dts/tegra30-apalis-eval.dts?h=linux-4.14.y#n213

So I tried exporting the GPIO as noted here, and setting the pins: https://www.toradex.com/community/questions/3829/linux-kernel-262-lvds-display.html That didn’t turn on the LVDS display.

As per above it should default to VESA VGA. However, your display may or may not like that at all.

At this point, I’ll guess I need to edit a custom U-boot

Yes, in U-Boot it would be here:

http://git.toradex.com/cgit/u-boot-toradex.git/tree/arch/arm/dts/tegra30-apalis.dts?h=2016.11-toradex#n72

However, you would need toggling the LVDS GPIOs as well but that could even be done using gpio commands.

and kernel device tree to support my display.

First, find out whether or not there is already a simple-panel specification for it e.g.:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpu/drm/panel/panel-simple.c?h=linux-4.14.y#n1995

Which approach should I take for this LCD, provided I want HDMI and LVDS both to come on right away in U-boot

As mentioned above, U-Boot won’t support HDMI.

and with mainline kernel? Ive attached the equivalent WEC7 LVDS settings and display manual below.

I don’t know nothing about any such proprietary WEC stuff.

Also, I noted that in my WEC7 build, I had to turn off audio over HDMI. Is there a setting for that on Linux as well, or is that WEC7 specific? If I didn’t do that on WEC, I couldn’t get the speaker/sound to work.

I am not sure what exactly you are talking about here but in Linux audio via HDMI and regular I2S audio are handled by two completely independent sound cards, so I don’t see why this should matter at all.

And lastly, my backlight is sort of custom control. I have to send a string of hex bytes out a serial port to set the brightness. I should probably do this for the LVDS display in the bootloader, as we don’t typically have HDMI or console access in the field. Not sure the best place to put this?

You mean a SPI or a UART? Some backlight drivers may be found here:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/video/backlight?h=linux-4.14.y

I’ve attached my equivalent T30-WEC7 registry settings that work, and user manual for the LCD.

I quickly glanced through the manual but could not find any mentioning of the backlight other than there being some kind of an ADJ pin which usually gets connected to some PWM or the like. As for the display timing, that one looks close:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/gpu/drm/panel/panel-simple.c?h=linux-4.14.y#n1859

The backlight is not PWM, I2C or SPI. I just have to send some hex bytes over a UART. Is there a generic UART backlight driver that I could add our command to? or is there a Uboot command to send a few bytes out a uart? I’d probably prefer to build this into U-boot, because in the event of u-boot env resetting to default, we wouldn’t be able to see the screen! Same goes for LVDS configuration.

I’m having a look at your suggestions above, thanks. I’ll need some time to digest and try some things.

I translated my WEC7 LVDS registry settings into plain English. This is a working setup on our WEC7 platform. I just have to translate this to Linux mainline.

Horizontal Screen Resolution			1024
Vertical Screen Resolution			600
Frame Buffer Color Depth			32
Number of LCD Data Lines used			18
Pixel clock in Hz				65000000
Pixel Clock Polarity				Data valid on Rising Edge
Output Enable Polarity				ActiveHigh
Horizontal Sync Width in Pixels			246
Begin of Line Width (Back Porch) in Pixels	136
End of Line Width (Front Porch) in Pixels	20
Horizontal Sync Polarity			Active High
Vertical Sync Width in Lines			3
Begin of Frame Width (Back Porch) in Lines	38
End of Frame Width (Front Porch) in Lines	20
Vertical Sync Polarity				Active High	
LvdsMode					Single channel
LvdsBitMode					18 bit
LvdsMap						JEIDA

Based on my settings, U-boot would be like this?

	host1x@50000000 {
		dc@54200000 {
			rgb {
				status = "okay";
				nvidia,panel = <&lcd_panel>;
				display-timings {
					timing@0 {
						/* VESA VGA */
						clock-frequency = <65000000>;
						hactive = <1024>;
						vactive = <600>;
						hback-porch = <136>;
						hfront-porch = <20>;
						hsync-len = <246>;
						vback-porch = <38>;
						vfront-porch = <20>;
						vsync-len = <3>;

I would rather stick to typical values rather than minimal ones and the frequency should be between some odd 39 and 50 MHz according to your display’s data sheet.

I managed to get the LVDS and HDMI display to turn on with Linux kernel. I ended up rolling back, and didn’t need to do any mainline toradex kernel changes or special display timing.

What was needed was

vidargs=video=HDMI-A-1:1024x768-16@60 video=LVDS-1:1024x600-16@60
setuplvds=gpio set 216; gpio set 219; gpio set 222; gpio set 223; gpio set 226; gpio set 225; gpio set 221; gpio set 220

run setuplvds; run nfsboot

Perfect, congratulations! Just let us know should you have any further questions.

I ended up successfully adding the GPIO changes for LVDS directly into the Apalis T30-4.14 mainline device tree. Therefore, no setup is required in u-boot or shell scripts. I just added this patch in my .bbappend for the 4.14 kernel.

In case someone else needs it, here’s the patch.
download patch

Fair enough. Thanks for sharing.