1. Introduction to LCD
    1. Overview of LCD
      1. LCD Panel
      2. Pixel
      3. Resolution
      4. Pixel Format
      5. PPI
      6. Types of LCD Interfaces
      7. DBI, DPI, and DSI interface categories
    2. LCD touch screen composition
    3. Display Controller
      1. Basic Concept of Display Controller
      2. Introduction to VOP
        1. VOP1
        2. VOP2
          1. Connector-mirror Technology
          2. VOP-split technology
      3. Glossary
    4. LCD Timing
      1. Glossary
      2. Timing
      3. LCD Timing Example
  2. RGB Screen Porting
    1. RGB Interface Introduction
    2. Synchronization Mode
      1. DE Mode
      2. HV Mode
    3. Hardware Schematic Analysis
    4. Adaptation Steps
      1. Configure RGB Display Path
      2. Set screen information
      3. Setting Backlight
      4. Setting up touch
      5. Set screen LOGO
      6. Set the macro switch
  3. LVDS Screen Porting
    1. Interface Introduction
    2. Introduction to LVDS screens
    3. Hardware Schematic Analysis
    4. Adaptation Steps
      1. Setting the LVDS Display Path
      2. Set screen information.
      3. Set backlight and touch
      4. Set screen LOGO
      5. Set macro switch
  4. MIPI screen porting
    1. MIPI interface introduction
    2. Introduction to MIPI Protocol
      1. lane
      2. Introduction to MIPI D-PHY
      3. MIPI DSI
        1. PHY Layer
        2. Channel Management Layer
        3. Protocol layer
          1. Short packet format
          2. Long packet format
          3. Packet transmission method
      4. Video Mode and Command Mode
        1. Video Mode
          1. Three Transmission Methods of Video Mode
        2. Command Mode
    3. Hardware Schematic Analysis
    4. Adaptation Steps
      1. Set MIPI Display Path
      2. Set screen information
      3. MIPI Initialization Sequence
      4. Set backlight and touch
      5. Set screen LOGO
  5. HDMI screen porting
    1. HDMI interface introduction
      1. Background of Birth
      2. Development History of HDMI
      3. HDMI interface pin definitions
      4. RK3568 HDMI Interface
      5. Bandwidth calculation
    2. Introduction to TMDS differential signaling
    3. EDID Introduction
    4. Hardware Schematic Analysis
    5. Adaptation Steps
  6. eDP Screen Porting
    1. Introduction to eDP Interface
    2. Adaptation steps
  7. VGA Screen Porting
    1. VGA Interface Introduction
    2. Hardware schematic analysis
    3. Adaptation Steps
Cover image for Linux LCD

Linux LCD


Timeline

Timeline

2026-02-17

init

This article introduces the basic hardware knowledge related to Linux LCD driver development, outlines the principles of liquid crystal displays and their differences from CRT and OLED, compares in detail the characteristics and application scenarios of LCD panel technologies such as TFT, TN, IPS, VA, and SLCD, and explains the basic concepts of pixels and resolution.

Linux Driver Notes

Table of ContentsLinks
1. Linux Driver Framework
2. Linux Driver Loading Logic
3. Character Device Basics
4. Concurrency and Competition
5. Advanced Character Device Progression
6. Interrupts
7. Platform Bus
8. Device Tree
9. Device Model
10. Hot Plug
11. pinctrl Subsystem
12. gpio Subsystem
13. Input Subsystem
14. Single Bus
15. I2C
16. SPI
17. UART
18. PWM
19. RTC
20. Watchdog
21. CAN
22. Network Device
23. ADC
24. IIO
25. USB
26. LCD

Introduction to LCD

Overview of LCD

LCD stands for Liquid Crystal Display.

Liquid crystal is a special substance between solid and liquid. Under the influence of an electric field, the arrangement of liquid crystal molecules changes, thereby affecting its optical properties.

LCD is also one of the commonly used peripherals. It can display images and interfaces, and with touch or a mouse, it enables human-computer interaction. For example, common computer screens and phone screens in daily life all feature LCD.

Before the popularity of LCD monitors, CRT monitors were the mainstream display devices, commonly known as ‘big-head’ monitors.

This type of monitor is rarely seen today. CRT stands for ‘Cathode Ray Tube’, which uses cathode ray tube technology to display images.

A CRT monitor mainly consists of five key components:

  1. Electron Gun for emitting electron beams
  2. Deflection Coils for controlling the direction of the electron beam
  3. Shadow Mask for precisely focusing the electron beam
  4. Graphite electrode providing high-voltage support
  5. And the phosphor layer coated on the inner wall of the screen and the glass shell.

These components work together to convert electronic signals into visible images.

In addition to LCD, more advanced OLED screens have emerged today. For example, many flagship phones now use OLED screens.

OLED stands for ‘Organic Light-Emitting Diode,’ and its display principle differs from traditional LCD:

OLED does not require a backlight; instead, it uses a very thin coating of organic materials and a glass substrate (or flexible substrate). When current passes through, these organic materials emit light on their own.

LCD Panel

LCD can be subdivided into TFT, TN, IPS, VA, and SLCD, each representing different liquid crystal panel technologies. These technologies have their own unique characteristics and application scenarios. The specific description of each technology is as follows:

Technology NameFull NameDescription
TFTThin Film TransistorTFT displays are the mainstream display devices for various laptops and desktop computers. Each liquid crystal pixel is driven by a thin-film transistor integrated behind the pixel, making it an active matrix liquid crystal display device. TFT displays offer advantages such as high responsiveness, high brightness, and high contrast, with display quality close to that of CRT monitors, making them one of the high-end products among LCD color displays.
TNTwisted NematicTN panels are entry-level liquid crystal panels, widely used in mid-to-low-end LCD monitors due to their low production cost. Although their performance is basic, their low cost makes them one of the mainstream choices in the market.
IPSIn-Plane SwitchingIPS technology, developed by Hitachi in 1996, is a wide-viewing-angle liquid crystal display technology. Compared to TN screens, IPS effectively improves color shift issues when viewing from different angles and is widely used in the manufacturing of LCD TVs and tablet computers, providing superior display quality.
VAVertical AlignmentVA panels are a liquid crystal panel technology that balances the advantages of TN and IPS, offering high contrast and good color performance at a moderate price. Their drawback is slower response time, and they are typically used in mid-to-high-end monitors and scenarios with certain image quality requirements, such as home theater displays.
SLCDSplice Liquid Crystal DisplaySLCD is a high-end derivative of LCD, using industrial-grade liquid crystal panels with a lifespan of up to 60,000 hours. It can be used as a standalone display or spliced into a large screen, serving as a complete splicing display unit suitable for high-end display needs.

IPS, VA, and TN panels each have their own advantages and disadvantages.

  • In terms of color and color accuracy, IPS performs best, followed by VA, and then TN;
  • In terms of response time, TN panels are the fastest, followed by IPS, with VA being the slowest;
  • In terms of viewing angles, IPS performs best, followed by VA, with TN being the worst;
  • In terms of contrast, VA panels are the strongest, IPS is in the middle, and TN is the weakest.

Overall, different panel types have their own characteristics across various indicators, and the appropriate panel can be chosen based on needs.

Pixel

Using the control principle of liquid crystals, a display structure can be designed to adjust the output intensity of the three colors: red, green, and blue. Combining these three display structures into a single display unit, by precisely controlling the brightness of each color, the unit can present different colors. Such a display unit is called a ‘pixel’.

Therefore, a pixel can be likened to a small RGB light, and since RGB are the three primary colors of light, they can be mixed to produce any color.

Resolution

If a screen has a resolution of 1920x1080, then there are 1920x1080=2,073,600 pixels in total. So resolution is the number of pixels that make up the screen.

Generally speaking, the higher the resolution, the better the display effect, but resolution is not the only criterion. Screen brightness, color accuracy, and viewing angle are also important parameters that affect the display quality.

Pixel
Pixel

For example, in the image above, the horizontal axis is X and the vertical axis is Y. If it represents a 1920x1080 resolution screen, then there are 1920 pixels in the X-axis direction and 1080 pixels in the Y-axis direction. It can be seen that the higher the resolution, the better the screen display effect. It is an important parameter for measuring screen display quality.

Pixel Format

A pixel is similar to a small RGB light, and RGB are the three primary colors of light that can form any color. So by controlling the brightness of these three colors, any color can be displayed. How then do we control the brightness of the RGB colors?

The three RGB colors generally use 8-bit data each, so a pixel is 8 bits x 3 = 24 bits. This pixel format is called RGB888. It can display((28)×(28)×(28))\left(\left(2^8\right) \times \left(2^8\right) \times \left(2^8\right)\right)colors.

Besides the RGB888 pixel format, there are also RGB565, RGB666, etc. Namely:

  • RGB565: R-5bit, G-6bit, B-5bit, can display((25)×(26)×(25))\left(\left(2^5\right) \times \left(2^6\right) \times \left(2^5\right)\right)colors.
  • RGB555: R-5bit, G-5bit, B-5bit, can display((25)×(25)×(25))\left(\left(2^5\right) \times \left(2^5\right) \times \left(2^5\right)\right)colors.

Does that mean a screen with a larger pixel format is better?

Suppose there is a screen with a resolution of 1920x1080. If a 24-bit pixel format is used, the required bandwidth is 1920x1080x24, but if a 16-bit pixel format is used, the required bandwidth is 1920x1080x16. It can be seen that:

The larger the pixel format, the greater the required bandwidth, so the choice of pixel format is limited by interface bandwidth, processor capability, etc.

PPI

PPI stands for Pixels Per Inch, indicating the number of pixels per inch. The PPI calculation formula is as follows:

PPI=X2+Y2屏幕尺寸\text{PPI} = \frac{\sqrt{X^2 + Y^2}}{\text{屏幕尺寸}}

From the calculation formula, it can be seen that when calculating screen PPI, the diagonal length in inches is used as the unit of measurement.

For example, a 10-inch screen with a resolution of 2400x1080 has a calculated PPI of 263, while a screen with the same resolution but 8 inches in size has a calculated PPI of 329, so the latter naturally has better display detail.

Types of LCD Interfaces

There are many types of LCD interfaces. Common ones in embedded systems include RGB, MIPI, LVDS, and eDP interfaces, while common ones in monitors include DP, HDMI, VGA, etc. A brief introduction to each interface is as follows:

Interface NameDescription
RGBParallel digital interface, uses TTL level to transmit red, green, and blue signals, commonly used in early LCD screens and embedded displays.
MIPIHigh-speed serial digital interface, designed specifically for mobile devices (such as phones/tablets), uses differential signal transmission, features low power consumption, and supports high resolution.
LVDSLow-voltage differential serial digital interface with strong anti-interference capability, widely used in mid-to-high-end screens such as laptops and monitors.
EDPEmbedded DisplayPort interface, based on high-speed serial digital transmission with rates far exceeding LVDS, suitable for high-resolution laptops, tablets, and professional monitors.
VGAAnalog signal interface, transmitting via RGBHV signals, with strong compatibility but limited resolution, gradually being replaced by digital interfaces.
HDMIFully digital audio/video interface, supporting high resolution and synchronized audio transmission, widely used in TVs, monitors, and consumer electronics.

DBI, DPI, and DSI interface categories

DBI, DPI, and DSI interfaces are another classification of screen interfaces by the MIPI Alliance’s Display Working Group (DWG), and they do not conflict with the previously mentioned RGB, MIPI, LVDS, eDP, etc., interfaces.

  • The DBI interface, also known as MCU interface or 8080 interface, stands for Display Bus Interface. It can transmit control commands and data via a parallel interface, and refresh the screen by updating data in the LCD module’s built-in GRAM.

  • DPI stands for Display Pixel Interface, which is a parallel interface. For example, the previously mentioned RGB interface can be classified as a DPI interface.

  • DSI stands for Display Serial Interface, which is a serial interface for image output defined by the MIPI Alliance.

LCD touch screen composition

In embedded development, commonly used LCD screens mostly come with touch functionality, enabling human-machine interaction through touch operations. Note that the LCD and touch screen are two independent components with different functions. The LCD screen is primarily responsible for displaying images and content, while the touch part focuses on detecting user touch input and implementing interactive control.

The LCD screen part is as follows:

LCD screen
LCD screen

LCD touch component:

LCD touch component
LCD touch component

Some LCDs are a single piece, not composed of two parts as explained above. This is because the LCD and touch panel are bonded together to form a module that can both display content and support touch operations.

Depending on the bonding method, common processes are divided into full lamination and air bonding:

  • Full lamination is typically used in consumer products, with the advantage of a thinner module;
  • Air bonding, on the other hand, is more often used in industrial scenarios, offering higher reliability and durability.

LCD screens usually require an adapter board to connect to the development board. It is important to note that in the embedded field, there is no unified standard for LCD screen interfaces, and pin assignments may vary between manufacturers. Therefore, when connecting the screen, carefully verify the pin assignments to avoid the risk of damaging the screen, development board, or core board due to mismatched wiring.

Display Controller

Basic Concept of Display Controller

A display controller, also known as LCDC (short for LCD Controller), is primarily responsible for transferring image data from memory to the display device.

With continuous technological development, the functions of display controllers have been enhanced, enabling them to handle simple image operations such as scaling, rotation, and image composition.

The role of a display controller in a processor is similar to that of a graphics card in a computer. When a processor integrates a display controller, it is equivalent to having a built-in graphics module that can directly drive the display to output image signals.

For example, high-performance SoCs such as RK3399, RK3588, and RK3568 all have built-in display controllers, enabling video output without additional hardware.

The framework diagram of a processor with an integrated display controller is as follows:

Framework Diagram of a Processor with Integrated Display Controller
Framework Diagram of a Processor with Integrated Display Controller

In the embedded field, some low-power microcontrollers (such as the STM32 series) typically do not integrate a display controller. If such processors need to output images, they must be connected to an external display module with GRAM to handle graphics processing and display functions.

Framework Diagram of a Processor Without Integrated Display Controller:

Processor framework diagram without integrated display controller
Processor framework diagram without integrated display controller

Processor architectures without integrated display controllers typically have the following characteristics:

  1. Graphics processing capability is limited, relying on computing resources provided by external display modules.
  2. System power consumption and hardware costs are relatively low, suitable for scenarios with high requirements for energy efficiency and economy.
  3. Mainly applied in fields with basic display needs such as industrial control and sensor panels.

Introduction to VOP

In Rockchip’s series of SoCs, the display controller is called VOP (Video Output Processor). Currently, there are two VOP architectures in Rockchip processors: VOP1 and VOP2.

The difference between the two is mainly reflected in the way they support multi-screen display. Typically, a single VOP can only drive one screen for independent display at a time. To achieve multi-screen display, multiple VOPs need to work together.

VOP1

VOP1 adopts this traditional approach to support multi-screen display (a single VOP can only drive one screen for independent display at a time). The functional diagram of the VOP1 architecture is shown below:

VOP1
VOP1

For example, the display controller built into the RK3399 processor is of type VOP1. The description of VOP in the RK3399 processor’s TRM manual is as follows:

In the RK3399 processor, two VOP modules are integrated, called VOP_BIG and VOP_LIT. Therefore, the RK3399 can support up to two screens displaying simultaneously.

VOP2

In contrast, the VOP2 architecture includes only one VOP module in the processor, but designs multiple independent VP (Video Port) output interfaces at its backend. These VP interfaces can work independently at the same time, enabling multiple display outputs. That is,The display capability of VOP2 depends on the number of VPsThe number of VPs determines how many simultaneous displays (same or different content) can be supported. The functional diagram of the VOP2 architecture is shown below:

VOP2
VOP2

Taking the RK3568 processor as an example, its Technical Reference Manual (TRM) describes VOP2 as follows:

VOP Description
VOP Description

VOP2 is a display interface module that connects the memory frame buffer to the display device. It connects to the AHB bus via an AHB Slave interface for register configuration, and to the AXI bus via an AXI Master interface for reading display frame data.

Therefore, the RK3568 processor supports up to 3 screens with same or different content. Each VP of the RK3568 processor supports LCD screens with different interfaces, as shown in the following diagram:

Connection relationship between RK3568 VPs and display interfaces:
Connection relationship between RK3568 VPs and display interfaces:

Among them, VP0 and VP1 both support output via MIPI0, MIPI1, eDP, and HDMI interfaces, while VP2 supports output via LVDS and RGB interfaces. This diverse interface configuration enables the RK3568 to adapt to various display devices, fully demonstrating its flexibility in LCD interface design.

It should be noted that each VP can only support one display interface output at a time. For example, if VP1 is configured for LVDS output, it cannot be used for HDMI output simultaneously. Additionally, the maximum resolution capabilities of different VP interfaces vary. The maximum resolution support for each VP interface is as follows:

VOP ChannelMax Resolution @ Refresh RateSupported Interfaces and Corresponding Resolutions @ Refresh Rate
VP04096×2304@60Hz- HDMI: 4096×2160@60Hz
- eDP: 2560×1600@60Hz
- MIPI: 1920×1080@60Hz (Single Channel)
- MIPI: 2048×1536@60Hz (Dual Channel)
VP11920×1080@60Hz- HDMI: 1920×1080@60Hz
- eDP: 1920×1080@60Hz
- MIPI: 1920×1080@60Hz (Single Channel)
- LVDS: 1280×800@60Hz
VP21920×1080@60Hz- LVDS: 1280×800@60Hz
- RGB: 1920×1080@60Hz
Connector-mirror Technology

The RK3568 chip has three independent video processing units (VPs), so under the most basic conditions, the RK3568 supports three display outputs. If more simultaneous outputs are needed, expansion can be achieved using connector-mirror technology.

For example, the RK3588, based on four VOPs and combined with connector-mirror technology, can achieve application scenarios with seven simultaneous display signal outputs.

Connector-mirror technology
Connector-mirror technology

The diagram above uses connector-mirror technology to connect two HDMI/eDP channels to VP0, two DP channels to VP1, two MIPI DSI channels to VP2, and VP3 outputs via BT656 and BT1120, thus achieving seven simultaneous outputs.

With the above configuration, the system can output up to 7 display signals simultaneously, but these signals are actually realized through 4 independent display paths. It should be noted thatthe display timing and content output by each group (i.e., two display interfaces on the same Video Port) are exactly the same

In this application mode, the maximum resolution of each display pathis limited by the maximum resolution support capability of the corresponding Video Port and the connected display interface. This feature can be enabled through DTS (Device Tree Source) configuration. In the DTS file, simply mount two display interfaces under the same Video Port to complete the configuration.

Currently, this feature is only supported in the NVR SDK, while Android does not yet support it.

VOP-split technology

The VOP-Split function is a technology similar to MIPI dual-channel mode, which can split the output of one Video Port horizontally into left and right parts, thereby driving two display interfaces simultaneously. In this mode, the display timing of the two interfaces remains consistent, but they can output independent content.

It should be noted that this function currently only supports hardware platforms based on the VOP2 architecture. By using the VOP-Split function, more efficient display expansion capabilities can be achieved. The application diagram for expansion using the VOP-Split function is shown below:

VOP-split technology
VOP-split technology

After enabling Split mode on VP0, the output of VP0 can simultaneously drive two display interfaces (e.g., HDMI0/1, eDP0/1, or other display interfaces connected to VP0). The content displayed on these two interfaces is the result of horizontally splitting the VP0 output image into left and right halves.

