3.2.4.5. LCDC

AM335x LCDC DRM Display Driver

Introduction

This page gives a brief description of LCDC usage with tilcdc DRM driver. The obsolete fbdev driver wiki page also remains at the end of this page.

This document applies TI’s v4.4 kernel and mainline v4.9 kernel with tilcdc DRM atomic modeset support.

Generic DRM Information

What is DRM: http://dri.freedesktop.org/wiki/DRM/

What do the abbreviations KMS/GEM/DRM actually stand for: Kernel Mode Setting, Graphics Execution Manager, Direct Rendering Manager.

Where can I find DRM documentation?

Use web browser to view: Documentation/DocBook/drm.html

Hardware and How It Is Used

The LCD controller can be used in two independent modes. Either in the raster controller mode or in LCD interface display driver (LIDD) mode. The tilcdc driver support only raster controller mode.

Compared to most other DRM supported devices the LCDC provides very limited functionality. It supports only one simple framebuffer or alternatively two framebuffers that are automatically flipped back and forth. The tilcdc driver uses single buffer mode and flips framebuffer by changing the framebuffer’s DMA address. This does not interfere with the DMA of the currently drawn frame.

The LCDC supports 1-, 2-, 4-, 8-, 12-, 16-, and 24-bits per pixel modes. The 1-, 2-, 4-, and 8-bpp modes are palette modes and are not supported by the tilcdc driver. With the 12-, 16-, and 24-bit modes the choice is limited to 16 and 24 bpp modes, and the 24 bpp mode is only supported by revision 2 LCDC. There is also a problem is using 16- and 24-bit modes with same HW, see tilcdc Supported Features below.

LCDC memory bandwidth issues

LCDC sometimes suffers from memory bandwidth issues when high pixel clocks and high bits per pixel colour formats are used. These bandwidth issues manifest themselves as DMA FIFO underflow and frame synchronization lost errors. The problem is solved on Beaglebone-Black and am335x-evm with this patch. The patch is available in u-boot release version ti2017.01 (Processor SDK version 4.0) onwards. A similar u-boot change is needed for any other HW suffering from the same problem. Please check the ddr_data for am3-evm or beaglebone-black in the u-boot config. If after using the patch you still see issues, you may need to further tune the value of REG_PR_OLD_COUNT per your system need.

tilcdc Supported Features

  • RGB565 color format
  • or RGB888/XRGB8888 color formats (LCDC rev2 only)
    • The 16-bit and 24-bit video has Red and Blue wires swapped and depending on the wiring of the board ether 16-bit or 24-video is in BGR format (see section 3.1.1 in AM335x Silicon Errata)
  • Panel timings controlled from dts file
  • TDA998x HDMI encoder support on BeagleBone Black
  • Pixel clock to 126MHz allowing resolutions up to 1920x1080p24
  • Fbdev emulation is provided through /dev/fb0
  • HDMI audio support with corresponding ALSA sink (not in mainline for the time being)
  • HDMI EDID support
  • DRM Atomic modeset support since Linux 4.9 and in ti2016.04

tilcdc Unsupported Features:

  • No HDMI hotplug
  • 1920x1080@60 is not supported due to pixel clock requirements being too high for the AM335x hardware.

Configuring into kernel build:

  • By default DRM support for LCDC is not built in to the kernel when using omap2plus_defconfig.
  • Make sure that the following are disabled from .config as the fbdev driver cannot coexist with the DRM driver.
    • CONFIG_FB_DA8XX
    • CONFIG_FB_DA8XX_TDA998X
  • And add:
    • CONFIG_DRM=y/m
    • CONFIG_DRM_I2C_NXP_TDA998X=y/m
    • CONFIG_DRM_TILCDC=y/m

If using modules, it is enough to load tilcdc module, and tda998x module if using beaglebone-black. It does not matter in which order the modules are loaded.



Required Device Tree Nodes:

  • See .txt files in - Documentation/devicetree/bindings/drm/tilcdc
  • For Beaglebone-Black see also: Documentation/devicetree/bindings/display/bridge/tda998x.txt
  • The am335x-boneblack.dts, am335x-evm.dts, and am335x-evmsk.dts have the necessary nodes for LCDC DRM driver

Example Device Tree nodes to enable HDMI with DRM on BeagleBone Black:

&lcdc {
    status = "okay";

    port {
        lcdc_0: endpoint@0 {
            remote-endpoint = <&hdmi_0>;
        };
    };
};
&i2c0 {
    tda19988: tda19988 {
        compatible = "nxp,tda998x";
        reg = <0x70>;

        #sound-dai-cells = <0>;
        audio-ports = <  TDA998x_I2S 0x03>;

        ports {
            port@0 {
                hdmi_0: endpoint@0 {
                    remote-endpoint = <&lcdc_0>;
                };
            };
        };
    };
};

Examples for using DRM:

The drm userspace components and test applications are available from: http://cgit.freedesktop.org/mesa/drm/

A useful tool contained in this suite is modetest.

  • On BeagleBone Black you can use modetest to try the different resolutions that are supported by the attached monitor.
  • For example:
  • modetest –s 5:1280x720@XB24
  • Will change the HDMI output to 1280x720 – the XB24 tells modetest to use the correct pixel format of XBGR8888.

Legacy AM335x LCDC fbdev Display Driver

This driver is currently obsolete (has been since ti-linux-3.14.y), and is not actively maintained any more. Please use LCDC DRM driver instead.

Introduction:

  • Where can I find fbdev documentation:

See Documentation/fb/framebuffer.txt Or online at: https://www.kernel.org/doc/Documentation/fb/framebuffer.txt

LCDC fbdev Supported Features:

  • RGB32 pixel format (XBGR32 format)
  • Panel timings controlled from dts file
  • TDA998x HDMI encoder support on BeagleBone Black
  • Pixel clock to 126MHz allowing resolutions up to 1920x1080p24
  • Access to driver and framebuffer is through /dev/fb0

LCDC fbdev Unsupported Features:

  • No HDMI audio support in fbdev driver
  • No HDMI EDID support
  • No HDMI hotplug

Configuring into kernel build:

  • The necessary .config options are:
    • CONFIG_FB_DA8XX
    • CONFIG_FB_DA8XX_TDA998X

Required Device Tree Nodes (no HDMI)

  • See Documentation/devicetree/bindings/video/da8xx_fb.txt

Required Device Tree Nodes (with HDMI)

  • See arch/arm/boot/dts/am335x-boneblack.dts for complete example of how to use.
&i2c0 {
   hdmi1: hdmi@70 {
        compatible = "nxp,tda998x";
        reg = <0x70>;
  };
};

&lcdc {
   hdmi = <&hdmi1>;
   display-timings {
        /* provide your display timings here for HDMI */
   };
};