For example, if VP0 outputs at a resolution of 3840x1080, each display interface will show a 1920x1080 image respectively.

It should be noted that in Split mode, the two display interfaces involved in output on the same VP must maintain the same display timing and frame rate.

Glossary

TermExplanation
EncoderAn encoder that converts the image signal output by the display controller into a digital signal, such as HDMI, MIPI, etc.
ConnectorA connector that transmits the signal output by the encoder to the display and establishes a connection with the display.
BridgeA bridge device, generally referring to a conversion chip, such as RGB to HDMI.
PanelGenerally refers to a specific display screen.
PlaneLayer, the output image is composed of multiple layers superimposed, such as a main layer, cursor layer, etc.
GEMFull name is generic DRM memory-management, which manages the video memory used by DRM, including dumb, prime, fence.
FramebufferFrame buffer, which is a cache (memory) after Linux abstracts the video memory. The purpose is to provide a set of interfaces at the application layer to directly operate the screen without caring about the specific details such as the location of the physical video memory and the page swapping mechanism. The Framebuffer device file is generally/dev/fb*

LCD Timing

Glossary

SignalFull NameFunction
HSYNCHorizontal SyncControls the horizontal scanning synchronization signal to ensure correct alignment of each row of pixels.
HPWHorizontal Low Pulse WidthDefines the electronic pulse width of the horizontal synchronization signal.
HSAHorizontal Sync ActiveIndicates the time period during which the horizontal synchronization signal is in an active state.
HSSHorizontal Sync StartIndicates the start position of the horizontal synchronization signal.
HSEHorizontal Sync EndIndicates the end position of the horizontal synchronization signal.
HBPHorizontal Back PorchThe blanking interval between the end of the horizontal synchronization signal and the start of the active pixel area.
HFPHorizontal Front PorchThe blanking interval between the end of the active pixel area and the start of the next horizontal synchronization signal.
HACTHorizontal ActiveDefines the width of the active pixel area in the horizontal direction of the screen.
VSYNCVertical SyncControls the vertical scanning synchronization signal to ensure correct alignment of each frame.
VPWVertical Low Pulse WidthDefines the low-level pulse width of the vertical synchronization signal.
VSAVertical Sync ActiveIndicates the time period during which the vertical synchronization signal is in an active state.
VSSVertical Sync StartIndicates the start position of the vertical synchronization signal.
VSEVertical Sync EndIndicates the end position of the vertical synchronization signal.
VBPVertical Back PorchThe blank interval from the end of the vertical sync signal to the start of the active pixel area.
VACTVertical ActiveDefines the height of the active pixel area in the vertical direction of the screen.
VFPVertical Front PorchThe blank interval from the end of the active pixel area to the start of the next vertical sync signal.

In some materials, certain terms have alternative names:

Full NameAlternative Names
HBP (Horizontal Back Porch)left_margin
HFP (Horizontal Front Porch)right_margin
VBP (Vertical Back Porch)upper_margin
VFP (Vertical Front Porch)lower_margin
HPW (HSYNC pulse width)hsync_len
VPW (VSYNC pulse width)vsync_len

Timing

Linux abstracts the timing parameters of LCD, i.e., the timing. In the kernel source code:Documentation/fb/framebuffer.rstYou can find the abstract diagram of Linux’s LCD timing, as shown in the figure below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
+----------+---------------------------------------------+----------+-------+
| | ↑ | | |
| | |upper_margin | | |
| | ↓ | | |
+----------###############################################----------+-------+
| # ↑ # | |
| # | # | |
| # | # | |
| # | # | |
| left # | # right | hsync |
| margin # | xres # margin | len |
|<-------->#<---------------+--------------------------->#<-------->|<----->|
| # | # | |
| # | # | |
| # | # | |
| # |yres # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # | # | |
| # ↓ # | |
+----------###############################################----------+-------+
| | ↑ | | |
| | |lower_margin | | |
| | ↓ | | |
+----------+---------------------------------------------+----------+-------+
| | ↑ | | |
| | |vsync_len | | |
| | ↓ | | |
+----------+---------------------------------------------+----------+-------+

The figure shows a physical device where the ‘electron gun’ draws each pixel row by row and pixel by pixel in order from left to right and top to bottom. The entire frame is fully displayed only after the last pixel is drawn. This process is illustrated in the figure below:

Scanning
Scanning

The process of the ‘electron gun’ drawing a frame is completed by scanning line by line in a zigzag pattern. Each line is drawn from left to right, then returns to the start of the next line until the entire frame is drawn.

During this process:

  • HSYNC (Horizontal Sync Signal) is used to indicate the start of drawing a new line, so it appears at the far right of each line;
  • VSYNC (Vertical Sync Signal) indicates the start of a new frame and appears at the bottom of the entire frame.
  • In the abstract diagram, the Hactive and Vactive areas represent the actual image display region, while the surrounding HFP (Horizontal Front Porch), HBP (Horizontal Back Porch), VFP (Vertical Front Porch), and VBP (Vertical Back Porch) together form the so-called “black borders.” Their purpose is to allow time for signal switching and electron gun retrace.

The specific explanations are as follows:

  1. HFP (Horizontal Front Porch): After the current line is drawn, the electron gun turns off and waits for the time before the next HSYNC signal is generated.
  2. HSYNC: Indicates the start of horizontal retrace, where the electron gun jumps back to the beginning of the next line.
  3. HBP (Horizontal Back Porch): The waiting time from the end of the HSYNC signal to when the electron gun turns back on to start drawing a new line.
  4. VFP (Vertical Front Porch): After the entire frame is drawn, the electron gun turns off and waits for the time before the VSYNC signal is generated.
  5. VSYNC: Indicates the start of vertical retrace, where the electron gun returns to the top-left corner of the screen to prepare for drawing a new frame.
  6. VBP (Vertical Back Porch): The waiting time from the end of the VSYNC signal to when the electron gun turns back on to start drawing a new frame.

Although these “black border” areas do not participate in actual image display, they are crucial for maintaining image stability and synchronization. The abstract diagram is shown below:

Abstract Diagram
Abstract Diagram

The “electron gun” was common in CRT monitors, but CRT monitors are now obsolete. LCDs do not have an “electron gun.” Instead, chips are used to replace the “electron gun” to control the timing of the LCD.

LCD Timing Example

Here, the LCD timing diagram from the 4412 processor datasheet is used as an example for parameter analysis.

4412 Processor LCD Timing Diagram
4412 Processor LCD Timing Diagram

  • HSYNC: Horizontal scanning synchronization signal, also called line sync signal. This signal indicates the start of scanning a new line. In the diagram above, the HSYNC signal is active high.

  • HSPW: HSYNC signal width. Also called thp in some LCD datasheets.

  • HBP/HBPD: The time from the end of the HSYNC signal to the start of the next valid data. Also called thb in some LCD datasheets, and referred to as the horizontal sync back porch by some engineers.

  • HFP/HFPD: The waiting time from the end of one line of valid data to the generation of the HSYNC signal. Also called thf in some LCD datasheets, and referred to as the horizontal sync front porch by some engineers.

  • VCLK: Pixel clock, also called PCLK. The frequency of the pixel clock signal is related to the LCD resolution; the higher the resolution, the higher the pixel clock frequency.

  • VDEN: Data enable signal, also called DE signal, indicating valid data. In the figure above, it is active high.

  • HOZVAL: Indicates the time required to scan one line. Also called thd in some LCD datasheets.

  • VSYNC: Vertical sync signal, also called frame sync signal. This signal indicates the start of a new frame. In the figure above, the HSYNC signal is active high.

  • VSPW: VSYNC signal width, also called tvp in some LCD datasheets. VBP/VBPD: The time from the end of the VSYNC signal to the start of a new frame. Also called tvb in some LCD datasheets, and referred to as the vertical sync back porch by some engineers.

  • VFP/VFPD: The time from the end of one frame scan to the generation of the VSYNC signal. Also called tvf in some LCD datasheets, and referred to as the vertical sync front porch by some engineers.

  • FRAME: The time required to display one frame.

When lighting up the screen, we need to determine the values of these parameters. This can be done by referring to the screen’s datasheet or by consulting the FAE personnel from the screen supplier. Below is a description of these parameters in an LCD screen datasheet.

ItemSymbolMin.Typ.Max.UnitRemark
Horizontal Display Areathd-1024-DCLK
DCLK Frequencyfclk40.851.267.2MHz
One Horizontal Lineth111413441400DCLK
HS pulse widththpw1-40DCLK
HS Blankingthb160160160DCLK
HS Front Porchthfp16160216DCLK
Vertical Display Areatvd-600-TH
VS period timetv624635750TH
VS pulse widthtvpw1-20TH
VS Blankingtvb232323TH
VS Front Porchtvfp112127TH

RGB Screen Porting

RGB Interface Introduction

The iTOP-RK3568 core board supports the RGB interface and can connect to an RGB LCD. Note that the base board multiplexes the RGB interface for other functions.

The RGB interface resources of the iTOP-RK3568 core board and their multiplexed functions on the base board are as follows:

RGB SignalCorresponding GPIONet LabelBaseboard Multiplexing Function
LCDC_D0GPIO2_D0_dPCIE20_CLKREQn_M1PCIE2.0 Reference Clock Request
LCDC_D1GPIO2_D1_dPCIE20_WAKEn_M1PCIE2.0 Wake
LCDC_D2GPIO2_D2_dPCIE30X1_CLKREQn_M1/SPI0_CS0_M1PCIE3.0 Reference Clock Request / SPI0 CS0 Pin
LCDC_D3GPIO2_D3_dPCIE30X1_WAKEn_M1/SPI0_CLK_M1PCIE3.0 Wake / SPI CLK Pin
LCDC_D4GPIO2_D4_dPCIE30X2_CLKREQn_M1PCIE3.0 Reference Clock Request
LCDC_D5GPIO2_D5_dPCIE30X2_WAKEn_M1PCIE3.0 Wake
LCDC_D6GPIO2_D6_dPCIE30X2_PERSTn_M1PCIE3.0 Reset
LCDC_D7GPIO2_D7_dPCIE30X2_PRSNT_L_GPIO2_D7PCIE3.0 Insertion Detection
LCDC_CLKGPIO3_A0_dPCIE30X1_PRSNT_L_GPIO3_A0/PCIE20_PRSNT_L_GPIO3_A0PCIE3.0 Insertion Detection / PCIE2.0 Reset
LCDC_D8GPIO3_A1_dPCIE30X1_PERSTn_M1PCIE3.0 Reset
LCDC_D9GPIO3_A2_dI2S3_MCLK_M0I2S3 MCLK Pin
LCDC_D10GPIO3_A3_dI2S3_SCLK_M0I2S3 SCLK Pin
LCDC_D11GPIO3_A4_dI2S3_LRCK_M0I2S3 LRCK Pin
LCDC_D12GPIO3_A5_dI2S3_SDO_M0/TP_INT_L_GPIO3_A5I2S3 SDO Pin / Touch INT Pin
LCDC_D13GPIO3_A6_dI2S3_SDI_M0/USB_OTG_PWREN_H_GPIO3_A6I2S3 SDI Pin / USB OTG Power Enable Pin
LCDC_D14GPIO3_A7_dGMAC1_INT/PMEB_GPIO3_A7GMAC1 INT and PMEB Functions
LCDC_D15GPIO3_B0_dGMAC1_RSTn_GPIO3_B0GMAC1 Reset Pin
LCDC_D16GPIO3_B1_dUART4_RX_M1UART4 RX Pin
LCDC_D17GPIO3_B2_dUART4_TX_M1UART4 TX Pin
LCDC_D18GPIO3_B3_dI2C5_SCL_M0I2C5 SCL Pin
LCDC_D19GPIO3_B4_dI2C5_SDA_M0I2C5 SDA Pin
LCDC_D20GPIO3_B5_dRS485_DIR_GPIO3_B5RS485 Input/Output Control Pin
LCDC_D21GPIO3_B6_dGPIO3_B6_dGPIO3_B6 Pin
LCDC_D22GPIO3_B7_dGPIO3_B7_dGPIO3_B7 Pin
LCDC_D23GPIO3_C0_dGPIO3_C0_dGPIO3_C0 Pin
LCDC_HSYNCGPIO3_C1_dPCIE20_PERSTn_M1PCIE2.0 Reset
LCDC_VSYNCGPIO3_C2_dHP_DET_L_GPIO3_C2Headphone plug detection pin
LCDC_DENGPIO3_C3_dSPK_CTL_H_GPIO3_C3/5G_RESETAmplifier control pin / 5G reset pin

The RGB interface typically requires 28 signal lines, which explains why in baseboard designs, the pins for RGB signals are often multiplexed for other functions. The reason is that if all RGB interface pins are brought out, they would occupy 28 pins, leading to excessive resource consumption.

Among these 28 signal lines, 24 are used to transmit color data, corresponding to the three color signals of red ®, green (G), and blue (B). The specific signal lines are LCD_D0 ~ LCD_D23. The other 4 are control signal lines, including the horizontal sync signal (LCDC_HSYNC), vertical sync signal (LCDC_VSYNC), data enable signal (LCDC_DEN) and pixel clock signal (LCDC_CLK). The specific allocation is shown in the table below:

Signal lineFunction
R[7:0]Red color data line
G[7:0]Green color data line
B[7:0]Blue color data line
LCDC_HSYNCHorizontal sync data line
LCDC_VSYNCVertical sync data line
LCDC_DENData enable data line
LCDC_CLKPixel clock data line

In the RGB interface, the 24 color pins correspond to the three colors R, G, and B respectively, with the corresponding signal lines being LCD_D0~LCD_D23. Among these 24 color pins, the 8 pins corresponding to R, the 8 pins corresponding to G, and the 8 pins corresponding to B are described as follows, taking the iTOP-RK3568 core board as an example, according to Rockchip official documentation:

The 8 pins corresponding to R, G, and B respectively are shown in the figure
The 8 pins corresponding to R, G, and B respectively are shown in the figure

In the RGB interface, the connection method of the signal lines depends on the color format used.

  • For RGB888 format:

    • The core board’sD0 ~ D7 corresponds to the blue channelB0 ~ B7
    • D8 ~ D15corresponds to the green channelG0 ~ G7
    • D16 ~ D23 corresponds to the red channelR0 ~ R7
  • In RGB666 format:

    • The lower two bits of the blue, green, and red channels (B0 ~ B1G0 ~ G1R0 ~R1) are not connected, and the remaining signal lines are still connected according to the RGB888 mapping rules.
  • For RGB565 format:

    • The lower bits of the blue, green, and red channels (B0 ~ B2G0 ~ G1R0 ~ R2) are not connected, and the remaining signal lines are connected according to the RGB888 mapping rules.

This flexible connection method can adapt to different color format requirements while optimizing the use of pin resources.

Synchronization Mode

From the previous LCD timing analysis, it is known that the row timing includes HFP (Horizontal Front Porch), HBP (Horizontal Back Porch), and HSYNC (Horizontal Sync Signal), while the column timing includes VFP (Vertical Front Porch), VBP (Vertical Back Porch), and VSYNC (Vertical Sync Signal).

These timing parts do not contain displayable data, so a mechanism is needed between the LCD and the processor to achieve synchronization.

The core function of synchronization isto enable the LCD to recognize the signal state currently sent by the processor, for example, when sending non-display timing such as HFP, the LCD will not display it as valid data; or to notify the LCD that starting from a certain time point, the subsequently transmitted data is valid display data that can be used for screen display.

To achieve this synchronization purpose, there are currently two main methods:

  • DE Mode
  • HV Mode

DE Mode

Use the DE data line to indicate the start and end of valid data, such as the LCDC_DEN signal line.

DE Mode
DE Mode

When the DE signal goes high, it indicates the start of valid data; when the DE signal goes low, it indicates the end of valid data. Therefore, in DE mode, signal lines such as HSYNC and VSYNC are not needed, making it simpler to use.

HV Mode

In HV mode, the LCD timing is determined by HSYNC (horizontal sync signal) and VSYNC (vertical sync signal), without using the DE (data enable) signal line. Synchronization is entirely accomplished through the HSYNC and VSYNC signals.

HV Mode
HV Mode

Currently, most LCD screens support both HV mode and DE mode. For example, the following screen is compatible with both modes and selects the specific working mode through its 8th pin:

  • When the 8th pin is at a high level, the screen operates in DE mode;

  • When the 8th pin is at a low level, it switches to HV mode.

This design provides developers with greater flexibility to choose the appropriate synchronization method based on actual needs.

Example
Example

Hardware Schematic Analysis

The iTOP-RK3568 core board itself brings out the RGB interface, but in the standard baseboard, this interface has been multiplexed for other functions. Therefore, if you need to use the RGB display function, you need to design and manufacture a compatible baseboard yourself.

The following uses the “iTOP-RK3568 core board + Xunwei Electronics 5-inch RGB screen” as an example for explanation. When designing the baseboard, you can refer to the schematic provided below for drawing and connections.

RGB
RGB

FunctionPin NumberFunctionPin Number
LCDC_D0SPI0_MISO_M1LCDC_D14GMAC1_INT/PMEB_GPIO3_A7
LCDC_D1SPI0_MOSI_M1LCDC_D15GMAC1_RSTn_GPIO3_B0
LCDC_D2SPI0_CS0_M1LCDC_D16UART4_RX_M1
LCDC_D3SPI0_CLK_M1LCDC_D17UART4_TX_M1
LCDC_D4PCIE30X2_CLKREQn_M1LCDC_D18I2C5_SCL_M0
LCDC_D5PCIE30X2_WAKEn_M1LCDC_D19I2C5_SDA_M0
LCDC_D6PCIE30X2_PERSTn_M1LCDC_D20GPIO3_B5
LCDC_D7PCIE30X2_PRSNT_L_GPIO2_D7LCDC_D21GPIO3_B6
LCDC_D8PCIE30X1_PERSTn_M1LCDC_D22GMAC0_RSTn_GPIO3_B7
LCDC_D9I2S3_MCLK_M0LCDC_D23GMAC0_INT/PMEB_GPIO3_C0
LCDC_D10I2S3_SCLK_M0LCDC_CLKPCIE20_PRSNT_L_GPIO3_A0
LCDC_D11I2S3_LRCK_M0LCDC_HSYNCPCIE20_PERSTn_M1
LCDC_D12TP_INT_L_GPIO3_A5LCDC_VSYNCHP_DET_L_GPIO3_C2
LCDC_D13USB_OTG_PWREN_H_GPIO3_A6LCDC_DEN5G_RESET

From the table, it can be seen that using the RGB interface involves many pin multiplexing conflicts. Topeet has placed the device tree with configured multiplexing relationships under the path.

Adaptation Steps

To use the RGB interface, VP2 needs to be enabled in the device tree. Since the front end of VP2 is VOP, VOP must be enabled first, then VP2 is enabled to set the RGB display path. The specific configuration steps are as follows:

Configure RGB Display Path

arch/arm64/boot/dts/rockchip/rk3568.dtsi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
vop: vop@fe040000 {
compatible = "rockchip,rk3568-vop"; // Match Rockchip RK3568 Video Output Processor Driver
reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
reg-names = "regs", "gamma_lut";
rockchip,grf = <&grf>;
interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; // Associated General Register File (GRF) Configuration Node
// Use GIC SPI Interrupt 148, High-Level Triggered
clocks = <&cru ACLK_VOP>, // VOP AXI Bus Clock
<&cru HCLK_VOP>, // VOP AHB Bus Clock
<&cru DCLK_VOP0>, // VP0 Display Pixel Clock
<&cru DCLK_VOP1>, // VP1 Display Pixel Clock
<&cru DCLK_VOP2>; // VP2 Display Pixel Clock
// Clock Name Definition (Corresponding to clocks Order)
clock-names = "aclk_vop", "hclk_vop", "dclk_vp0", "dclk_vp1", "dclk_vp2";
iommus = <&vop_mmu>; // Associated IOMMU Device for Memory Address Translation
power-domains = <&power RK3568_PD_VO>; // Power domain (display output)
status = "disabled"; // Disabled by default, must be enabled in board-level configuration

vop_out: ports { // Display output port definition
#address-cells = <1>; // Child node uses 1 address unit
#size-cells = <0>; // Child node has no size unit

/* VP0, supports DSI0/DSI1/eDP/HDMI output */
vp0: port@0 {
#address-cells = <1>; // Endpoint uses 1 address unit
#size-cells = <0>; // Endpoint has no size unit
reg = <0>; // Port number 0

vp0_out_dsi0: endpoint@0 { // Endpoint to DSI0
reg = <0>;
remote-endpoint = <&dsi0_in_vp0>;
};

vp0_out_dsi1: endpoint@1 { // Endpoint to DSI1
reg = <1>;
remote-endpoint = <&dsi1_in_vp0>;
};

vp0_out_edp: endpoint@2 { // Endpoint to eDP
reg = <2>;
remote-endpoint = <&edp_in_vp0>;
};

vp0_out_hdmi: endpoint@3 { // Endpoint to HDMI
reg = <3>;
remote-endpoint = <&hdmi_in_vp0>;
};
};

/* VP1, supports DSI0/DSI1/eDP/HDMI/LVDS output */
vp1: port@1 {
#address-cells = <1>; // Endpoint uses 1 address unit
#size-cells = <0>; // Endpoint has no size unit
reg = <1>; // Port number 1

vp1_out_dsi0: endpoint@0 { // Endpoint to DSI0
reg = <0>;
remote-endpoint = <&dsi0_in_vp1>;
};

vp1_out_dsi1: endpoint@1 { // Endpoint to DSI1
reg = <1>;
remote-endpoint = <&dsi1_in_vp1>;
};

vp1_out_edp: endpoint@2 { // Endpoint to eDP
reg = <2>;
remote-endpoint = <&edp_in_vp1>;
};

vp1_out_hdmi: endpoint@3 { // Endpoint to HDMI
reg = <3>;
remote-endpoint = <&hdmi_in_vp1>;
};

vp1_out_lvds: endpoint@4 { // Endpoint to LVDS
reg = <4>;
remote-endpoint = <&lvds_in_vp1>;
};

vp1_out_lvds1: endpoint@5 {
reg = <5>;
remote-endpoint = <&lvds1_in_vp1>;
};
};

/* VP2, supports LVDS/RGB output *
vp2: port@2 {
#address-cells = <1>;
#size-cells = <0>;

reg = <2>; // Port number 2

vp2_out_lvds: endpoint@0 { // to LVDS endpoint of
reg = <0>;
remote-endpoint = <&lvds_in_vp2>;
};

vp2_out_rgb: endpoint@1 { // to RGB endpoint of the interface
reg = <1>;
remote-endpoint = <&rgb_in_vp2>;
};

vp2_out_lvds1: endpoint@2 {
reg = <2>;
remote-endpoint = <&lvds1_in_vp2>;
};
};
};
};
  • compatibleattribute value isrockchip,rk3568-vop, indicating thatgpu/drm/rockchip/rockchip_vop2_reg.cthis driver.
  • statusThe attribute value is disabled, indicating that this node is disabled, so this node needs to be enabled.
  • VP0 can support DSI0, DSI1, eDP, and HDMI interfaces.
  • VP1 can support DSI0, DSI1, eDP, HDMI, and LVDS interfaces.
  • VP1 and VP2 can support LVDS and RGB interfaces.

Then, in thearch/arm64/boot/dts/rockchip/topeet-rk3568-linux.dtsidevice tree, enable the VOP node by appending.

1
2
3
4
5
6
&vop {
status = "okay";
// The clocks of VP0, VP1, VP2 and their parent clocks
assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>;
assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>, <&cru PLL_VPLL>;
};

The clock and parent clock topology of VP0, VP1, and VP2 is as follows:

1
2
3
4
5
PMUCRU
└─ PLL_HPLL → DCLK_VOP0 (VP0)
CRU
├─ PLL_VPLL → DCLK_VOP1 (VP1)
└─ PLL_VPLL → DCLK_VOP2 (VP2)

After enabling VOP, next set the RGB interface to use the display path output by VP2. Open therk3568.dtsidevice tree file, find the RGB node, the specific content is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
grf: syscon@fdc60000 {
compatible = "rockchip,rk3568-grf", "syscon", "simple-mfd";
reg = <0x0 0xfdc60000 0x0 0x10000>;

io_domains: io-domains {
compatible = "rockchip,rk3568-io-voltage-domain";
status = "disabled";
};

lvds0: lvds: lvds {
compatible = "rockchip,rk3568-lvds";
phys = <&video_phy0>;
phy-names = "phy";
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

lvds0_in_vp1: lvds_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_lvds>;
status = "disabled";
};

lvds0_in_vp2: lvds_in_vp2: endpoint@2 {
reg = <2>;
remote-endpoint = <&vp2_out_lvds>;
status = "disabled";
};
};
};
};

lvds1: lvds1 {
compatible = "rockchip,rk3568-lvds";
phys = <&video_phy1>;
phy-names = "phy";
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

lvds1_in_vp1: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp1_out_lvds1>;
};

lvds1_in_vp2: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp2_out_lvds1>;
};
};
};
};

rgb: rgb {
compatible = "rockchip,rk3568-rgb";
pinctrl-names = "default";
pinctrl-0 = <&lcdc_ctl>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

rgb_in_vp2: endpoint@2 {
reg = <2>;
remote-endpoint = <&vp2_out_rgb>;
status = "disabled";
};
};
};
};

};

compatibleThe attribute value isrockchip,rk3568-rgb, indicating that it will usegpu/drm/rockchip/rockchip_rgb.cthis driver.

statusThe attribute value is disabled, indicating that the RGB node is disabled, so we need to enable the RGB node.

rgb_in_vp2Indicates that the RGB interface is connected to VP2,statusThe attribute value disabled indicates that using VP2 to output RGB is prohibited. (The VP port corresponding to the RGB interface, for the RK3568’s RGB interface, needs to use VP2 for output.)

pinctrl-0 = <&lcdc_ctl>;Use the pinctrl subsystem to set the RGB pin multiplexing.lcdc_ctlThe node is in therk3568-pinctrl.dtsidevice tree file. The specific content is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
lcdc {
/omit-if-no-ref/
lcdc_ctl: lcdc-ctl {
rockchip,pins =
/* lcdc_clk */
<3 RK_PA0 1 &pcfg_pull_none>,
/* lcdc_d0 */
<2 RK_PD0 1 &pcfg_pull_none>,
/* lcdc_d1 */
<2 RK_PD1 1 &pcfg_pull_none>,
/* lcdc_d2 */
<2 RK_PD2 1 &pcfg_pull_none>,
/* lcdc_d3 */
<2 RK_PD3 1 &pcfg_pull_none>,
/* lcdc_d4 */
<2 RK_PD4 1 &pcfg_pull_none>,
/* lcdc_d5 */
<2 RK_PD5 1 &pcfg_pull_none>,
/* lcdc_d6 */
<2 RK_PD6 1 &pcfg_pull_none>,
/* lcdc_d7 */
<2 RK_PD7 1 &pcfg_pull_none>,
/* lcdc_d8 */
<3 RK_PA1 1 &pcfg_pull_none>,
/* lcdc_d9 */
<3 RK_PA2 1 &pcfg_pull_none>,
/* lcdc_d10 */
<3 RK_PA3 1 &pcfg_pull_none>,
/* lcdc_d11 */
<3 RK_PA4 1 &pcfg_pull_none>,
/* lcdc_d12 */
<3 RK_PA5 1 &pcfg_pull_none>,
/* lcdc_d13 */
<3 RK_PA6 1 &pcfg_pull_none>,
/* lcdc_d14 */
<3 RK_PA7 1 &pcfg_pull_none>,
/* lcdc_d15 */
<3 RK_PB0 1 &pcfg_pull_none>,
/* lcdc_d16 */
<3 RK_PB1 1 &pcfg_pull_none>,
/* lcdc_d17 */
<3 RK_PB2 1 &pcfg_pull_none>,
/* lcdc_d18 */
<3 RK_PB3 1 &pcfg_pull_none>,
/* lcdc_d19 */
<3 RK_PB4 1 &pcfg_pull_none>,
/* lcdc_d20 */
<3 RK_PB5 1 &pcfg_pull_none>,
/* lcdc_d21 */
<3 RK_PB6 1 &pcfg_pull_none>,
/* lcdc_d22 */
<3 RK_PB7 1 &pcfg_pull_none>,
/* lcdc_d23 */
<3 RK_PC0 1 &pcfg_pull_none>,
/* lcdc_den */
<3 RK_PC3 1 &pcfg_pull_none>,
/* lcdc_hsync */
<3 RK_PC1 1 &pcfg_pull_none>,
/* lcdc_vsync */
<3 RK_PC2 1 &pcfg_pull_none>;
};
};

topeet_rk3568_lcds.dtsiIn the device tree file, use the following code to set the RGB display path.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
&rgb {
status = "okay"; // Indicates enabling the rgb node

// Add rgb_out node sets the RGB screen information, through rgb_out_panel node points to the RGB screen
ports {
rgb_out: port@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

rgb_out_panel: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_in_rgb>;
};
};
};
};

// Change the rgb_in_vp2 node's status attribute value to okay, indicating enabling rgb_in_vp2 node.
&rgb_in_vp2 {
status = "okay";
};

Thus, the display path from VOP to VP2 to the RGB screen is set up.

Set screen information

topeet_rk3568_lcds.dtsiAdd

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
rgb_panel: panel {
compatible = "simple-panel";
status = "disabled";
backlight = <&backlight>;
power-supply = <&vcc3v3_lcd0_n>;
enable-delay-ms = <10>;
prepare-delay-ms = <20>;
unprepare-delay-ms = <20>;
disable-delay-ms = <20>;
bus-format = <MEDIA_BUS_FMT_RGB565_1X16>;
width-mm = <43>;
height-mm = <73>;

display-timings {
native-mode = <&rgb_timing0>;

rgb_timing0: rgb-timing0 {
clock-frequency = <20000000>;
hactive = <800>;
vactive = <480>;
hback-porch = <24>;//<100>;
hfront-porch = <72>;//<1580>;
vback-porch = <10>;//<25>;
vfront-porch = <12>;//<10>;
hsync-len = <24>;//<10>;
vsync-len = <2>;//<4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_rgb: endpoint {
remote-endpoint = <&rgb_out_panel>;
};
};
};

compatibleThe attribute value issimple-panel, indicating that thegpu/drm/panel/panel-simple.cdriver will be used, which is the generic display driver.

statusThe attribute value is disabled, indicating that the RGB screen represented by this node is prohibited. This attribute needs to be set to okay.

backlightThe attribute indicates the use of&backlightbacklight control node.

power-supply: Optional attribute, indicating the power supply used by the screen.

enable-delay-ms: Optional attribute, the delay from power enable to panel startup.

prepare-delay-ms: Optional attribute, the delay before the panel receives image data.

unprepare-delay-ms: Optional attribute, the waiting time before turning off the panel.

disable-delay-ms: Optional attribute, the delay before panel power-off.

width-mm: Optional attribute, the physical width of the screen

height-mm: Optional attribute, the physical height of the screen

bus-format: Attribute used to configure the pixel format, the attribute value is MEDIA_BUS_FMT_RGB565_1X16 indicates the use of RGB565 format. Attribute value MEDIA_BUS_FMT_RGB666_1X18 indicates the use of RGB666 format. Attribute value MEDIA_BUS_FMT_RGB888_1X24 indicates the use of RGB888 format.

display-timingsNode: This is the LCD timing parameter. For details, please refer to the LCD Timing chapter.

ports: This is the ports node of the screen, where line 40 sets the remote endpoint of the screen torgb_out_panel

In this way, the RGB interface of the RK3568 is associated with the screen.

Furthermore, becausergb_panelthe node is disabled by default, it is also necessary torgb_panelenable the node. In thetopeet_rk3568_lcds.dtsidevice tree file, add the following code.

1
2
3
&rgb_panel{
status = "okay";
}

Setting Backlight

In thergb_panelnode, use thebacklightattribute to reference the backlight control node. The device tree is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dts
backlight: backlight {
compatible = "pwm-backlight";
brightness-levels = <
0 20 20 21 21 22 22 23
23 24 24 25 25 26 26 27
27 28 28 29 29 30 30 31
31 32 32 33 33 34 34 35
35 36 36 37 37 38 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <200>;
};

compatibleThe attribute value ispwm-backlight, indicating the use ofvideo/backlight/pwm_bl.cthis driver.

pwmsThe attribute indicates the PWM channel and frequency used. For example,pwms = <&pwm4 0 2500 0 0>indicates using PWM4 channel 0 with a frequency of 40KHZ (25000 is the period in ns, converted to a frequency of 40KHZ), the last 0 indicates polarity, 0 corresponds to PWM_POLARITY_NORMAL polarity, 1 corresponds to PWM_POLARITY_INVERTED indicates inverted polarity.

brightness-levelsindicates the brightness level, ranging from 0 to 255, where 0 means PWM duty cycle is 0%, and 255 means PWM duty cycle is 100%.

default-brightness-levelThe attribute indicates the default brightness level, which is 220 in this node.

To control the PWM backlight node’s on/off status and PWM frequency, you can add the following code in thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file. Modify it by appending.

1
2
3
4
&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};

Setting up touch

Taking the Xunwei RGB interface 5-inch screen as an example, this screen uses the FT5X touch chip and communicates via I2C5. Open thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file and add the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
&i2c5 {
status = "okay";
ft5x061:ft5x06@38 {
status = "disabled";
compatible = "edt,edt-ft5306";
reg = <0x38>;
touch-gpio = <&gpio3 RK_PB1 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PB1 IRQ_TYPE_LEVEL_LOW>;
reset-gpio = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
touch_type = <1>;
};
};

compatibleThe attribute value isedt,edt-ft5306, indicating the use ofinput/touchscreen/edt-ft5x06.cDriver.

regThe attribute value is 0x38, indicating the slave address is 0x38.

touch-gpioThe attribute indicates using GPIO3_B1 pin as the touch interrupt pin. IRQ_TYPE_EDGE_RISING indicates rising edge trigger.

interrupt-parentThe interrupt parent node attribute is gpio3.

interruptsThe attribute indicates using the B1 pin of GPIO, with the trigger mode changed to low-level trigger.

reset-gpioThe attribute indicates using the GPIO3_B2 pin as the reset pin.

touchscreen-size-xIndicates the resolution on the x-axis

touchscreen-size-yIndicates the resolution on the y-axis.

touch_typeThe attribute indicates the touch type

If touch is needed, you can add the following code in thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file, by appending
to control the enabling and disabling of the touch node.

1
2
3
&ft5x063 {
status = "okay";
};

If you need to display the logo during the uboot and kernel stages, you need to enableroute_rgbnode. Note that if the logo is not enabled during the uboot stage, it cannot be displayed during the kernel stage either.

Open therk3568.dtsidevice tree file,route_rgbthe node is defined as follows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
display_subsystem: display-subsystem {
compatible = "rockchip,display-subsystem";
memory-region = <&drm_logo>, <&drm_cubic_lut>;
memory-region-names = "drm-logo", "drm-cubic-lut";
ports = <&vop_out>;
devfreq = <&dmc>;

route {
route_dsi0: route-dsi0 {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp0_out_dsi0>;
};
route_dsi1: route-dsi1 {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp0_out_dsi1>;
};
route_edp: route-edp {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp0_out_edp>;
};
route_hdmi: route-hdmi {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp1_out_hdmi>;
};
route_lvds: route-lvds {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp1_out_lvds>;
};
route_rgb: route-rgb {
status = "disabled";
logo,uboot = "logo.bmp";
logo,kernel = "logo_kernel.bmp";
logo,mode = "center";
charge_logo,mode = "center";
connect = <&vp2_out_rgb>;
};
};
};

statusattribute is set to disabled, indicating that logo display is prohibited. If you need to display the logo, change the attribute value of this status to okay.

logo,ubootlogo,kernel: Corresponding to the uboot and kernel logos respectively, the logo image format is BMP. When the attribute is left empty or the specified image is not found, the logo will not be displayed.

logo,modeandcharge_logo,modeindicate the logo mode. Two modes are supported: center means centered, and fullscreen means full screen.

connectattribute is used to specify the specific display path.connect = <&vp2_out_rgb>Indicates that RGB uses vp2 output.

If you need to use the logo, you can add the following code inarch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsto enable theroute_rgbnode by appending.

1
2
3
&route_rgb {
status = "okay";
};

Set the macro switch

The work of lighting up the screen is all focused on configuring the device tree, so the nodes to be operated can be placed in code blocks controlled by conditional compilation to control the opening and closing of a specific screen.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#if defined(LCD_TYPE_RGB_5_0)

&rgb {
status = "okay"; // Indicates enabling the RGB node

// Add RGB_The out node sets RGB screen information via RGB_The out_panel node points to the RGB screen
ports {
rgb_out: port@1 {
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;

rgb_out_panel: endpoint@0 {
reg = <0>;
remote-endpoint = <&panel_in_rgb>;
};
};
};
};



rgb_panel: panel {
compatible = "simple-panel";
status = "disabled";
backlight = <&backlight>;
power-supply = <&vcc3v3_lcd0_n>;
enable-delay-ms = <10>;
prepare-delay-ms = <20>;
unprepare-delay-ms = <20>;
disable-delay-ms = <20>;
bus-format = <MEDIA_BUS_FMT_RGB565_1X16>;
width-mm = <43>;
height-mm = <73>;

display-timings {
native-mode = <&rgb_timing0>;

rgb_timing0: rgb-timing0 {
clock-frequency = <20000000>;
hactive = <800>;
vactive = <480>;
hback-porch = <24>;//<100>;
hfront-porch = <72>;//<1580>;
vback-porch = <10>;//<25>;
vfront-porch = <12>;//<10>;
hsync-len = <24>;//<10>;
vsync-len = <2>;//<4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_rgb: endpoint {
remote-endpoint = <&rgb_out_panel>;
};
};
};

// Set the RGB_in_Change the status attribute value of the vp2 node to okay, indicating enabling RGB_in_vp2 node.
&rgb_in_vp2 {
status = "okay";
};

&rgb_panel{
status = "okay";
}

&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};

&ft5x063 {
status = "okay";
};

&route_rgb {
status = "okay";
};
#endif

LVDS Screen Porting

Interface Introduction

LVDS stands for Low-Voltage Differential Signaling. LVDS features low power consumption, low bit error rate, low crosstalk, low jitter, low radiation, and good signal integrity. It is widely used in display applications, such as laptop screens and medical device monitors.

In 1994, led by National Semiconductor (NS, now TI), the ANS/TIA/EIA-644 standard was introduced. In 1996, the IEEE 1596.3 standard was also introduced. However, IEEE 1596.3 is rarely used now, and the ANS/TIA/EIA-644 standard is the mainstream. The LVDS interface of the RK3568 processor also adopts this standard, and the relevant content in the datasheet is as follows:

LVDS Interface
LVDS Interface

LVDS uses differential signals for data transmission, and its basic working principle is as follows:

LVDS Driver and Receiver
LVDS Driver and Receiver

There is a current source at the transmitter end that can provide 3.5mA of current. At the receiver input, there is a 100-ohm resistor. Since the internal resistance of the receiver is very high, the current flows back to the transmitter through the 100-ohm resistor, resulting in a 350mV voltage across the termination resistor. By changing the direction of the current, the receiver can determine whether the input signal is positive or negative based on the ±350mV.

The RK3568 processor has one LVDS interface, supporting a maximum resolution of 1280x800@60Hz. The LVDS pins are as follows

Pin NumberFunction
MIPI_DSI_TX0_D0P/LVDS_TX0_D0PMIPI_DSI_TX0_D0P or LVDS_TX0_D0P Pin
MIPI_DSI_TX0_D0N/LVDS_TX0_D0NMIPI_DSI_TX0_D0N or LVDS_TX0_D0N Pin
MIPI_DSI_TX0_D1P/LVDS_TX0_D1PMIPI_DSI_TX0_D1P or LVDS_TX0_D1P Pin
MIPI_DSI_TX0_D1N/LVDS_TX0_D1NMIPI_DSI_TX0_D1N or LVDS_TX0_D1N Pin
MIPI_DSI_TX0_D2P/LVDS_TX0_D2PMIPI_DSI_TX0_D2P or LVDS_TX0_D2P Pin
MIPI_DSI_TX0_D2N/LVDS_TX0_D2NMIPI_DSI_TX0_D2N or LVDS_TX0_D2N Pin
MIPI_DSI_TX0_D3P/LVDS_TX0_D3PMIPI_DSI_TX0_D3P or LVDS_TX0_D3P pin
MIPI_DSI_TX0_D3N/LVDS_TX0_D3NMIPI_DSI_TX0_D3N or LVDS_TX0_D3N pin
MIPI_DSI_TX0_CLKP/LVDS_TX0_CLKPMIPI_DSI_TX0_CLKP or LVDS_TX0_CLKP pin
MIPI_DSI_TX0_CLKN/LVDS_TX0_CLKNMIPI_DSI_TX0_CLKN or LVDS_TX0_CLKN pin

The LVDS pins can also be multiplexed into one MIPI DSI channel, but on the development board they are multiplexed as LVDS pins.

Introduction to LVDS screens

When selecting an LVDS screen, single 6, single 8, dual 6, and dual 8 indicate different LVDS screen interface methods.

TypeTransmission method and data bit description
Single 6-bit LVDSTransmits in single-channel mode, with 6-bit data for each primary color signal, totaling 18-bit RGB data.
Single 8-bit LVDSTransmitted in single-channel mode, each primary color signal uses 8-bit data, totaling 24-bit RGB data.
Dual 6-bit LVDSTransmitted in dual-channel mode, each primary color signal uses 6-bit data, with odd-channel data being 18 bits and even-channel data being 18 bits, totaling 36-bit RGB data.
Dual 8-bit LVDSTransmitted in dual-channel mode, each primary color signal uses 8-bit data, with odd-channel data being 24 bits and even-channel data being 24 bits, totaling 48-bit RGB data.

Comparison of 6-bit and 8-bit LVDS interfaces (taking single-channel as an example)):

TypeTotal number of differential signal linesNumber of data line pairsNumber of clock line pairsData line pin namesClock line pin names
6-bit LVDS4 pairs3 pairs1 pairLVDS_TX0_D0P/D0NLVDS_TX0_D1P/D1NLVDS_TX0_D2P/D2NLVDS_TX0_CLKP/CLKN
8-bit LVDS5 pairs4 pairs1 pairLVDS_TX0_D0P/D0NLVDS_TX0_D1P/D1NLVDS_TX0_D2P/D2NLVDS_TX0_D3P/D3NLVDS_TX0_CLKP/CLKN

Among them, 6-bit uses 4 pairs of differential signal lines, of which 3 pairs are data lines and 1 pair is a clock line. 8-bit uses 5 pairs of differential signal lines, of which 4 pairs are data lines and 1 pair is a clock line. It is easy to distinguish between 6-bit and 8-bit by the number of differential signal lines. After distinguishing between 6-bit and 8-bit, it is necessary to distinguish between single-channel and dual-channel.

Comparison of Single-Channel and Dual-Channel LVDS

Single-channel can be understood as having only one LVDS interface, while dual-channel has two LVDS interfaces. Therefore, when distinguishing between 6-bit and 8-bit, the single-channel is taken as an example, because dual-channel only needs to multiply the original by 2.

As the screen resolution increases, the pixel clock also becomes higher. However, the pixel clock cannot increase indefinitely, so the pixels to be output are divided into odd and even pixels in order. Odd pixels are transmitted using one LVDS channel, and even pixels are transmitted using another LVDS channel. Therefore, theoretically, dual-channel LVDS supports higher resolutions.

Case Analysis

10.1-inch LVDS screen interface definition, as shown in the figure below:

Pin No.SymbolI/OFunctionRemark
1NCNo connection
2VDDPPower supply
3VDDPPower supply
4NCNo connection
5NCNo connection
6NCNo connection
7GNDPPower Ground
8Rxin0NI-LVDS differential data
9Rxin0PI+LVDS differential data
10GNDPGround
11Rxin1NI-LVDS differential data
12Rxin1PI+LVDS differential data
13GNDPGround
14Rxin2NI-LVDS differential data
15Rxin2PI+LVDS differential data
16GNDPGround
17RCLKNI-LVDS differential clock input
18RCLKPI+LVDS differential clock input
19GNDPGround
20Rxin3NI-LVDS differential data
21Rxin3PI+LVDS differential data
22GNDPGround
23NCNo connection
24NCNo connection
25GNDPPower Ground

There are a total of five pairs of differential lines: Rxin0N, Rxin0P; Rxin1N, Rxin1P; Rxin2N, Rxin2P; Rxin3N, Rxin3P; RCLKN, RCLKP. Among them, four pairs are data lines and one pair is a clock line, and there is only one LVDS interface, so it is a single 8-bit interface mode.

In addition to the difference in channel count and bit count, LVDS displays have two signal formats: the VESA standard and the JEIDA standard, among which:

  • VESA: Full name is Video Electronics Standards Association. This organization has established many standards related to video and display peripheral functions.

  • JEIDA: Full name is Japan Electronic Industry Development Association.

Therefore, when debugging the screen, pay attention to whether the default data format of the LVDS screen uses the VESA standard or the JEIDA standard, so as to determine whether the driver outputs using the VESA standard or the JEIDA standard.

Hardware Schematic Analysis

The iTOP-RK3568 development board has an LVDS interface, and the interface schematic is as follows:

iTOP-RK3568 LVDS Interface
iTOP-RK3568 LVDS Interface

  1. TP_RST_L_GPIO0_B6 is the touch reset pin.

  2. I2C2_SCL_M1 is the I2C2 SCL pin, used for I2C communication with the touch chip._SDA_M1 is the I2C2 SDA pin, used for I2C communication with the touch chip.

  3. TP_INT_L_GPIO3_A5 is the touch interrupt pin.

  4. LCD0_BL_PWM4 is the PWM pin, used to adjust the screen backlight.

  5. MIPI_DSI_TX0_D3N/LVDS_TX0_D3N、MIPI_DSI_TX0_D3P/LVDS_TX0_D3P、MIPI_DSI_TX0_D0N/LVDS_TX0_D0N、MIPI_DSI_TX0_D0P/LVDS_TX0_D0P、MIPI_DSI_TX0_D1N/LVDS_TX0_D1N、MIPI_DSI_TX0_D1P/LVDS_TX0_D1P、
    MIPI_DSI_TX0_D2N/LVDS_TX0_D2N、MIPI_DSI_TX0_D2P/LVDS_TX0_D2P、MIPI_DSI_TX0_CLKN/LVDS_TX0_CLKN、MIPI_DSI_TX0_CLKP/LVDS_TX0_CLKP is an LVDS interface pin, directly connected one-to-one to the processor’s LVDS interface.

  6. J38 is a jumper cap socket, used to prevent burning the screen and CPU due to incorrect screen connection. After checking the hardware connections, use a jumper cap to connect the power.

Adaptation Steps

Setting the LVDS Display Path

When using the LVDS interface, you can choose VP1 or VP2. VP1 supports not only LVDS output but also MIPI, eDP, and HDMI output. VP2 only supports LVDS and RGB output. If VP1 is used for LVDS signal output, other signals such as MIPI, eDP, and HDMI cannot be used. Therefore, the development board selects VP2, which supports fewer signals, for LVDS output, leaving VP1, which supports more signals, for other options.

Connection relationship between RK3568 VP and each display interface:

RK3568 VP and display interface connection relationships:
RK3568 VP and display interface connection relationships:

Before setting VP2 as the LVDS display path, the VOP node must be enabled first.rk3568.dtsiis defined as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
vop: vop@fe040000 {
compatible = "rockchip,rk3568-vop";
reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
reg-names = "regs", "gamma_lut";
rockchip,grf = <&grf>;
interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>, <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>;
clock-names = "aclk_vop", "hclk_vop", "dclk_vp0", "dclk_vp1", "dclk_vp2";
iommus = <&vop_mmu>;
power-domains = <&power RK3568_PD_VO>;
status = "disabled";

vop_out: ports {
#address-cells = <1>;
#size-cells = <0>;

vp0: port@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;

vp0_out_dsi0: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi0_in_vp0>;
};

vp0_out_dsi1: endpoint@1 {
reg = <1>;
remote-endpoint = <&dsi1_in_vp0>;
};

vp0_out_edp: endpoint@2 {
reg = <2>;
remote-endpoint = <&edp_in_vp0>;
};

vp0_out_hdmi: endpoint@3 {
reg = <3>;
remote-endpoint = <&hdmi_in_vp0>;
};
};

vp1: port@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;

vp1_out_dsi0: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi0_in_vp1>;
};

vp1_out_dsi1: endpoint@1 {
reg = <1>;
remote-endpoint = <&dsi1_in_vp1>;
};

vp1_out_edp: endpoint@2 {
reg = <2>;
remote-endpoint = <&edp_in_vp1>;
};

vp1_out_hdmi: endpoint@3 {
reg = <3>;
remote-endpoint = <&hdmi_in_vp1>;
};

vp1_out_lvds: endpoint@4 {
reg = <4>;
remote-endpoint = <&lvds_in_vp1>;
};

vp1_out_lvds1: endpoint@5 {
reg = <5>;
remote-endpoint = <&lvds1_in_vp1>;
};
};

vp2: port@2 {
#address-cells = <1>;
#size-cells = <0>;

reg = <2>;

vp2_out_lvds: endpoint@0 {
reg = <0>;
remote-endpoint = <&lvds_in_vp2>;
};

vp2_out_rgb: endpoint@1 {
reg = <1>;
remote-endpoint = <&rgb_in_vp2>;
};

vp2_out_lvds1: endpoint@2 {
reg = <2>;
remote-endpoint = <&lvds1_in_vp2>;
};
};
};
};

After enabling VOP, next set the LVDS interface to use VP2 output for the display path. Open therk3568.dtsidevice tree file and locate the LVDS node.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
grf: syscon@fdc60000 {
compatible = "rockchip,rk3568-grf", "syscon", "simple-mfd";
reg = <0x0 0xfdc60000 0x0 0x10000>;

io_domains: io-domains {
compatible = "rockchip,rk3568-io-voltage-domain";
status = "disabled";
};

lvds0: lvds: lvds {
compatible = "rockchip,rk3568-lvds";
phys = <&video_phy0>;
phy-names = "phy";
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

lvds0_in_vp1: lvds_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_lvds>;
status = "disabled";
};

lvds0_in_vp2: lvds_in_vp2: endpoint@2 {
reg = <2>;
remote-endpoint = <&vp2_out_lvds>;
status = "disabled";
};
};
};
};

lvds1: lvds1 {
compatible = "rockchip,rk3568-lvds";
phys = <&video_phy1>;
phy-names = "phy";
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

lvds1_in_vp1: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp1_out_lvds1>;
};

lvds1_in_vp2: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp2_out_lvds1>;
};
};
};
};

rgb: rgb {
compatible = "rockchip,rk3568-rgb";
pinctrl-names = "default";
pinctrl-0 = <&lcdc_ctl>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

rgb_in_vp2: endpoint@2 {
reg = <2>;
remote-endpoint = <&vp2_out_rgb>;
status = "disabled";
};
};
};
};

};

compatibleThe attribute value isrockchip,rk3568-lvds, indicating that thegpu/drm/rockchip/rockchip_lvds.cdriver will be used.

phys = <&video_phy0>;: usesvideo_phy0, so we need to enable thevideo_phy0node.

statusThe attribute value isdisabled, indicating that the LVDS node is disabled, so we need to enable the LVDS node.

portsAttribute node: indicates the VP port corresponding to the LVDS interface. For the RK3568 LVDS interface, VP2 must be used for output.

lvds_in_vp2indicates that the LVDS interface is connected to VP2, and the status attribute value of disabled means that using VP2 to output LVDS is prohibited.

You can add the following code in thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file to set up the LVDS display path.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
&lvds {
status = "disabled";

ports {
port@1 {
reg = <1>;
lvds_out_panel: endpoint {
remote-endpoint = <&panel_in_lvds>;
};
};
};
};

&lvds {
status = "okay";
};

&lvds_in_vp1{
status = "disabled";
};
&lvds_in_vp2 {
status = "okay";
};
&video_phy0{
status="okay";
};

Note that VP1 must be disabled and VP2 enabled to output LVDS.

video_phy0The node is shown in the figure:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

video_phy0: phy@fe850000 {
// Specify the compatible driver for device-driver matching.
compatible = "rockchip,rk3568-dsi-dphy", "rockchip,rk3568-video-phy";
//Register address mapping: define two physical address ranges.
reg = <0x0 0xfe850000 0x0 0x10000>,
<0x0 0xfe060000 0x0 0x10000>;
reg-names = "phy", "host";
// Clock signal configuration: reference three clock sources.
// ref: PHY reference clock (e.g., MIPI DSI high-speed clock).
// pclk_phy: APB bus clock for the PHY module.
// pclk_host: APB bus clock for the host controller (e.g., DSI TX).
clocks = <&pmucru CLK_MIPIDSIPHY0_REF>,
<&cru PCLK_MIPIDSIPHY0>, <&cru PCLK_DSITX_0>;
clock-names = "ref", "pclk", "pclk_host";
#clock-cells = <0>;
// Reset control: associate the soft reset signal of the PHY module.
resets = <&cru SRST_P_MIPIDSIPHY0>;
reset-names = "apb";
// Power domain management: bind to the display subsystem power domain.
power-domains = <&power RK3568_PD_VO>;
#phy-cells = <0>;
// Initial state: disabled by default.
status = "disabled";
};

video_phy1: phy@fe860000 {
compatible = "rockchip,rk3568-dsi-dphy", "rockchip,rk3568-video-phy";
reg = <0x0 0xfe860000 0x0 0x10000>,
<0x0 0xfe070000 0x0 0x10000>;
reg-names = "phy", "host";
clocks = <&pmucru CLK_MIPIDSIPHY1_REF>,
<&cru PCLK_MIPIDSIPHY1>, <&cru PCLK_DSITX_1>;
clock-names = "ref", "pclk", "pclk_host";
#clock-cells = <0>;
resets = <&cru SRST_P_MIPIDSIPHY1>;
reset-names = "apb";
power-domains = <&power RK3568_PD_VO>;
#phy-cells = <0>;
status = "disabled";
};

Set screen information.

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/{
lvds_panel: panel {
compatible = "simple-panel";
status = "disabled";
backlight = <&backlight>;
power-supply = <&vcc3v3_lcd0_n>;
enable-delay-ms = <20>;
prepare-delay-ms = <20>;
unprepare-delay-ms = <20>;
disable-delay-ms = <20>;
width-mm = <217>;
height-mm = <136>;
};
};

&lvds_panel{
status = "okay";
bus-format = <MEDIA_BUS_FMT_RGB666_1X7X3_SPWG>;
display-timings {
native-mode = <&lvds_timing0>;
lvds_timing0: lvds-timing0 {
clock-frequency = <71900000>;
hactive = <800>;
vactive = <1280>;
hback-porch = <24>;//<100>;
hfront-porch = <72>;//<1580>;
vback-porch = <10>;//<25>;
vfront-porch = <12>;//<10>;
hsync-len = <24>;//<10>;
vsync-len = <2>;//<4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_lvds: endpoint {
remote-endpoint = <&lvds_out_panel>;
};
};
};
};

bus-formatThe attribute is used to configure the output format, which must correspond to the format supported by the LVDS screen, where:

  • Attribute value MEDIA_BUS_FMT_RGB666_1X7X3_SPWG indicates using JEIDA_6BIT
  • Attribute value MEDIA_BUS_FMT_RGB888_1X7X4_SPWG indicates using VESA_8BIT
  • Attribute value MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA indicates using JEIDA_8BIT

Set backlight and touch

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAdd the following code to the device tree file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/ {
backlight: backlight {
compatible = "pwm-backlight";
brightness-levels = <
0 20 20 21 21 22 22 23
23 24 24 25 25 26 26 27
27 28 28 29 29 30 30 31
31 32 32 33 33 34 34 35
35 36 36 37 37 38 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <200>;
};

backlight1: backlight1 {
compatible = "pwm-backlight";
brightness-levels = <
0 20 20 21 21 22 22 23
23 24 24 25 25 26 26 27
27 28 28 29 29 30 30 31
31 32 32 33 33 34 34 35
35 36 36 37 37 38 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <200>;
};
};

&i2c2 {
status = "okay";
pinctrl-0 = <&i2c2m1_xfer>;

ft5x062:ft5x06@38 {
status = "disabled";
compatible = "edt,edt-ft5306";
reg = <0x38>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <800>;
touchscreen-size-y = <1280>;

};

gt9xx:gt9xx_ts@5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&gt9xx_pins>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
status = "disabled";
tp-size = <911>;
max-x = <1024>;
max-y = <600>;
};

gt9271:gt9271_ts@5d {
compatible = "goodix,gt9271";
reg = <0x5d>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&gt9xx_pins>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
status = "disabled";
tp-size = <9271>;
max-x = <1280>;
max-y = <800>;
};
};

&pinctrl {
gt9xx {
gt9xx_pins: gt9xx-pins {
rockchip,pins =
<3 RK_PA5 0 &pcfg_pull_up>,
<0 RK_PB6 0 &pcfg_pull_none>;
};
};
};

&pwm4{
status = "okay";
};

&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};

&gt9271
{
status = "okay";
};

Set screen LOGO

1
2
3
4
5
&route_lvds{
// logo,rotate = <0>;
status = "okay";
connect = <&vp2_out_lvds>;
};

Set macro switch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
#define LCD_TYPE_MIPI       //in vp 1
//#define LCD_TYPE_LVDS_10_1_1024X600 //in vp 2
//#define LCD_TYPE_LVDS_10_1_1280X800_gt9271 //in vp 2
//#define LCD_TYPE_LVDS_7_0 //in vp 2
//#define LCD_TYPE_EDP_VGA //in vp 0
//#define LCD_TYPE_HDMI_VP0 //hdmi in vp 0
//#define LCD_TYPE_HDMI_VP1 //hdmi in vp 1


/ {
backlight: backlight {
compatible = "pwm-backlight";
brightness-levels = <
0 20 20 21 21 22 22 23
23 24 24 25 25 26 26 27
27 28 28 29 29 30 30 31
31 32 32 33 33 34 34 35
35 36 36 37 37 38 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <200>;
};

backlight1: backlight1 {
compatible = "pwm-backlight";
brightness-levels = <
0 20 20 21 21 22 22 23
23 24 24 25 25 26 26 27
27 28 28 29 29 30 30 31
31 32 32 33 33 34 34 35
35 36 36 37 37 38 38 39
40 41 42 43 44 45 46 47
48 49 50 51 52 53 54 55
56 57 58 59 60 61 62 63
64 65 66 67 68 69 70 71
72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87
88 89 90 91 92 93 94 95
96 97 98 99 100 101 102 103
104 105 106 107 108 109 110 111
112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127
128 129 130 131 132 133 134 135
136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151
152 153 154 155 156 157 158 159
160 161 162 163 164 165 166 167
168 169 170 171 172 173 174 175
176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191
192 193 194 195 196 197 198 199
200 201 202 203 204 205 206 207
208 209 210 211 212 213 214 215
216 217 218 219 220 221 222 223
224 225 226 227 228 229 230 231
232 233 234 235 236 237 238 239
240 241 242 243 244 245 246 247
248 249 250 251 252 253 254 255
>;
default-brightness-level = <200>;
};

lvds_panel: panel {
compatible = "simple-panel";
status = "disabled";
backlight = <&backlight>;
power-supply = <&vcc3v3_lcd0_n>;
enable-delay-ms = <20>;
prepare-delay-ms = <20>;
unprepare-delay-ms = <20>;
disable-delay-ms = <20>;
width-mm = <217>;
height-mm = <136>;
};
};

&i2c1 {
status = "okay";
ft5x061:ft5x06@38 {
status = "disabled";
compatible = "edt,edt-ft5306";
reg = <0x38>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <800>;
touchscreen-size-y = <1280>;

};
};

&i2c2 {
status = "okay";
pinctrl-0 = <&i2c2m1_xfer>;
ft5x062:ft5x06@38 {
status = "disabled";
compatible = "edt,edt-ft5306";
reg = <0x38>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touchscreen-size-x = <800>;
touchscreen-size-y = <1280>;

};

gt9xx:gt9xx_ts@5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&gt9xx_pins>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
status = "disabled";
tp-size = <911>;
max-x = <1024>;
max-y = <600>;

};

gt9271:gt9271_ts@5d {

compatible = "goodix,gt9271";
reg = <0x5d>;
interrupt-parent = <&gpio3>;
interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&gt9xx_pins>;
reset-gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_LOW>;
touch-gpio = <&gpio3 RK_PA5 IRQ_TYPE_EDGE_RISING>;
status = "disabled";
tp-size = <9271>;
max-x = <1280>;
max-y = <800>;
};


};

&pinctrl {
gt9xx {
gt9xx_pins: gt9xx-pins {
rockchip,pins =
<3 RK_PA5 0 &pcfg_pull_up>,
<0 RK_PB6 0 &pcfg_pull_none>;
};
};
};


#if defined(LCD_TYPE_LVDS_7_0)
&lvds_panel{
status = "okay";
bus-format = <MEDIA_BUS_FMT_RGB666_1X7X3_SPWG>;
display-timings {
native-mode = <&lvds_timing0>;
lvds_timing0: lvds-timing0 {
clock-frequency = <71900000>;
hactive = <800>;
vactive = <1280>;
hback-porch = <24>;//<100>;
hfront-porch = <72>;//<1580>;
vback-porch = <10>;//<25>;
vfront-porch = <12>;//<10>;
hsync-len = <24>;//<10>;
vsync-len = <2>;//<4>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_lvds: endpoint {
remote-endpoint = <&lvds_out_panel>;
};
};
};
};
&lvds {
status = "disabled";

ports {
port@1 {
reg = <1>;
lvds_out_panel: endpoint {
remote-endpoint = <&panel_in_lvds>;
};
};
};
};

&pwm4{
status = "okay";
};

&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};

&lvds {
status = "okay";
};

&lvds_in_vp1{
status = "disabled";
};
&lvds_in_vp2 {
status = "okay";
};
&video_phy0{
status="okay";
};
&route_lvds{
// logo,rotate = <0>;
status = "okay";
connect = <&vp2_out_lvds>;
};

&ft5x062
{
status = "okay";
};
#endif

#if defined(LCD_TYPE_LVDS_10_1_1024X600)
&lvds_panel {
status = "okay";
bus-format = <MEDIA_BUS_FMT_RGB666_1X7X3_SPWG>;
display-timings {
native-mode = <&lvds_timing0>;
lvds_timing0: lvds-timing0 {
clock-frequency = <53000000>;
hactive = <1024>;
vactive = <600>;
hback-porch = <160>;//<100>;
hfront-porch = <24>;//<1580>;
vback-porch = <24>;//<25>;
vfront-porch = <2>;//<10>;
hsync-len = <116>;//<10>; DRM_PANEL_SIMPLE
vsync-len = <3>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_lvds: endpoint {
remote-endpoint = <&lvds_out_panel>;
};
};
};
};
&lvds {
status = "disabled";

ports {
port@1 {
reg = <1>;
lvds_out_panel: endpoint {
remote-endpoint = <&panel_in_lvds>;
};
};
};
};
&pwm4{
status = "okay";
};

&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};
&lvds {
status = "okay";
};

&lvds_in_vp1{
status = "disabled";
};

&lvds_in_vp2 {
status = "okay";
};

&video_phy0{
status="okay";
};

&route_lvds{
// logo,rotate = <0>;
status = "okay";
connect = <&vp2_out_lvds>;
};

&gt9xx
{
status = "okay";
};
#endif

#if defined(LCD_TYPE_LVDS_10_1_1280X800_gt9271)
&lvds_panel {
status = "okay";
bus-format = <MEDIA_BUS_FMT_RGB888_1X7X4_SPWG>;
display-timings {
native-mode = <&lvds_timing0>;
lvds_timing0: lvds-timing0 {
clock-frequency = <82421000>;
hactive = <1280>;
vactive = <800>;
hback-porch = <88>;//<100>;
hfront-porch = <132>;//<1580>;
vback-porch = <23>;//<25>;
vfront-porch = <49>;//<10>;
hsync-len = <40>;//<10>; DRM_PANEL_SIMPLE
vsync-len = <20>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
dual-lvds-even-pixels;
panel_in_lvds: endpoint {
remote-endpoint = <&lvds_out_panel>;
};
};
};
};
&lvds {
status = "disabled";

ports {
port@1 {
reg = <1>;
lvds_out_panel: endpoint {
remote-endpoint = <&panel_in_lvds>;
};
};
};
};

&pwm4{
status = "okay";
};

&backlight {
status = "okay";
pwms = <&pwm4 0 25000 0>;
};

&lvds {
status = "okay";
};

&lvds_in_vp1{
status = "disabled";
};
&lvds_in_vp2 {
status = "okay";
};
&video_phy0{
status="okay";
};
&route_lvds{
// logo,rotate = <0>;
status = "okay";
connect = <&vp2_out_lvds>;
};

&gt9271
{
status = "okay";
};
#endif

MIPI screen porting

MIPI interface introduction

The MIPI Alliance was founded in 2003, jointly initiated by companies such as ARM, Nokia, ST (STMicroelectronics), and TI (Texas Instruments).

MIPI interface, full name isMobile Industry Processor Interface(Mobile Industry Processor Interface) is a series of open standards and specifications developed by the MIPI Alliance. These standards aim to provide a unified interface solution for mobile application processors, standardizing various internal interfaces in mobile phones (such as camera, display, RF/baseband interfaces, etc.), thereby reducing the complexity of phone design.

It should be noted that MIPI does not refer to a single interface or protocol, but rather a system that includes multiple interface standards.

For example:

  • MIPI DSI: Used for Display Serial Interface.
  • MIPI CSI: Used for Camera Serial Interface.
  • MIPI I3C: Used for serial communication interface (improved version of I2C).
  • MIPI RFFE: Used for RF Front-End Control Interface.
  • MIPI SPMI: Used for System Power Management Interface.

In this chapter, we will focus on MIPI DSI and will not cover other interfaces for now. The schematic diagram of MIPI-related interface usage in mobile devices is shown below.

MIPI Alliance
MIPI Alliance

Introduction to the MIPI DSI interface of the RK3568 processor in the datasheet:

RK3568 MIPI
RK3568 MIPI

  • Supports MIPI v1.2 version
  • Supports dual-channel DSI
  • Each channel supports 4 data lanes
  • Supports a maximum data rate of 2.5Gbps per lane
  • Single MIPI mode supports display output up to 1920x1080@60Hz, and dual MIPI mode supports display output up to 2560x1440@60Hz.
  • Each color channel supports up to 8-bit depth

For a single-channel MIPI screen, one MIPI interface is sufficient. Connection diagram:

Single-channel MIPI screen
Single-channel MIPI screen

A dual-channel MIPI screen requires two MIPI interfaces. Connection diagram:

Dual-channel MIPI screen
Dual-channel MIPI screen

RK3568 core board MIPI DSI interface pins

MIPI DSI0 interface:

PinFunction
MIPI_DSI_TX0_D0P/LVDS_TX0_D0PMIPI DSI TX0 D0P pin or LVDS TX0 D0P pin
MIPI_DSI_TX0_D0N/LVDS_TX0_D0NMIPI DSI TX0 D0N pin or LVDS TX0 D0N pin
MIPI_DSI_TX0_D1P/LVDS_TX0_D1PMIPI DSI TX0 D1P pin or LVDS TX0 D1P pin
MIPI_DSI_TX0_D1N/LVDS_TX0_D1NMIPI DSI TX0 D1N pin or LVDS TX0 D1N pin
MIPI_DSI_TX0_D2P/LVDS_TX0_D2PMIPI DSI TX0 D2P pin or LVDS TX0 D2P pin
MIPI_DSI_TX0_D2N/LVDS_TX0_D2NMIPI DSI TX0 D2N pin or LVDS TX0 D2N pin
MIPI_DSI_TX0_D3P/LVDS_TX0_D3PMIPI DSI TX0 D3P pin or LVDS TX0 D3P pin
MIPI_DSI_TX0_D3N/LVDS_TX0_D3NMIPI DSI TX0 D3N pin or LVDS TX0 D3N pin
MIPI_DSI_TX0_CLKP/LVDS_TX0_CLKPMIPI DSI TX0 CLKP pin or LVDS TX0 CLKP pin
MIPI_DSI_TX0_CLKN/LVDS_TX0_CLKNMIPI DSI TX0 CLKN pin or LVDS TX0 CLKN pin

The MIPI DSI0 interface and LVDS0 interface share a multiplexing relationship. On the iTOP-RK3568 development board, this interface is multiplexed as an LVDS interface.

MIPI DSI1 interface:

PinFunction
MIPI_DSI_TX1_D0PMIPI DSI TX1 D0P pin
MIPI_DSI_TX1_D0NMIPI DSI TX1 D0N pin
MIPI_DSI_TX1_D1PMIPI DSI TX1 D1P pin
MIPI_DSI_TX1_D1NMIPI DSI TX1 D1N pin
MIPI_DSI_TX1_D2PMIPI DSI TX1 D2P pin
MIPI_DSI_TX1_D2NMIPI DSI TX1 D2N pin
MIPI_DSI_TX1_D3PMIPI DSI TX1 D3P pin
MIPI_DSI_TX1_D3NMIPI DSI TX1 D3N Pin
MIPI_DSI_TX1_CLKPMIPI DSI TX1 CLKP Pin
MIPI_DSI_TX1_CLKNMIPI DSI TX1 CLKN Pin

Introduction to MIPI Protocol

lane

In the hardware connection block diagram of the MIPI protocol specification, the term ‘lane’ is mentioned. Lane can be understood as a channel. For example, 2 lanes can be understood as 2 channels, each channel having 2 differential data lines. For instance, MIPI_DSI_TX1_D0P and MIPI_DSI_TX1_A pair of data pins, D0N, can be considered as 1 lane, i.e., 1 channel. In the MIPI chapter, lane and channel are not distinguished and have the same meaning.

Host Device and Peripheral
Host Device and Peripheral

The above block diagram tells us that we can use 1/2/3/4 lanes and a pair of clock lines for data transmission. For the MIPI interface of the RK3568 core board, 4 lanes are used for data transmission.

The above figure also tells us that in LP (Low-Power) mode, only Lane0 is used for transmission, and bidirectional transmission is possible. In HS (High-Speed) mode, only unidirectional transmission is possible.

Let’s look at the framework diagram of a single lane:

Single Lane
Single Lane

A channel may contain an HS-TX, an HS-RX, or both.

In a single channel, HS-TX and HS-RX are not enabled simultaneously during normal operation, so for HS (High-Speed) mode, it is unidirectional transmission.

If the High-Speed function in a channel is not enabled, this function should be placed in a high-impedance state.

The Low-Power Contention Detector (LP-CD) function is only used for bidirectional operation. The Low-Power Contention Detector function is enabled when the low-power transmitter drives a low-power state to detect contention.

Signal Level

In LP (Low-Power) mode, only Lane0 is used for transmission, employing single-ended signals with a signal level ranging from 0 to 1.2V.

In HS (High-Speed) mode, differential signals are used for transmission. When P is higher than N, it is defined as 1; when P is lower than N, it is defined as 0. The typical voltage on the differential line is 200mV differential.

Signal Level
Signal Level

In the figure above, the blue solid line represents the signal waveform in LP (Low-Power) mode, and the red solid line represents the signal waveform in HS (High-Speed) mode.

Channel State

In HS (High-Speed) mode, differential signals are used. When P is higher than N, it is defined as 1, called HS-1; when P is lower than N, it is defined as 0, called HS-0. Therefore, in HS (High-Speed) mode, there are two states: HS-1 and HS-0.

In LP (Low-Power) mode, single-ended signals are used, so there are four states: 00, 01, 10, and 11, respectively called LP-00, LP-01, LP-10, and LP-11.

Channel State
Channel State

Three Operating Modes

The lanes are:

  • Control Mode
  • High-Speed Mode
  • Escape Mode

There are three operating modes: High-Speed mode operates in HS (High-Speed) mode, while Control mode and Escape mode operate in LP (Low-Power) mode.

These three working modes can be switched between each other. The control mode operates in LP (Low-Power) mode, so there are four states: LP-00, LP-01, LP-10, and LP-11. In the MIPI protocol, different timings composed of the four states of the control mode are used to represent entering or exiting a certain mode. For example, LP11-LP01-LP00 indicates entering high-speed mode.

According to the MIPI protocol specification, the process of entering and exiting different modes is as follows:

  1. Each mode must start from the Stop State (LP-11).
  2. Direct switching between High-speed mode and Escape mode is not allowed; it must be mediated through Control mode, i.e.:
    • High-speed mode ↔ Control Mode ↔ Escape mode.
  3. Process of entering and exiting Escape mode:
    • Request:LP-11→LP-10→LP-00→LP-01→LP-00
    • Exit:LP-10→LP-11
  4. Process of entering and exiting High-Speed mode:
    • Request:LP-11→LP-01→LP-00
    • Exit:EOT →LP-11
  5. Process of entering and exiting Control mode:
    • Request:LP-11→LP-10→LP-00→LP-10→LP-00
    • Exit:LP-00→LP-10→LP-11

Escape mode is a special mode of the data lane in the LP (Low-Power) state. In this mode, there are functions such as LPDT (Low-Power Data Transmission mode), ULPS (Ultra-Low Power State), and Trigger. Once entering Escape mode, the transmitter must send an 8-bit command to respond to the requested action. The commands are as follows:

Escape Mode ActionCommand TypeEntry Command Pattern (first bit transmitted to last bit transmitted)
Low-Power Data Transmissionmode11100001
Ultra-Low Power Statemode00011110
Undefined-1mode10011111
Undefined-2mode11011110
Reset-Trigger [Remote Application]Trigger01100010
Entry sequence for HS Test ModeTrigger01011101
Unknown-4Trigger00100001
Unknown-5Trigger10100000

If not in High-speed mode or Escape mode, the data lane should remain in Control mode.

Introduction to MIPI D-PHY

In addition to D-PHY, MIPI also has C-PHY and M-PHY. PHY refers to the physical layer. For example, D-PHY can be used for camera and display peripherals, C-PHY can also be used for camera and display peripherals, and M-PHY can be used for camera and storage peripherals.

M-PHY D-PHY C-PHY
M-PHY D-PHY C-PHY

The D in D-PHY refers to the Roman numeral 500 (the original design target was 500 Mbits/s), not Display, while C and M represent the Roman numerals 100 and 1000, respectively.

MIPI DSI

The PHY mentioned in the previous section belongs to the physical layer, so for MIPI DSI, it is a layered structure. The structure diagram is as follows:

MIPI DSI Layered Structure
MIPI DSI Layered Structure

As can be seen from the figure above, there are a total of 4 layers, from bottom to top as follows:

  • PHY Layer
  • Channel Management Layer
  • Protocol Layer
  • Application Layer

PHY Layer

The physical layer is at the bottom of the entire layered structure. It specifies related electrical properties, such as transmission medium, electrical characteristics, IO circuits, and synchronization mechanisms.

The physical layer also specifies the mechanisms for Start of Transmission (SoT) and End of Transmission (EoT), as well as other ‘out-of-band’ information that can be transmitted between the transmitting and receiving physical layers.

The physical layer supports HS (High-Speed) mode and LP (Low-Power) mode. HS mode can be used to transmit high-speed data, such as screen data. LP mode is generally used for control, such as configuration commands.

Channel Management Layer

The number of data signal pairs may be 1, 2, 3, or 4, depending on the bandwidth requirements of the application. At the transmitting end of the interface, the data stream is distributed to one or more channels, functioning as a ‘distributor’. At the receiving end, the interface collects bytes from the channels and merges them into a reassembled data stream to restore the original stream sequence, functioning as a ‘merger’.

Let’s look at these two figures from the MIPI protocol specification:

Transmitting end:

Transmitting end
Transmitting end

The left side of the figure above shows the transmission method using 1 pair of data lines. When only 1 pair of data lines is used, transmission can only be done in serial order.

The right side of the figure above shows the transmission method using 4 data lane pairs. The transmitter evenly distributes the serial data to the 4 data lane pairs for parallel transmission. This is the “distributor” function.

Receiver:

Receiver
Receiver

The left side of the figure above shows the reception method using 1 data lane pair. When only 1 data lane pair is used, reception can only be done in serial order.

The right side of the figure above shows the reception method using 4 data lane pairs. The receiver merges the parallel data into serial data. This is the “merger” function.

When the transmitter uses 4 data lane pairs, it can evenly distribute as Byte0 to Lane0, Byte1 to Lane1, Byte2 to Lane2, Byte3 to Lane4, but if 3 data lane pairs are used, even distribution is not possible. In the MIPI protocol specification, it is explained as follows: for non-integer multiple transmissions (integer multiples of 2 data lane pairs), the following mode is adopted:

Non-integer multiple transmission
Non-integer multiple transmission

As can be seen from the figure above, if transmission is not done in integer multiples (i.e., all lanes ending together), whichever lane finishes transmission first will enter Eot mode first.

Protocol layer

The protocol layer mainly organizes bytes into predefined units, which are called packets. That is, the packing operation. Data is packed intolong packetsandshort packetstwo formats.

Short packet format

Short packet format
Short packet format

From the figure above, the short packet occupies a total of 4 bytes, including 1 byte for DI, 2 bytes for data, and 1 byte for ECC

  1. Data Identifier (DI): Contains virtual channel identifier and data type information. The data type indicates the format/content of application-specific payload data. Used by the application layer.
  2. Packet data: Fixed length of two bytes, with no value restrictions on the data.
  3. 8-bit ECC in the packet header: Used to correct single-bit errors and detect double-bit errors.

Here, the DI part is highlighted. The DI part consists of two components: the virtual channel and the payload data type.

DI
DI

Bits 6 to 7 represent the virtual channel. The DSI protocol allows up to four virtual channels, enabling multiple peripherals to share a common DSI link.

Bits 0 to 5 represent the payload data type to be sent. The payload data types are:

Data Type (hex)Data Type (binary)DescriptionPacket Size
0x0100 0001Sync Event, V Sync StartShort
0x1101 0001Sync Event, V Sync EndShort
0x2110 0001Sync Event, H Sync StartShort
0x3111 0001Sync Event, H Sync EndShort
0x0800 1000End of Transmission packet (EoTp)Short
0x0200 0010Color Mode (CM) Off CommandShort
0x1201 0010Color Mode (CM) On CommandShort
0x2210 0010Shut Down Peripheral CommandShort
0x3211 0010Turn On Peripheral CommandShort
0x0300 0011Generic Short WRITE, no parametersShort
0x1301 0011Generic Short WRITE, 1 parameterShort
0x2310 0011Generic Short WRITE, 2 parametersShort
0x0400 0100Generic READ, no parametersShort
0x1401 0100Generic READ, 1 parameterShort
0x2410 0100Generic READ, 2 parametersShort
0x0500 0101DCS Short WRITE, no parametersShort
0x1501 0101DCS Short WRITE, 1 parameterShort
0x0600 0110DCS READ, no parametersShort
0x3700 1111Set Maximum Return Packet SizeShort
0x0900 1001Null Packet, no dataLong
0x1901 1001Blanking Packet, no dataLong
0x2910 1001Generic Long WriteLong
0x3911 1001DCS Long Write/write_LUT Command PacketLong
0x0C00 1100Loosely Packed Pixel Stream, 20-bit YCbCr, 4:2:2 FormatLong
0x1C01 1100Packed Pixel Stream, 24-bit YCbCr, 4:2:2 FormatLong
0x2C10 1100Packed Pixel Stream, 16-bit YCbCr, 4:2:2 FormatLong
0x0D00 1101Packed Pixel Stream, 30-bit RGB, 10-10-10 FormatLong
0x1D01 1101Packed Pixel Stream, 36-bit RGB, 12-12-12 FormatLong
Long packet format

Long packet format
Long packet format

A long packet consists of three parts: a 32-bit packet header (PH), an application-specific data payload with a variable number of bytes, and a 16-bit packet footer (PF).

The packet header (PH) further consists of three parts: an 8-bit data identifier (DI), a 16-bit word count, and an 8-bit error correction code (ECC).

Packet transmission method

In MIPI DSI data transmission, the packed data packets are sent via data lanes. In its simplest transmission method, a single transmission may contain only one data packet. If multiple data packets need to be transmitted, and they are transmitted individually (e.g., one packet per transmission), frequent switching between LPS (Low Power State) and HS (High-Speed) modes is required, and the resulting overhead severely limits bandwidth. The transmission process is as follows:

Packet transmission method
Packet transmission method

Why is it necessary to frequently switch between LPS (Low Power State) and HS (High-Speed) modes?

As shown in the figure above, after the SP (Short Packet) transmission is completed, an EoT (End of Transmission) signal is generated to exit the HS (High-Speed) mode. If not in HS (High-Speed) mode or Escape mode, the data lane should remain in control mode. Control mode operates in LP (Low-Power) mode, which is the LPS (Low Power State). For the next transmission, it is necessary to re-enter HS (High-Speed) mode for transmission. Therefore, frequent switching is required.

Therefore, the MIPI DSI protocol allows multiple packets to be concatenated for transmission, with long packets and short packets appearing in any order, which can significantly improve effective bandwidth. This approach is very useful for events such as peripheral initialization, because during system startup, many registers may need to be loaded using separate write commands.

The transmission process is as follows:

Concatenating multiple packets for transmission
Concatenating multiple packets for transmission

At the physical layer (PHY layer), there are two data transmission modes: HS (High-Speed) transmission mode and LP (Low-Power) transmission mode. Before the start of HS (High-Speed) transmission, the transmitter’s physical layer sends an SoT (Start of Transmission) sequence to the receiver. After that, data or command packets can be transmitted in high-speed mode. A single HS (High-Speed) transmission may contain multiple packets, and the end of transmission is always signaled at the physical layer using a dedicated EoT (End of Transmission) sequence.

To enhance the overall robustness of the system, DSI defines a dedicated EoT packet (EoTp) at the protocol layer to indicate the end of HS (High-Speed) transmission. For backward compatibility with earlier DSI, the EoTp function can be enabled or disabled. The method for enabling or disabling this function is beyond the scope of this document.

The figure below shows the HS (High-Speed) transmission process when using EoTp.

HS (High-Speed) transmission process when using EoTp
HS (High-Speed) transmission process when using EoTp

In the figure above, the EoT short packet is highlighted in red. The transmission process in the figure indicates that the host intends to use two separate transmissions to send one short packet each, followed by sending one long packet. In this transmission process, an additional EoT short packet is generated before the end of each transmission to signal the end of that transmission.

Of course, using the EoT short packet, multiple packets can also be concatenated for transmission. The transmission process is as follows:

Using the EoT short packet to concatenate multiple packets for transmission
Using the EoT short packet to concatenate multiple packets for transmission

  1. Packet Transmission Strategy

The MIPI specification stipulates that when transmitting multiple bytes, the low byte is transmitted first, followed by the high byte. The bits within each byte are transmitted in order of least significant bit first, most significant bit last, as shown in the figure below.

Low byte transmitted first, high byte transmitted later; bits within each byte are least significant bit first, most significant bit last
Low byte transmitted first, high byte transmitted later; bits within each byte are least significant bit first, most significant bit last

  1. Application Layer

High-level encoding and parsing of data streams

Video Mode and Command Mode

MIPI DSI has two modes: video mode and command mode. Which mode to use depends on the architecture and capabilities of the peripheral. Generally, a peripheral only needs to support one of these modes. However, some devices that support video mode also support some basic command mode functions.

Video Mode

Video mode is mainly used for LCD screens without a framebuffer. Regardless of whether the current display has data updates, the DSI host continuously sends data to the screen (requiring constant data refresh).

Video Mode
Video Mode

Three Transmission Methods of Video Mode

Explanation of Technical Terms
Explanation of Technical Terms

Non-Burst Mode with Sync Pulses

Enables the peripheral to accurately reconstruct the original video timing, including sync pulse widths. Precise timing reconstruction means that after DSI transmission, the data can be accurately restored to DPI timing at the receiving end. The timing diagram for this mode is as follows:

Non-Burst Mode with Sync Pulses Timing Diagram
Non-Burst Mode with Sync Pulses Timing Diagram

The Non-Burst Mode with Sync Pulses method requires accurate reconstruction of the original video timing, so signals such as VSYNC, HSYNC, HBP, and HFP can be seen in the timing diagram.

Non-Burst Mode with Sync Events

Non-Burst Mode with Sync Events Timing Diagram
Non-Burst Mode with Sync Events Timing Diagram

Similar to the Non-Burst Mode with Sync Pulses method, but it does not support accurate reconstruction of sync pulse widths. Therefore, signals such as VSE and HSE are not present in this timing diagram.

Burst Mode

Burst Mode Timing Diagram
Burst Mode Timing Diagram

In this mode, the RGB pixel time is compressed, leaving more time during line scanning for low-power modes or multiplexing other transmissions onto the DSI link. As shown in the timing diagram, RGB pixel data is transmitted as quickly as possible, then enters BLLP mode to save power.

Command Mode

Command mode is mainly used forLCD screens with a framebufferoperations, where the DSI host sends data to the screen only when the image needs to change.

It is mainly used for operating LCD screens with a framebuffer
It is mainly used for operating LCD screens with a framebuffer

In command mode, there is an important TE control signal, whose function is as follows:

If the LCD has its own timing controller and GRAM, to prevent tearing effects, it must actively notify the host. MIPI DSI defines a standard TE trigger message; upon receiving this message, pixel data is automatically sent.

Hardware Schematic Analysis

The iTOP-RK3568 development board has a MIPI interface, and the interface schematic is as follows:

iTOP-RK3568 MIPI Interface
iTOP-RK3568 MIPI Interface

  1. TP_RST_L_GPIO0_B6 is the touch reset pin.
  2. TP_INT_L_GPIO3_A5 is the touch interrupt pin.
  3. I2C1_SCL_TP is I2C1 SCL_TP pin. Used for I2C communication with the touch chip. I2C1_SDA_TP is I2C1_SDA pin. Used for I2C communication with the touch chip.
  4. LCD_EN_H_GPIO3_C6 is the screen enable pin
  5. LCD_RST_L_GPIO3_C7 is the screen reset pin
  6. LCD1_BL_PWM5 is the PWM pin, used to adjust the screen backlight.
  7. MIPI_DSI_TX1_D3N、MIPI_DSI_TX1_D3P、MIPI_DSI_TX1_D2N、MIPI_DSI_TX1_D2P、MIPI_DSI_TX1_CLKN、MIPI_DSI_TX1_CLKP、MIPI_DSI_TX1_D1N、MIPI_DSI_TX1_D1P、MIPI_DSI_TX1_D0N、MIPI_DSI_TX1_D0P is the MIPI1 interface pin. It is directly connected one-to-one to the processor’s MIPI1 interface, which is a 4-lane interface.

J37 is a jumper cap socket, used to prevent burning the screen and CPU due to incorrect screen connection. After checking the hardware connections, use a jumper cap to connect the power.

Adaptation Steps

Set MIPI Display Path

When using the MIPI interface, you can choose VP0 or VP1. Both VP0 and VP1 support MIPI0 and MIPI1. Since MIPI0 and LVDS interfaces are multiplexed on the development board and used for the LVDS interface, the MIPI interface on the development board uses MIPI1. The development board selects VP1 to output MIPI signals because VP0 can support a maximum resolution of up to 4K, which can be reserved for HDMI use.

Connection relationship between RK3568 VP and each display interface:

Connection relationship between RK3568 VP and each display interface:
Connection relationship between RK3568 VP and each display interface:

Before setting VP1 as the MIPI display path, you need to enable the VOP node first.rk3568.dtsiis defined as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
vop: vop@fe040000 {
compatible = "rockchip,rk3568-vop";
reg = <0x0 0xfe040000 0x0 0x3000>, <0x0 0xfe044000 0x0 0x1000>;
reg-names = "regs", "gamma_lut";
rockchip,grf = <&grf>;
interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>, <&cru DCLK_VOP0>, <&cru DCLK_VOP1>, <&cru DCLK_VOP2>;
clock-names = "aclk_vop", "hclk_vop", "dclk_vp0", "dclk_vp1", "dclk_vp2";
iommus = <&vop_mmu>;
power-domains = <&power RK3568_PD_VO>;
status = "disabled";

vop_out: ports {
#address-cells = <1>;
#size-cells = <0>;

vp0: port@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;

vp0_out_dsi0: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi0_in_vp0>;
};

vp0_out_dsi1: endpoint@1 {
reg = <1>;
remote-endpoint = <&dsi1_in_vp0>;
};

vp0_out_edp: endpoint@2 {
reg = <2>;
remote-endpoint = <&edp_in_vp0>;
};

vp0_out_hdmi: endpoint@3 {
reg = <3>;
remote-endpoint = <&hdmi_in_vp0>;
};
};

vp1: port@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;

vp1_out_dsi0: endpoint@0 {
reg = <0>;
remote-endpoint = <&dsi0_in_vp1>;
};

vp1_out_dsi1: endpoint@1 {
reg = <1>;
remote-endpoint = <&dsi1_in_vp1>;
};

vp1_out_edp: endpoint@2 {
reg = <2>;
remote-endpoint = <&edp_in_vp1>;
};

vp1_out_hdmi: endpoint@3 {
reg = <3>;
remote-endpoint = <&hdmi_in_vp1>;
};

vp1_out_lvds: endpoint@4 {
reg = <4>;
remote-endpoint = <&lvds_in_vp1>;
};

vp1_out_lvds1: endpoint@5 {
reg = <5>;
remote-endpoint = <&lvds1_in_vp1>;
};
};

vp2: port@2 {
#address-cells = <1>;
#size-cells = <0>;

reg = <2>;

vp2_out_lvds: endpoint@0 {
reg = <0>;
remote-endpoint = <&lvds_in_vp2>;
};

vp2_out_rgb: endpoint@1 {
reg = <1>;
remote-endpoint = <&rgb_in_vp2>;
};

vp2_out_lvds1: endpoint@2 {
reg = <2>;
remote-endpoint = <&lvds1_in_vp2>;
};
};
};
};

After enabling VOP, next set the MIPI1 interface to use the display path output by VP1. Openrk3568.dtsiIn the device tree file, find the MIPI1 node.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
dsi0: dsi@fe060000 {
compatible = "rockchip,rk3568-mipi-dsi";
reg = <0x0 0xfe060000 0x0 0x10000>;
interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru PCLK_DSITX_0>, <&cru HCLK_VO>;
clock-names = "pclk", "hclk";
resets = <&cru SRST_P_DSITX_0>;
reset-names = "apb";
phys = <&video_phy0>;
phy-names = "dphy";
power-domains = <&power RK3568_PD_VO>;
rockchip,grf = <&grf>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

dsi0_in: port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

dsi0_in_vp0: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp0_out_dsi0>;
status = "disabled";
};

dsi0_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_dsi0>;
status = "disabled";
};
};
};
};

dsi1: dsi@fe070000 {
compatible = "rockchip,rk3568-mipi-dsi";
reg = <0x0 0xfe070000 0x0 0x10000>; // Set the register address range: start address 0xfe070000, size 0x10000.
interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>; // Configure interrupt: GIC SPI interrupt number 69, high-level triggered.
clocks = <&cru PCLK_DSITX_1>, <&cru HCLK_VO>; // Configure pclk, hclk, hs_clk clocks.
clock-names = "pclk", "hclk";
resets = <&cru SRST_P_DSITX_1>; // Configure the abp reset signal.
reset-names = "apb";
phys = <&video_phy1>;
phy-names = "dphy";
power-domains = <&power RK3568_PD_VO>; // Configure the PD_VO power domain.
rockchip,grf = <&grf>;
#address-cells = <1>;
#size-cells = <0>;
status = "disabled"; // Disable this node; because MIPI1 is to be used, this node needs to be enabled later.

ports {
#address-cells = <1>;
#size-cells = <0>;

dsi1_in: port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

dsi1_in_vp0: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp0_out_dsi1>;
status = "disabled"; // Using VP0 to output MIPI is disabled.
};

dsi1_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_dsi1>;
status = "disabled"; // Using VP1 to output MIPI is disabled.
};
};
};
};

compatibleThe attribute value isrockchip,rk3568-mipi-dsi, indicating thatgpu/drm/rockchip/dw-mipi-dsi.cthis driver will be used.

portsThe node represents the VP port corresponding to the MIPI interface.dsi1_in_vp0indicates that the MIPI1 interface is connected to VP0,dsi1_in_vp1indicates that the MIPI1 interface is connected to VP1.

You can add the following code in thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file to configure the MIPI display path.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
&dsi1{
status = "okay";
};

&dsi1_in_vp0 {
status = "disabled";
};
&dsi1_in_vp1 {
status = "okay";
};

&video_phy1{
status = "okay";
};

video_phy1node in therk3568.dtsidevice tree file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
video_phy1: phy@fe860000 {
// Compatibility definition, identifying the hardware platform and driver
compatible = "rockchip,rk3568-dsi-dphy", "rockchip,rk3568-video-phy";
// Register region definition:
// - PHY1 physical layer registers: 0xfe860000-0xfe86ffff
// - DSI_TX_PHY1 main controller registers: 0xfe070000-0xfe07ffff
reg = <0x0 0xfe860000 0x0 0x10000>,
<0x0 0xfe070000 0x0 0x10000>;
reg-names = "phy", "host";
// Clock source definition:
// - ref: PHY reference clock (MIPI DSIPHY1 reference clock)
// - pclk_phy: PHY peripheral bus clock
// - pclk_host: DSI host controller clock
clocks = <&pmucru CLK_MIPIDSIPHY1_REF>,
<&cru PCLK_MIPIDSIPHY1>, <&cru PCLK_DSITX_1>;
clock-names = "ref", "pclk", "pclk_host";
#clock-cells = <0>;
// Reset control signal
resets = <&cru SRST_P_MIPIDSIPHY1>;
reset-names = "apb";
// Power domain configuration
power-domains = <&power RK3568_PD_VO>;
#phy-cells = <0>;
// Disabled by default; must be enabled in the specific board-level configuration
status = "disabled";
};

Set screen information

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAdd the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
&dsi1 {
status = "disabled";
//rockchip,lane-rate = <1000>;
dsi1_panel: panel@0 {
status = "disabled";
compatible = "simple-panel-dsi";
power-supply = <&vcc3v3_lcd0_n>;
reg = <0>;
backlight = <&backlight1>;
reset-delay-ms = <60>;
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
dsi,lanes = <4>;
panel-init-sequence = [
29 00 03 E0 AB BA
29 00 03 E1 BA AB
15 00 02 B0 00
29 00 05 B1 10 01 47 FF
29 00 07 B2 0C 0E 04 14 14 14
29 00 04 B3 56 D3 00
29 00 04 B4 22 30 04
15 00 02 B5 00
29 00 08 B6 B0 00 00 10 00 10 00
29 00 09 B7 0E 00 FF 08 08 FF FF 00
29 00 08 B8 05 12 29 49 48 00 00
29 00 27 B9 4D 42 38 31 33 27 2F 1B 36 35 35 53 41 49 3D 3D 33 29 26 4C 42 39 31 33 27 2F 1B 36 35 35 53 41 49 3D 3D 33 29 26
29 00 09 BA 00 00 00 44 24 00 00 00
29 00 04 BB 76 00 00
29 00 03 BC 00 00
29 00 06 BD FF 00 00 00 00
15 00 02 BE 00
29 00 11 C0 98 76 12 34 33 33 44 44 06 04 8A 04 0F 00 00 00
29 00 0B C1 53 94 02 85 06 04 8A 04 54 00
29 00 0D C2 37 09 08 89 08 10 22 21 44 BB 18 00
29 00 17 C3 9C 1D 1E 1F 10 12 0C 0E 05 24 24 24 24 24 24 07 24 24 24 24 24 24
29 00 17 C4 1C 1D 1E 1F 11 13 0D 0F 04 24 24 24 24 24 24 06 24 24 24 24 24 24
29 00 04 C5 E8 85 76
29 00 03 C6 20 20
29 00 17 C7 41 01 0D 11 09 15 19 4F 10 D7 CF 19 1B 1D 03 02 25 30 00 03 FF 00
29 00 07 C8 61 00 31 42 54 16
29 00 06 C9 A1 22 FF Cd 23
29 00 03 CA 4B 43
29 00 05 CC 2E 02 04 08
29 00 09 CD 0E 64 64 20 1E 6B 06 83
29 00 04 D0 27 10 80
29 00 05 D1 00 0D FF 0F
29 00 05 D2 E3 2B 38 00
29 00 0C D4 00 01 00 0E 04 44 08 10 00 07 00
15 00 02 D5 00
29 00 03 D6 00 00
29 00 05 D7 00 00 00 00
29 00 04 E4 08 55 03
29 00 09 E6 00 01 FF FF FF FF FF FF
29 00 04 E7 00 00 00
29 00 08 E8 D5 FF FF FF 00 00 00
15 00 02 E9 FF
29 00 06 F0 12 03 20 00 FF
29 00 1B F1 A6 C8 EA E6 E4 CC E4 BE F0 B2 AA C7 FF 66 98 E3 87 C8 99 C8 8C BE 96 91 8F FF
15 00 02 F3 03
29 00 1B F4 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
29 00 1B F5 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
29 00 1B F6 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
29 00 08 F7 00 00 00 00 00 00 00
29 00 08 F8 00 00 00 00 00 00 00
29 00 08 F9 00 00 00 00 00 00 00
29 00 1A FA 00 84 12 21 48 48 21 12 84 69 69 5A A5 96 96 A5 5A B7 DE ED 7B 7B ED DE B7
29 00 18 FB 00 12 0F FF FF FF 00 38 40 08 70 0B 40 19 50 21 C0 27 60 2D 00 00 0F
29 00 03 E3 20 21
05 C8 01 11
05 14 01 29
];

panel-exit-sequence = [
05 05 01 28
05 78 01 10
];
disp_timings1: display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
clock-frequency = <60000000>;
hactive = <800>;
vactive = <1280>;
hfront-porch = <80>;
hsync-len = <20>;
hback-porch = <80>;
vfront-porch = <20>;
vsync-len = <4>;
vback-porch = <12>;
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
};

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
panel_in_dsi1: endpoint {
remote-endpoint = <&dsi1_out_panel>;
};
};
};
};

ports {
#address-cells = <1>;
#size-cells = <0>;

port@1 {
reg = <1>;
dsi1_out_panel: endpoint {
remote-endpoint = <&panel_in_dsi1>;
};
};
};

};

Line 2statusThe attribute value is disabled, indicating that the dsi1 node is off by default. The dsi1 node has been enabled in the chapter on setting up the MIPI display path.

Line 3rockchip,lane-rateThis attribute is only relevant when using Dual-link mode. It is used to specify the data lane rate, in mbps/lane.

Lines 4 to 109 are used to set MIPI screen information, where:

Line 5statusThe attribute value is disabled, indicating that the dsi1_panel node is off by default.

Line 7regThe attribute value is 0, indicating virtual channel 0. Generally, virtual channels are not involved, so keeping the default value of 0 is sufficient.

The attributes in lines 8 to 13 have been explained in the RGB screen porting section, so they will not be repeated here.

Line 14dsi,flagsThe attribute indicates the mode. Where:

  • The attribute value is MIPI_DSI_MODE_VIDEO,MIPI_DSI_MODE_VIDEO_BURST indicates Video Burst Mode.
  • The attribute value is MIPI_DSI_MODE_LPM indicates that the initialization sequence is sent in LP mode by default.
  • The attribute value is MIPI_DSI_MODE_EOT_PACKET indicates that the EOTP feature is disabled.

Line 16dsi,formatattribute indicates the pixel format. The attribute value MIPI_DSI_FMT_RGB888 indicates using the RGB888 pixel format.

Line 17dsi,lanesattribute indicates the number of lanes. The attribute value ranges from 1 to 8, with values greater than 4 indicating a Dual-channel MIPI-DSI screen. Here, a 4-lane MIPI screen from Xunwei is used, so the attribute value is 4.

Lines 18 to 86panel-init-sequenceattribute indicates the power-on initialization sequence of the MIPI screen.

Lines 88 to 91panel-exit-sequenceattribute indicates the power-off initialization sequence of the MIPI screen. Filling in the power-on and power-off initialization sequences is important and is explained in a separate section; please refer to the MIPI Initialization Sequence chapter.

Lines 111 to 134 set the ports node of the screen.

Becausedsi1_panelthe node is disabled by default, so the dsi1_panel node needs to be enabled. In thearch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsdevice tree file, add the following code:

1
2
3
4
&dsi1_panel
{
status = "okay";
};

MIPI Initialization Sequence

When we obtain a MIPI screen, the manufacturer provides a set of parameters like this. Taking the Xunwei 7-inch MIPI screen as an example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SSD_SEND(0x01,0xE0,0xAB,0xBA);
SSD_SEND(0x01,0xE1,0xBA,0xAB);
SSD_SEND(0x01,0xB1,0x10,0x01,0x47,0xFF);
SSD_SEND(0x01,0xB2,0x0C,0x14,0x04,0x50,0x50,0x14);
SSD_SEND(0x01,0xB3,0x56,0xD3,0x00);
SSD_SEND(0x01,0xB4,0x33,0x30,0x04);
SSD_SEND(0x01,0xB6,0x0B,0x00,0x00,0x10,0x00,0x10,0x00);
SSD_SEND(0x01,0xB8,0x05,0x12,0x29,0x49,0x48,0x00,0x00);
SSD_SEND(0x01,0xB9,0x4C,0x44,0x3C,0x33,0x33,0x26,0x2F,0x1B,0x35,0x35,0x35,0x53,0x41,0x48,0x3D,0x38,0x2
B,0x19,0x06,0x4C,0x44,0x3C,0x33,0x33,0x26,0x2F,0x1B,0x35,0x35,0x35,0x53,0x41,0x48,0x3D,0x38,0x2B,0x19,0x
06);
SSD_SEND(0x01,0xC0,0x98,0x76,0x12,0x34,0x33,0x33,0x44,0x44,0x06,0x04,0x8A,0x04,0x0F,0x00,0x00,0x00
);
SSD_SEND(0x01,0xC1,0x53,0x94,0x02,0x85,0x06,0x04,0x8A,0x04,0x54,0x00);
SSD_SEND(0x01,0xC2,0x37,0x09,0x08,0x89,0x08,0x10,0x22,0x21,0x44,0xBB,0x18,0x00);
SSD_SEND(0x01,0xC3,0x9C,0x1D,0x1E,0x1F,0x10,0x12,0x0C,0x0E,0x05,0x24,0x24,0x24,0x24,0x24,0x24,0x07
,0x24,0x24,0x24,0x24,0x24,0x24);
SSD_SEND(0x01,0xC4,0x1C,0x1D,0x1E,0x1F,0x11,0x13,0x0D,0x0F,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x06
,0x24,0x24,0x24,0x24,0x24,0x24);
SSD_SEND(0x01,0xC5,0xE8,0x85,0x77);
SSD_SEND(0x01,0xC6,0x28,0x28);
SSD_SEND(0x01,0xC8,0x21,0x00,0x31,0x42,0x54,0x16);
SSD_SEND(0x01,0xCA,0x4B,0x43);
SSD_SEND(0x01,0xCD,0x0E,0x64,0x64,0x20,0x1E,0x6B,0x06,0x83);
SSD_SEND(0x01,0xD2,0xE3,0x2B,0x38,0x00);
SSD_SEND(0x01,0xD4,0x00,0x01,0x00,0x0E,0x04,0x44,0x08,0x10,0x00,0x00,0x00);
SSD_SEND(0x01,0xE6,0x80,0x09,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF);
SSD_SEND(0x01,0xF0,0x12,0x03,0x20,0x00,0xFF);
SSD_SEND(0x01,0xF3,0x00);

DCS_Short_Write_NP(0x11);
Delay(600);//delay 120ms
DCS_Short_Write_NP(0x29);
Delay(100);//delay 20ms

The driver does not recognize the code provided by the supplier; we need to convert it into a format the driver understands. This format is the MIPI initialization sequence, which corresponds to thepanel-init-sequenceandpanel-exit-sequenceattribute values.

panel-init-sequenceThe first line in the attribute, which is line 19 of the device tree, contains the data 29 00 03 E0 AB BA. We will parse the data 29 00 03 E0 AB BA.

Example
Example

From the parsing, it can be seen that the data E0 AB BA is the initialization sequence sent to MIPI, corresponding to the code SSD_SEND(0x01,0xE0,0xAB,0xBA) provided by the screen supplier.

0x29 is the Generic Long Write command. Other Generic Write commands include:

Data Type (hex)Data Type (binary)DescriptionPacket Size
0x0300 0011Generic Short WRITE, no parametersShort
0x1301 0011Generic Short WRITE, 1 parameterShort
0x2310 0011Generic Short WRITE, 2 parametersShort
0x2910 1001Generic Long WriteLong

If n < 3, the payload will be packed as a Short Packet. n is the number of parameters. Among them:

  • n = 0 means no parameters, command selects 0x03.
  • n = 1 means one parameter, command selects 0x13.
  • n = 2, indicating 2 parameters, command selection 0x23.
  • n >= 3, the payload will be packed in the form of a Long Packet, indicating n parameters, command selection 0x29.

In addition to the Generic Write command, there is also the DCS Write command.

Data Type (hex)Data Type (binary)DescriptionPacket Size
0x0500 0101DCS Short WRITE, no parametersShort
0x1501 0101DCS Short WRITE, 1 parameterShort
0x3911 1001DCS Long Write/write_LUT Command PacketLong

If n < 2, n is the number of parameters. The data to be sent will be packed in the form of a Short Packet.

  • n = 0, indicating no parameters, command selection 0x05.
  • n = 1, indicating one parameter, command selection 0x15.
  • n >= 2, the data to be sent will be packed in the form of a Long Packet. At this point, send the dcs command with n parameters, command selection 0x39.

panel-init-sequenceandpanel-exit-sequenceThe analysis method for other initialization sequences corresponding to the attributes is consistent with this example, and you can analyze them on your own.

Set backlight and touch

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAdd the following code:

1
2
3
4
5
6
7
8
9
10
11
12
13
&pwm5{
status = "okay";
};

&backlight1{
pwms = <&pwm5 0 25000 0>;
status = "okay";
};

&ft5x061
{
status = "okay";
};

Set screen LOGO

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAdd the following code:

1
2
3
4
&route_dsi1{
status = "okay";
connect = <&vp1_out_dsi1>;
};

HDMI screen porting

HDMI interface introduction

Background of Birth

In 1998, computer industry giants such as Intel, IBM, HP, Fujitsu, and Compaq jointly launched the DVI (Digital Visual Interface) interface. The DVI interface is based on TMDS (Transition Minimized Differential Signaling) technology to transmit digital signals. Through an encoding algorithm, 8-bit data (each primary color signal of R, G, B) is encoded into 10-bit data (including horizontal and vertical synchronization information, clock information, data DE, error correction, etc.), and differential signals are used for data transmission.

The DVI interface is widely used in devices such as PCs, DVDs, HDTVs, and high-definition projectors. It can support resolutions up to 2K@60Hz and 1080P@120Hz. However, with the popularization of HDTV in the early 21st century, consumer demand for audio-video integration surged. TV manufacturers (such as Sony, Panasonic, Hitachi, etc.) believed that DVI could not meet the following requirements:

  1. TV and home theater equipment are trending towards thinness and lightness, requiring more compact interfaces to achieve device miniaturization. However, the DVI interface is bulky and inconvenient to plug and unplug, making it difficult to adapt to thin and light devices.
  2. Digital audio and video need to be transmitted through a single interface to achieve audio-video integration, but the DVI interface has a single function, only supporting video transmission, requiring additional cables for audio transmission.
  3. The problem of high-definition content piracy is severe, and the demand for encryption technology is increasing. However, the DVI interface does not integrate content encryption technology (such as HDCP).
  4. Higher bandwidth is needed to support emerging resolutions such as 4K and 8K. The DVI interface has limited bandwidth, making it difficult to meet the growing resolution demands.

In 2002, TV manufacturers such as Sony, Panasonic, Hitachi, Toshiba, and Philips jointly established the HDMI Alliance, with the goal of designing a next-generation interface to replace DVI, namely the HDMI interface. HDMI stands for High Definition Multimedia Interface. In 2003, the HDMI 1.0 standard was officially released, with core features including:

  1. High bandwidth: 5Gbps transmission rate, supporting 1080P@60Hz and uncompressed 8-channel audio.
  2. Miniaturized interface: Volume reduced by about 50% compared to DVI, making plugging and unplugging more convenient.
  3. Audio-video integration: Single cable transmits digital video and audio signals.
  4. Compatibility: Backward compatible with DVI interface via adapters.
  5. Content protection: Integrated HDCP encryption technology to prevent illegal copying.

Development History of HDMI

HDMI 1.2 (2005): Supports display color depth expansion (8/10/12bit), compatible with SACD audio.

HDMI 1.3 (2006): Bandwidth increased to 10.2Gbps, introducing Deep Color and xvYCC wide color gamut.

HDMI 1.4 (2009): Bandwidth 10.2Gbps, new features: support for 4K@30Hz, 1080P@144Hz, 3D video. Added Ethernet channel (HEC) and Audio Return Channel (ARC).

HDMI 2.0a/b (2013-2016): Bandwidth 18Gbps, supports 4K@60Hz, 1080P@240Hz, introduced static HDR (High Dynamic Range).

HDMI 2.1 (2017): Bandwidth jumped to 48Gbps, core upgrades: resolution and refresh rate: 8K@60Hz, 4K@120Hz (uncompressed), supports dynamic HDR (Dolby Vision); gaming optimization: Variable Refresh Rate (VRR), Auto Low Latency Mode (ALLM); enhanced audio: eARC (Enhanced Audio Return Channel).

HDMI interface pin definitions

There are five HDMI interface types from A to E.

  1. The HDMI-A interface, also called the standard interface, is the most widely used.

HDMI-A interface
HDMI-A interface

Pin definitions:

Pin numberFunctionPin numberFunction
1TMDS Data 2+10TMDS Clock +
2TMDS Data Shield11TMDS Clock Shield
3TMDS Data 2-12TMDS Clock -
4TMDS Data 1+13CEC
5TMDS Data 1 Shield14Reserved
6TMDS Data 1-15SCL(DDC CLOCK)
7TMDS Data 0+16SDA(DDC DATA)
8TMDS Data 0 Shield17GND
9TMDS Data 0-18+5V Power
19HPD Hot Plug Detect
  1. The HDMI-B interface is rarely seen in daily use. Its data transmission capability is nearly twice as fast as HDMI-A, and it is generally used in more professional scenarios.

HDMI-B Interface
HDMI-B Interface

  1. HDMI-C, also known as Mini HDMI, is about one-third smaller than HDMI-A and is mainly used in small devices such as game consoles and digital cameras.

HDMI-C Interface
HDMI-C Interface

Pin Definitions:

Pin NumberFunctionPin NumberFunction
1TMDS Data 2 Shield10TMDS Clock Shield
2TMDS Data 2+11TMDS Clock +
3TMDS Data 2-12TMDS Clock -
4TMDS Data 1 Shield13CEC/DDC Ground
5TMDS Data 1+14CEC
6TMDS Data 1-15SCL(DDC CLOCK)
7TMDS Data 0 Shield16SDA(DDC DATA)
8TMDS Data 0+17HEC+
9TMDS Data 0-18+5V Power
19HPD Hot Plug Detect / HEC-
  1. The HDMI-D interface is also called Micro HDMI or Mini HDMI interface. Micro HDMI is relatively small and mainly used in small mobile devices, such as tablets, portable in-vehicle devices, etc.

HDMI-D Interface
HDMI-D Interface

Pin Definition:

  1. The HDMI-E interface is mainly used in automotive systems. Due to the unstable environment inside the vehicle, the HDMI-E interface adopts a mechanical locking design on the physical connector to ensure reliable contact.

HDMI-E Interface
HDMI-E Interface

Pin NumberFunctionPin NumberFunction
1HPD Hot Plug Detect / HEC-10TMDS Data 0 Shield
2Utility/HEAC+11TMDS Data 0-
3TMDS Data 2+12TMDS Clock +
4TMDS Data 2 Shield13TMDS Clock Shield
5TMDS Data 2-14TMDS Clock -
6TMDS Data 1+15CEC
7TMDS Data 1 Shield16DDC/CEC/HEAC
8TMDS Data 1-17SCL (DDC CLOCK)
9TMDS Data 0+18SDA (DDC DATA)
19+5V Power

RK3568 HDMI Interface

The RK3568 processor supports one HDMI interface, which can support both versions 1.4a and 2.0a. It supports a maximum resolution of 4K@60Hz.

HDMI interface of the RK3568 processor
HDMI interface of the RK3568 processor

Bandwidth calculation

When selecting an HDMI screen, how do you determine whether the processor can support a screen of that resolution? This involves HDMI bandwidth calculation. Take the RK3568 processor as an example.

The RK3568 processor supports up to HDMI 2.0, where the TMDS clock is 600MHz. Therefore, the bandwidth under HDMI 2.0 is: 600000000 x 10 x 3 = 18Gbps.

The effective bandwidth is 18 x (10/8) = 14.4Gbps.

Why multiply the effective bandwidth by 10/8? Because in HDMI transmission, 8 bits are converted to 10 bits. Then we calculate the bandwidth required by the HDMI screen. If the required bandwidth of the HDMI screen is less than the processor’s HDMI bandwidth, the screen is supported.

Formula for calculating HDMI screen bandwidth:Htotal x Vtotal x refresh rate x encoding method x bit depth

Here, Htotal equals Hsync + Hfront + Hactive + Hback, and Vtotal equals Vsync + Vfront + Vactive + Vback. Htotal x Vtotal represents the number of pixels per frame.

The number of pixels per frame multiplied by the monitor’s refresh rate gives the number of pixels the monitor processes per second, i.e., Htotal x Vtotal x refresh rate. If the encoding method is yuv444, the encoding value is 1; if yuv422, the value is 2/3; if yuv420, the value is 1/2.

For example: a screen with 3920 (Htotal) x 2222 (Vtotal) @60Hz, using yuv444 encoding and a bit depth of 8, requires a bandwidth of 3920 x 2222 x 60 x 1 x 8 x 3, approximately 12.543Gbps.

If you prefer not to calculate, you can also determine this by referring to a table. From the table below, it can be seen that HDMI 2.0 supports a maximum resolution of 4K@120Hz.

HDMI and data rate
HDMI and data rate

Introduction to TMDS differential signaling

Earlier we mentioned that the DVI interface uses TMDS differential signals, while the HDMI interface was developed to replace the DVI interface.

In fact, HDMI originates from DVI interface technology, and the HDMI interface also centers on the TMDS signal transmission technology of Silicon Image, Inc. HDMI is pin-compatible with DVI, but uses a different package. Therefore, HDMI and DVI interfaces can be converted to each other through adapters. In principle, HDMI is backward compatible with DVI.

Therefore, this chapter focuses on introducing TMDS differential signals. We start with the connection framework diagram in the HDMI specification.

Connection Framework Diagram in the HDMI Specification
Connection Framework Diagram in the HDMI Specification

As can be seen from the diagram, TMDS transmission is divided into two parts: the source (transmitter) and the sink (receiver). The TMDS link includes three data transmission channels (Channel 0, 1, 2) and one clock signal transmission channel (Clock Channel).

Taking the source on the left as an example, there are three data channels in total, each using parallel transmission with a width of 8 bits. Among them:

  • D[7:0]: Represents the actual 8-bit image data.
  • D[1:0]: In Channel 0, it represents the HSYNC and VSYNC signals; in Channel 1 and Channel 2, it represents the four control signals CTL0 to CTL3.
  • D[3:0]: Used to represent some additional auxiliary data, such as audio data, etc.

Why does this 8-bit data D[7:0] already transmit image data, yet D[1:0] also transmits other signals?

Overview Diagram of Data Transmission Periods in the HDMI Specification
Overview Diagram of Data Transmission Periods in the HDMI Specification

In the HDMI transmission overview diagram, transmission is divided into three phases: dark gray represents the video data period, dark blue represents the data island period, and light gray represents the control period.

TMDS Periods
TMDS Periods

  1. Control Period

When there is no need to transmit video, audio, or auxiliary data, the control period is used. There must be a control period between any two non-control periods, using CTL encoding to convert 2-bit data into 10-bit data.

Before each Video Data Period or Data Island Period, a preamble is sent through the control period. The preamble is a sequence consisting of eight identical control characters, used to indicate whether the following data period is a video data period or a data island period.

Control Period
Control Period

The values of CTL0, CTL1, CTL2, and CTL3 indicate the type of the subsequent data period, and other control signals (HSYNC and VSYNC) may also change.

The values of CTL0, CTL1, CTL2, and CTL3 indicate the type of the subsequent data period.
The values of CTL0, CTL1, CTL2, and CTL3 indicate the type of the subsequent data period.

  1. Data Island Period

During this phase, audio and other additional data are transmitted using TERC4 encoding, which converts 4-bit data into 10-bit data. The Data Island Period consists of three parts: the leading guard band, the data header and packet, and the trailing guard band.

Data Island Period
Data Island Period

  1. Video Data Period

During this phase, actual image data is transmitted using video data encoding, which converts 8-bit data into 10-bit data. The Video Data Period has a leading guard band but no trailing guard band.

Video Data Period
Video Data Period

Thus, D[7:0] does not transmit these data simultaneously but in stages.

TMDS is a differential signal, and LVDS is also a differential signal. What is the difference between them?

  • For the working principle of LVDS differential signals, refer to the LVDS interface introduction chapter.

  • TMDS differential signals use two differential lines to transmit signals, where signals 0 and 1 are determined by the voltage difference between the two pins:

  • When the TMDS differential line+ is at a high level,

  • and the differential line- is at a low level, it represents 1;

  • When the differential pair + is low and the differential pair - is high, it represents 0.

  • The TMDS receiver determines whether a 1 or 0 is sent by judging the voltage difference between + and -.

EDID Introduction

Different types and brands of monitors have different resolutions and timings. The HDMI interface must be compatible, so if the processor outputs fixed resolution and timing parameters, it cannot properly drive all monitors.

EDID stands for Extended Display Identification Data. It contains monitor-related parameters such as resolution and timing information, as well as manufacturer information, product ID, production date, etc. For example, address 08h in the EDID structure diagram below occupies 2 bytes and is used to indicate the manufacturer name, using the ISA 3-character ID code. Other addresses follow the same logic, and you can read the EDID structure diagram for details.

The EDID for HDMI is typically 256 bytes, divided into 2 blocks: Block 0 (corresponding to addresses 00h-36h in the EDID structure diagram below) and Block 1 (corresponding to addresses 36h-7fh). Block 0 is mandatory, while Block 1 is optional.

EDID v1.4 Structure:

AddressBytesDescriptionFormat
00h8Header: = (00 FF FF FF FF FF FF 00h)See Section 3.3
08h10Vendor & Product Identification:See Section 3.4
08h2ID Manufacturer NameISA 3-character ID Code
0Ah2ID Product CodeVendor assigned code
0Ch4ID Serial Number32-bit serial number
10h1Week of ManufactureWeek number or Model Year Flag
11h1Year of Manufacture or Model YearManufacture Year or Model Year
12h2EDID Structure Version & Revision:See Section 3.5
12h1Version Number: = 01hBinary
13h1Revision Number: = 04hBinary
14h5Basic Display Parameters & Features:See Section 3.6
14h1Video Input DefinitionSee Section 3.6.1
15h1Horizontal Screen Size or Aspect RatioListed in cm. → Aspect Ratio — Landscape
16h1Vertical Screen Size or Aspect RatioListed in cm. → Aspect Ratio — Portrait
17h1Display Transfer Characteristic (Gamma)Binary — Factory Default Value
18h1Feature SupportSee Section 3.6.4
19h10Color Characteristics:See Section 3.7
19h1Red/Green: Low Order BitsRx0 Rx1 Ry0 Ry1 Gx0 Gx1 Gy0 Gy1
1Ah1Blue/White: Low Order BitsBx0 Bx1 By0 By1 Wx0 Wx1 Wy0 Wy1
1Bh1Red-x: High Order BitsRed-x Bits 9 → 2
1Ch1Red-y: High Order BitsRed-y Bits 9 → 2
1Dh1Green-x: High Order BitsGreen-x Bits 9 → 2
1Eh1Green-y: High Order BitsGreen-y Bits 9 → 2
1Fh1Blue-x: High Order BitsBlue-x Bits 9 → 2
20h1Blue-y: High Order BitsBlue-y Bits 9 → 2
21h1White-x: High Order BitsWhite-x Bits 9 → 2
22h1White-y: High Order BitsWhite-y Bits 9 → 2
23h3Established TimingsSee Section 3.8
23h1Established Timings I
24h1Established Timings II
25h1Manufacturer’s Reserved Timings
26h16Standard Timings: Identification 1 → 8See Section 3.9
36h7218 Byte Data BlocksSee Section 3.10
36h18Preferred Timing Mode
48h18Detailed Timing #2 or Display Descriptor
5Ah18Detailed Timing #3 or Display Descriptor
6Ch18Detailed Timing #4 or Display Descriptor
7Eh1Extension Block Count NNumber of (optional) 128-byte EDID EXTENSION blocks to follow – if Block Maps are used then 00h ≤ N ≤ FEh and FFh is invalid.Maps are used then 254 is the maximum value of ‘N’. If Block Maps are not used then 255 is the maximum value of ‘N’. 00h ≤ N ≤ FFh.
7Fh1Checksum C00h ≤ C ≤ FFhThe 1-byte sum of all 128 bytes in this EDID block shall equal zero

Thus, by reading the EDID information, appropriate screen parameters can be output to be compatible with HDMI monitors from different manufacturers and brands. In some materials, you may also encounter E-EDID, which stands for Enhanced Extended Display Identification Data. E-EDID and EDID are just different versions in the development of this technology, and E-EDID is forward-compatible with EDID, so they can be treated as the same.

Currently, the DRM driver supports most resolution timings, but in some special scenarios, certain resolutions may not be supported. You candrivers\gpu\drm\drm_edid.cin thedrm_dmt_modesat the end of the file to add screen information.

1
2
3
{ DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 556188, 4096, 4104,
4136, 4176, 0, 2160, 2208, 2216, 2222, 0,
DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
ParameterDescription
“4096x2160”mode name, which is the resolution’s hdisplay × vdisplay
DRM_MODE_TYPE_DRIVERmode type, configured as DRM_MODE_TYPE_DRIVER
556188Pixel Clock (unit: kHz)
4096Horizontal Active Pixels (hdisplay)
4104Horizontal Sync Start (hsync_start)
4136Horizontal Sync End (hsync_end)
4176Total Horizontal Pixels (htotal)
0hskew, usually 0
2160Vertical Active Lines (vdisplay)
2208Vertical Sync Start (vsync_start)
2216Vertical Sync End (vsync_end)
2222Total Vertical Lines (vtotal)
0vscan, usually 0
vrefreshDisplay Device Frame Rate
DRM_MODE_FLAG_PHSYNCHSYNC and VSYNC polarity, flags defined as follows: DRM_MODE_FLAG_PHSYNC (1<<0)DRM_MODE_FLAG_NHSYNC (1<<1)DRM_MODE_FLAG_PVSYNC (1<<2)DRM_MODE_FLAG_NVSYNC (1<<3)DRM_MODE_FLAG_INTERLACE (1<<4)

Hardware Schematic Analysis

The iTOP-RK3568 development board has an HDMI interface, and the interface schematic is as follows:

iTOP-RK3568 HDMI Interface
iTOP-RK3568 HDMI Interface

  • HDMI_TX2P_PORT/HDMI_TX2N_PORT、HDMI_TX1P_PORT/HDMI_TX1N_PORT、HDMI_TX0P_PORT/HDMI_TX0N_PORT、HDMI_TXCLKP_PORT/HDMI_TXCLKN_PORT consists of 3 pairs of data pins and 1 pair of clock pins.
  • HDMI_TX_CEC_PORT, CEC pin.
  • HDMI_TXDDC_SCL_PORT/HDMI_TXDDC_SDA_PORT. DDC channel pins, communicating via I2C, mainly used to read EDID information.
  • HDMI_TX_HPD_PORT hot-plug detection pin.

Adaptation Steps

rk3568.dtsiThe hdmi node is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
hdmi: hdmi@fe0a0000 {
compatible = "rockchip,rk3568-dw-hdmi";
reg = <0x0 0xfe0a0000 0x0 0x20000>;
interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&cru PCLK_HDMI_HOST>,
<&cru CLK_HDMI_SFR>,
<&cru CLK_HDMI_CEC>,
<&pmucru PLL_HPLL>,
<&cru HCLK_VOP>;
clock-names = "iahb", "isfr", "cec", "ref", "hclk";
power-domains = <&power RK3568_PD_VO>;
reg-io-width = <4>;
rockchip,grf = <&grf>;
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

hdmi_in_vp0: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp0_out_hdmi>;
status = "disabled";
};

hdmi_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_hdmi>;
status = "disabled";
};
};
};
};

compatibleThe attribute value isrockchip,rk3568-dw-hdmi, indicating thatgpu/drm/rockchip/dw_hdmi-rockchip.c this driver will be used.

pinctrl-0 = <&hdmitx_scl &hdmitx_sda &hdmitxm0_cec>;: Use pinctrl to set the multiplexing of scl, sda, and cec pins.

statusThe attribute value is disabled, indicating that this node is disabled; since HDMI is to be used, the node needs to be enabled later.

portsThe node represents the VP port corresponding to the HDMI interface. hdmi_in_vp0 indicates that the HDMI interface is connected to VP0. hdmi_in_vp1 indicates that the HDMI interface is connected to VP1.statusThe attribute value disabled indicates that using VP0/1 to output HDMI is prohibited.

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAs follows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#if  defined(LCD_TYPE_HDMI_VP0)
&hdmi {
status = "okay";
rockchip,phy-table =
<92812500 0x8009 0x0000 0x0270>,
<165000000 0x800b 0x0000 0x026d>,
<185625000 0x800b 0x0000 0x01ed>,
<297000000 0x800b 0x0000 0x01ad>,
<594000000 0x8029 0x0000 0x0088>,
<000000000 0x0000 0x0000 0x0000>;
};
&hdmi_in_vp0 {
status = "okay";
};
&hdmi_in_vp1 {
status = "disabled";
};
&hdmi_sound {
status = "okay";
};
&route_hdmi {
status = "okay";
connect = <&vp0_out_hdmi>;
};
#endif

#if defined(LCD_TYPE_HDMI_VP1)
&hdmi {
status = "okay";
rockchip,phy-table =
<92812500 0x8009 0x0000 0x0270>,
<165000000 0x800b 0x0000 0x026d>,
<185625000 0x800b 0x0000 0x01ed>,
<297000000 0x800b 0x0000 0x01ad>,
<594000000 0x8029 0x0000 0x0088>,
<000000000 0x0000 0x0000 0x0000>;
};
&hdmi_in_vp0 {
status = "disabled";
};
&hdmi_in_vp1 {
status = "okay";
};
&hdmi_sound {
status = "okay";
};
&route_hdmi {
status = "okay";
connect = <&vp1_out_hdmi>;
};
#endif

eDP Screen Porting

Introduction to eDP Interface

eDP stands for Embedded DisplayPort, an embedded display interface founded by the Video Electronics Standards Association (VESA). The eDP protocol is an extension of the DP (DisplayPort) architecture and protocol for embedded applications, so it is fully compatible with the DP protocol. It has been widely used in laptops, tablets, and other fields.

The RK3568 supports one eDP interface. Its features are as follows:

  1. Supports one eDP 1.3 interface
  2. Up to 4 physical lanes, each supporting 2.7 Gbps
  3. Supports Panel Self Refresh (PSR)
  4. Supports a maximum resolution of 2560x1600 @ 60Hz
  5. Supports RGB format (up to 10-bit color depth)

The iTOP-RK3568 development board will bring out one eDP interface, with the schematic diagram as follows:

The iTOP-RK3568 development board will bring out one eDP interface
The iTOP-RK3568 development board will bring out one eDP interface

  1. EDP_TX_D0N/EDP_TX_D0P、EDP_TX_D1N/EDP_TX_D1P、EDP_TX_D2N/EDP_TX_D2P、EDP_TX_D3N/EDP_TX_D3P. It consists of 4 differential pairs used to transmit audio and video data. Note that the specific LCD screen requires as many differential pairs as needed; connect 2 pairs if 2 are needed, and 4 pairs if 4 are needed.
  2. EDPAUXN/EDPAUXP auxiliary channel.
  3. EDP_HPDIN_M1 hot-plug pin, not used in the schematic. That is, this pin is optional.
  4. I2C1_SCL_TP、I2C1_SDA_TP、TP_INT_L_GPIO3_A5、TP_RST_L_GPIO0_B6, touch I2C communication, interrupt, and reset pins.
  5. LCD0_BL_PWM4 screen backlight pin.

Adaptation steps

rk3568.dtsiThe edp node in it is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
edp: edp@fe0c0000 {
compatible = "rockchip,rk3568-edp";
reg = <0x0 0xfe0c0000 0x0 0x10000>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&pmucru XIN_OSC0_EDPPHY_G>, <&cru PCLK_EDP_CTRL>,
<&cru CLK_EDP_200M>, <&cru HCLK_VO>;
clock-names = "dp", "pclk", "spdif", "hclk";
resets = <&cru SRST_EDP_24M>, <&cru SRST_P_EDP_CTRL>;
reset-names = "dp", "apb";
phys = <&edp_phy>;
phy-names = "dp";
power-domains = <&power RK3568_PD_VO>;
status = "disabled";

ports {
#address-cells = <1>;
#size-cells = <0>;

edp_in: port@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;

edp_in_vp0: endpoint@0 {
reg = <0>;
remote-endpoint = <&vp0_out_edp>;
status = "disabled";
};

edp_in_vp1: endpoint@1 {
reg = <1>;
remote-endpoint = <&vp1_out_edp>;
status = "disabled";
};
};
};
};

compatibleThe attribute value isrockchip,rk3568-edp, indicating thatgpu/drm/rockchip/analogix_dp-rockchip.cthis driver will be used.

phys = <&edp_phy>;Using edp_phy, so we need to enable the edp_phy node.

statusThe attribute value is disabled, indicating that the eDP node is disabled, so we need to enable the eDP node.

portsThe node represents the VP port corresponding to the eDP interface. edp_in_vp0 indicates that the eDP interface is connected to VP0,edp_in_vp1indicates that the eDP interface is connected to VP1, and the status attribute value is disabled, meaning the eDP output is disabled.

arch/arm64/boot/dts/rockchip/topeet-screen-lcds.dtsAs follows

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#if defined(LCD_TYPE_EDP_VGA)
&edp {
hpd-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
status = "okay";
};

&edp_phy {
status = "okay";
};

&edp_in_vp0 {
status = "okay";
};

&edp_in_vp1 {
status = "disabled";
};
&route_edp {
status = "okay";
connect = <&vp0_out_edp>;
};

#endif

VGA Screen Porting

VGA Interface Introduction

VGA stands for Video Graphics Array, which is a video graphics array. VGA is a protocol that uses analog signals for video transmission, introduced by IBM in 1987. Initially, due to its high resolution, fast display speed, and rich colors, it was very common in desktop computer applications. However, the VGA interface is relatively large in size, and as portable laptops become increasingly popular, it has gradually been phased out in the pursuit of thin and light notebooks.

VGA interfaces are divided into male and female connectors. When transmitting images between them, the VGA image transmission standard is used.

VGA Interface
VGA Interface

Pin NumberNameDirectionFunction Description
1REDRed Video Signal
2GREENGreen Video Signal
3BLUEBlue Video Signal
4RESReserved
5GNDGround
6RGNDRed Ground
7GGNDGreen ground wire
8BGNDBlue ground wire
9+5V+5V DC power supply
10SGNDSync ground wire
11ID0Monitor ID bit 0 (optional)
12SDADDC serial data line
13HSYNC or CSYNCHorizontal sync signal (or composite sync signal)
14VSYNCVertical sync signal
15SCLDDC data clock line

The RK3568 processor itself does not have a VGA interface; the VGA interface on the iTOP-RK3568 development board is converted from the eDP interface.

Hardware schematic analysis

topeet RK3568 VGA
topeet RK3568 VGA

The schematic for the eDP to VGA interface is very simple, using an RTD2166 conversion chip. The input of the conversion chip is the eDP signal. After passing through the conversion chip, it outputs the VGA signal.

Among them, EDP_TX_D0P/EDP_TX_D0N、EDP_TX_D1P/EDP_TX_D1N、EDP_TX_AUXP/EDP_TX_AUXN. Two pairs of differential lines are used to transmit audio and video data. EDPAUXN/EDPAUXP are auxiliary channels. VGA_HPDIN_GPIO0_C0 is the hot-plug pin. I2C5_SDA_M0/I2C5_SCL_M0 is the control pin of the conversion chip.

VGA_R、VGA_G、VGA_B、VGA_HSYNC、VGA_VSYNC、VGA_DDC_SDA、VGA_DDC_SCL is the output pin of the conversion chip, which is the converted VGA signal; simply connect it to the VGA connector.

Adaptation Steps

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#if defined(LCD_TYPE_EDP_VGA)
&edp {
hpd-gpios = <&gpio0 RK_PC0 GPIO_ACTIVE_HIGH>;
status = "okay";
};

&edp_phy {
status = "okay";
};

&edp_in_vp0 {
status = "okay";
};

&edp_in_vp1 {
status = "disabled";
};
&route_edp {
status = "okay";
connect = <&vp0_out_edp>;
};

#endif