Universal and convenient MIPI LCD display screen configuration method
By adding EEPROM to the adapter board of the MIPI LCD display and modifying the Linux kernel configuration program, the automatic identification and configuration of the MIPI LCD display is realized, solving the problems of complex configuration file naming and chaotic management, improving development efficiency and having plug-and-play functions.
Patent Information
- Application Number
- CN202510503992.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-08-01
AI Technical Summary
The configuration file naming of MIPI LCD displays is complicated and has chaotic management, resulting in low development efficiency and no plug-and-play functionality.
Add EEPROM to the adapter board of the MIPI LCD display, store the firmware data of the configuration information, and modify the configuration program in the Linux kernel of the main control board, so that it automatically reads and parses the configuration information in the EEPROM when connected, realizing automatic initialization and configuration.
It solves the problems of complex naming of MIPI LCD configuration files and is chaotic in management, improves development efficiency, and has plug-and-play functions, providing a user experience similar to HDMI screens.
Smart Images

Figure CN120407030A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of touch screens, and more particularly to a configuration method for a general and convenient MIPI LCD display screen. Background Art
[0002] In an embedded system, an MIPI LCD display screen and a touch screen are commonly used display components. Due to the diversity of customer requirements and usage scenarios, it is often necessary to configure LCD screens of different brands, sizes, and resolutions. The main functions of the MIPI LCD display screen and the touch screen are to detect the touch position through sensing technology and transmit this information to other processing units for processing. The MIPI LCD display screen and the touch screen do not have an EEPROM configured therein. The MIPI LCD display screen and the touch screen exchange data with an external memory (such as the EEPROM of an adapter board) or other storage devices through interfaces such as the MIPI interface.
[0003] Therefore, the Linux system of the main control board of the device needs to allocate a configuration file for each MIPI LCD through the device tree. However, with the increase in the types of MIPI LCDs, this one-to-one configuration method in the prior art has led to problems such as complex naming and chaotic management, greatly reducing the development efficiency and not having the function of plug and play.
[0004] Therefore, there is an urgent need for a general, convenient, plug-and-play MIPI LCD configuration method that can solve the problems of complex naming and chaotic management of MIPI LCD configuration files. Summary of the Invention
[0005] Aiming at the deficiencies of the prior art, the purpose of the present invention is to provide a general and convenient configuration method for an MIPI LCD display screen, which has strong versatility, is convenient to use, and has the function of plug and play while solving the problems of complex naming and chaotic management of MIPI LCD configuration files.
[0006] To achieve the above purpose, the technical solution adopted by the present invention is: a general and convenient configuration method for an MIPI LCD display screen,
[0007] The components of the MIPI LCD display screen in terms of hardware include an MIPI LCD screen and an adapter board. The adapter board is fixed to the back of the MIPI LCD screen. The adapter board is configured with an EEPROM, a backlight driver U1, and an MIPI DSI LCD interface J2 for connecting to the main control board. The MIPI DSI LCD interface J2 is respectively connected to the EEPROM, the backlight driver U1, and the MIPI LCD interface J1. The MIPI LCD interface J1 is connected to the MIPI LCD screen;
[0008] The EEPROM of the adapter board stores firmware data containing the configuration information of the MIPI LCD screen. The firmware data includes header information, screen timing sequence, and initialization sequence in terms of data structure.
[0009] The configuration program of the Linux kernel on the main control board is modified such that when the MIPI LCD screen is connected to the main control board, the Linux kernel reads the firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver in the Linux kernel. The parsed configuration information is used by the MIPI LCD screen driver to initialize the MIPI LCD screen and set the screen timing sequence, enabling the main control board to automatically recognize and configure the MIPI LCD screen after connecting the MIPI LCD screen.
[0010] In a further technical solution, the components of the MIPI LCD display in terms of hardware further include a touch screen. The touch screen is fixed in front of the MIPI LCD screen to form a MIPI LCD touch display. The adapter board is also provided with a touch screen interface J3.
[0011] The MIPI DSI LCD interface J2 is connected to the touch screen interface J3, and the touch screen interface J3 is connected to the touch screen.
[0012] The EEPROM is connected to the I2C signal line between the MIPI DSI LCD interface J2 and the touch screen interface J3.
[0013] The EEPROM stores firmware data containing the configuration information of the MIPI LCD screen and the configuration information of the touch screen. The firmware data includes header information, screen timing sequence, initialization sequence, and touch screen attributes in terms of data structure.
[0014] The configuration program of the Linux kernel on the main control board is modified such that when the MIPI LCD touch display is connected to the main control board, the Linux kernel reads the firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver and touch screen driver in the Linux kernel. The parsed configuration information is used by the MIPI LCD screen driver to initialize the MIPI LCD screen, set the screen timing sequence, and initialize the touch screen, enabling the main control board to automatically recognize and configure the MIPI LCD touch display after connecting the MIPI LCD touch display.
[0015] In a further technical solution, after the MIPI LCD touch display is connected to the main control board, the Linux kernel includes steps for writing the device tree.
[0016] The Linux kernel first initializes the EEPROM of the adapter board through the original nvmem driver, and then adds nvmem driver attributes to the device tree nodes of the MIPI LCD screen and the touch screen, so that the EEPROM is associated with the MIPI LCD screen and the touch screen, and deletes the initialization sequence, exit sequence and configuration information of the screen timing sequence of the original device tree node of the MIPI LCD screen driver. The MIPI LCD screen driver uses the configuration information read and parsed from the EEPROM to initialize the MIPI LCD screen and the touch screen respectively, so as to implement the step that the main control board cancels the separate configuration of a device tree file for each model of MIPI LCD screen.
[0017] In a further technical solution, the MIPI DSI LCD interface J2 transmits the interrupt signal pin and reset signal pin of the touch screen through the pins TP_INT and TP_RST, and transmits the I2C signal of the touch screen coordinate data of the touch screen through the pins TP_SCL and TP_SDA. In addition, the MIPI DSI LCD interface J2 also accesses the EEPROM of the adapter board through the pins TP_SCL and TP_SDA, and the pins TP_SCL and TP_SDA of the MIPI DSI LCD interface J2 are respectively connected to the pins SCL and SDA of the EEPROM of the adapter board.
[0018] In a further technical solution, the MIPI LCD interface J1 is the interface of the MIPI LCD screen, which is used to provide MIPI DSI signals and 3.3V power supply. Among them, the MIPI LCD interface J1 is respectively connected to the outputs of the backlight driver chip through the pins LEDA and LEDK, which are used to connect the positive and negative poles of the backlight of the MIPI LCD screen and supply power to the backlight. The MIPI LCD interface J1 provides a PWM control signal for controlling the current magnitude for the backlight through the pin LCD_BL_PWM.
[0019] In a further technical solution, after the MIPI LCD touch display screen is connected to the main control board, the main control board automatically executes the following steps based on the Linux kernel.
[0020] S1: The main control board is powered on. The CPU of the main control board first executes the Bootrom code built in the main control board, searches for a bootable storage device according to the set boot sequence, and then loads the uboot program of the main control board from the bootable storage device.
[0021] S2: In the uboot stage, initialize the serial port, storage device and network interface through the uboot program, and load and start the kernel program that boots the main control board.
[0022] S3: During the startup process of the kernel program, the main control board initializes the nvmem driver, the touch screen driver, and the MIPI LCD screen driver respectively;
[0023] S3.1: Initialize the EEPROM of the adapter board through the nvmem driver, encapsulate the read and write methods of the EEPROM of the adapter board at the same time, and provide common functions for the touch screen driver and the MIPI LCD screen driver when reading and writing the EEPROM of the adapter board;
[0024] S3.2: The touch screen driver calls the read function of the nvmem driver, reads and parses the configuration information of the touch screen from the EEPROM of the adapter board, and then sets the invert_x, invert_y, and swap_x_y parameters of the touch screen to complete the initialization of the touch screen;
[0025] After the initialization of the touch screen is completed, when the touch screen is touched, the touch screen reports a touch event to the input subsystem of the Linux kernel; Use the EEPROM of the adapter board to store the invert_x, invert_y, and swap_x_y parameters of the touch screen, which is used to flexibly configure the xy-axis direction of the touch screen when the xy-axis direction of the touch screen is inconsistent with the system at the time of factory, and is used to cancel the cumbersome steps of reflashing the touch screen firmware;
[0026] S3.3: During the operation of the MIPI LCD screen driver, the MIPI LCD screen driver calls the read function of the nvmem driver, reads and parses the initialization sequence and screen timing of the MIPI LCD screen from the EEPROM of the adapter board, and then sends the initialization sequence through the MIPIDSID0P / N signal lines of the MIPI DSI LCD interface J2, and sets the screen timing to the display subsystem of the Linux kernel to prepare for correctly outputting the screen display data;
[0027] After setting the screen timing, the CPU of the main control board sends display data to the screen of the MIPI LCD screen, and the MIPI LCD screen displays the picture.
[0028] For a further technical solution, before reading the screen timing and the initialization sequence of the MIPI LCD screen, first read the header information of the firmware data, obtain the screen timing, the offset address and length of the initialization sequence from the header information, and then obtain the corresponding data according to the offset address and length. The data structure of the header information of the firmware data includes
[0029] magic: Set the value to 0xdead5a5a, which is used to mark whether there is firmware in the EEPROM of the adapter board;
[0030] vendor: Used to store the manufacturer name of the MIPI LCD screen and the adapter board;
[0031] model: Used to store the model of the MIPI LCD screen;
[0032] version: Used to store the version information of the firmware of the MIPI LCD screen;
[0033] timing_entry: Used to store the offset address and length of the screen timing sequence of the MIPI LCD screen;
[0034] init_seq_entry: Used to store the offset address and length of the initialization sequence of the MIPI LCD screen;
[0035] exit_seq_entry: Used to store the offset address and length of the exit sequence of the MIPI LCD screen;
[0036] touchscreen_entry: Used to store the offset address and length of the touch screen attributes of the touch screen;
[0037] firmware_size: Used to store the size of the firmware;
[0038] The screen timing sequence is used to set the screen display signal timing. The data structure of the screen timing sequence includes,
[0039] pixelclock: Used for pixel clock, with the value (hactive + hfront_porch +
[0040] (hback_porch + hsync_len) * (vactive + vfront_porch + vback_porch + vsync_len) * 60;
[0041] hactive: Used for the horizontal pixel size;
[0042] hfront_porch: Used for the LCD hfp parameter;
[0043] hback_porch: Used for the LCD hbp parameter;
[0044] hsync_len: Used for the LCD hspw parameter;
[0045] vactive: For vertical pixel size;
[0046] vfront_porch: For LCD vfp parameter
[0047] vback_porch: For LCD vbp parameter;
[0048] vsync_len: For LCD vspw parameter;
[0049] flags: For setting the polarities of hsync, vsync, de, and clk signal lines;
[0050] The data structure of the touch screen attributes includes:
[0051] max_x, max_y: Read from the touch screen ic, no need to set;
[0052] invert_x: Set the x-axis flip, with the value of true for flipping and false for not flipping;
[0053] invert_y: Set the y-axis flip, with the value of true for flipping and false for not flipping;
[0054] swap_x_y: Set the x and y axes swapping, with the value of true for swapping and false for not swapping;
[0055] The initialization sequence is an 8-bit unsigned array init_seq. The array init_seq stores the initialization sequence of the MIPI LCD screen. The data structure of the initialization sequence stored in the array init_seq is the same as the data structure used by the main control board to represent the device tree.
[0056] Each row of the array init_seq represents the command data sent to the MIPI LCD screen once, and the format is as follows:
[0057] The first three bytes of each row represent Data Type, Delay, and Payload Length respectively. The data starting from the fourth byte represents the Payload with a length of Length.
[0058] Among them, the first byte Data Type has three types.
[0059] The first type is 0x39, representing a long packet write, which can send more than two parameters after sending a command.
[0060] The second type is 0x15, representing a short packet write, which can only send one parameter after sending a command.
[0061] The third one is 0x05, which also represents short packet writing. After sending a command, parameters cannot be sent continuously;
[0062] The data structure code for the initialization sequence is as follows:
[0063] static unsigned char init_seq[] = {
[0064] 0x39, 0x00, 0x04, 0xFF, 0x98, 0x81, 0x03,
[0065] 0x15, 0x00, 0x02, 0x02, 0x00,
[0066] 0x05, 0x78, 0x01, 0x11,
[0067] 0x05, 0x14, 0x01, 0x29,
[0068] };
[0069] The exit sequence is an 8-bit unsigned array exit_seq. The array format of the array exit_seq is the same as that of the array init_seq.
[0070] exit_seq is used to store the commands for MIPI LCD to enter the sleep and turn off the screen. 0x28 is used to turn off the display, and 0x10 is used to enter the sleep. The data structure code is as follows:
[0071] static unsigned char exit_seq[] = {
[0072] 0x05, 0x78, 0x01, 0x28,
[0073] 0x05, 0x00, 0x01, 0x10,
[0074] };
[0075] For a further technical solution, the implementation steps for reading and parsing the initialization sequence, the exit sequence, and the screen timing sequence are as follows:
[0076] 1), Obtain the nvmem device:
[0077] The main control board uses the devm_nvmem_device_get function to obtain the nvmem device associated with the MIPI LCD screen, including the EEPROM device of the adapter board;
[0078] If the acquisition fails, the error code of the acquisition failure is returned;
[0079] 2) Allocate memory:
[0080] The main control board uses the devm_kzalloc function to allocate memory for storing firmware_header, timing, init_seq, exit_seq, and drm_display_mode. Among them, drm_display_mode is a data structure in the drm framework used to configure the output of the display controller;
[0081] If the allocation fails, return the code ENOMEM;
[0082] 3) Read the firmware header information:
[0083] The main control board uses the nvmem_device_read function to read the firmware header information from the offset address 0 in the nvmem device;
[0084] Verify the legality of the firmware. If firmware_size is less than or equal to 0 or magic is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful;
[0085] When it is determined that the firmware verification fails, print an error message and return the code EINVAL;
[0086] 4) Read the screen timing
[0087] The main control board reads the timing configuration from the EEPROM of the adapter board according to the offset address and length of the timing in the header information using the nvmem_device_read function; if the read fails, return the corresponding error code, and if the read is successful, execute step 5);
[0088] Step 5) Read the initialization and exit sequence data:
[0089] According to the offset address and length of the init_seq array and the exit_seq array in the header information, use the nvmem_device_read function to read the data of the init_seq array and the exit_seq array from the EEPROM of the adapter board respectively;
[0090] If the read fails, return the error code of the read failure;
[0091] 6) Convert the screen timing data:
[0092] The main control board uses the drm_display_mode_from_videomode function to convert the screen timing data into a drm_display_mode structure and fills it into the desc structure;
[0093] 7) Extract bus flag:
[0094] The main control board uses the drm_bus_flags_from_videomode function to convert the flags in timing into drm bus_flags and fill them into the desc structure;
[0095] 8) Initialization and exit command sequence analysis:
[0096] The main control board converts the sequence of the array init_seq read from the EEPROM of the adapter board into command data that can be sent by MIPIDSI by calling the panel_simple_parse_cmd_seq function;
[0097] The parsing process of the sequence of array init_seq is as follows:
[0098] 8.1) Calculate the number of commands: First, read the first 3 bytes of the first line to obtain the value of Payload Length. 3 + Payload Length is the starting position of the second line of commands. Continue reading 3 bytes to obtain the value of Payload Length of the second line. Then, add 3 + Payload Length to obtain the starting position of the third line of commands. The traversal process is similar. During the traversal process, add variables cnt and len to record the number of traversals and the remaining length of the traversal, respectively. When the value of len is less than 3, the variable loop ends. The value of the variable cnt is the number of commands.
[0099] 8.2) Based on the number of commands calculated above, use devm_kcalloc to allocate an array for storing commands, and then use traversal to fill the command array;
[0100] Each command consists of a command header and command data. The command header is the first three bytes of each line of the init_seq array. The process of traversing and filling the command array is as follows: Obtain the command header pointer of the first line of the init_seq array. Add the length of the command header to this pointer to get the pointer to the command data of the first line, and fill the content in the command header pointer and the pointer to the command data into command array 0. Then add the length of the command data of the first line to this pointer to get the command header pointer of the second line. Add the length of the command header to this pointer to get the pointer to the command data of the second line, and fill the content in the command header pointer of the second line and the pointer to the command data into command array 1. Do the same for the third line, the fourth line, and so on.
[0101] 8.3), Send the commands in the command array to the MIPI LCD screen by calling the kernel driver function panel_simple_xfer_dsi_cmd_seq;
[0102] 8.4), The process of exiting the parsing of the command sequence is the same as the parsing and initialization of the commands.
[0103] For a further technical solution, the implementation steps of reading and parsing the touch screen attribute data are as follows:
[0104] 1), Obtain the nvmem device:
[0105] The main control board uses the devm_nvmem_device_get function to obtain the nvmem device associated with the touch screen and obtain the EEPROM device of the adapter board. If the acquisition fails, return the error code indicating the acquisition failure;
[0106] 2), Allocate memory:
[0107] The main control board uses the devm_kzalloc function to allocate memory for storing the firmware_header and touch_prop;
[0108] If the allocation fails, return the code ENOMEM;
[0109] 3), Read the firmware header information:
[0110] The main control board uses the nvmem_device_read function to read the firmware header information starting from the offset address 0 in the nvmem device;
[0111] Verify the legality of the firmware. If the firmware_size is less than or equal to 0 or the magic is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful;
[0112] If the firmware verification fails, print an error message and return the error code EINVAL.
[0113] If the firmware verification succeeds, execute step 4).
[0114] 4) Read the touchscreen configuration property touch_prop:
[0115] The main control board uses the nvmem_device_read function to read the touch_prop configuration from the EEPROM of the adapter board according to the offset address and length of touch_prop in the header information.
[0116] If the read fails, return the error code for the read failure. If the read succeeds, execute step 5).
[0117] 5) Use the values of invert_x, invert_y, and swap_x_y in touch_prop read from the EEPROM of the adapter board to set the members invert_x, invert_y, and swap_x_y in the touchscreen_properties structure of the touchscreen properties in the system.
[0118] After the setting is completed, the kernel driver of the main control board automatically determines whether the touchscreen needs to flip the x-axis, flip the y-axis, or swap the xy-axis according to the values of invert_x, invert_y, and swap_x_y in the touchscreen_properties structure.
[0119] The advantages of the present invention compared with the prior art are: The present invention fundamentally solves the problems of complex configuration file naming and chaotic management caused by the increasing variety of MIPI LCDs, reduces the usage difficulty of MIPI LCDs and improves the development efficiency, and at the same time has the plug-and-play function.
[0120] The present invention adds an EEPROM of the adapter board to the adapter board of the MIPI LCD, solves the storage problem of MIPI LCD configuration information at the hardware level, and stores the initialization sequence, timing, touchscreen properties and other configuration information of the MIPI LCD in the EEPROM of the adapter board. At the software level, it solves the problems of data structure definition, burning and parsing of MIPI LCD configuration information. By modifying the Linux MIPI LCD and touchscreen drivers, and automatically reading the configuration information of the EEPROM of the adapter board and automatically initializing the MIPI LCD and other touchscreens when the main control board of the device is powered on, the MIPI LCD and other touchscreens have the plug-and-play function and usage experience similar to that of the HDMI screen. Description of the Drawings
[0121] Figure 1 is the circuit block diagram of the present invention.
[0122] Figure 2 is the workflow diagram of the present invention
[0123] Figure 3 is the circuit schematic diagram of the present invention.
[0124] Figure 4 is the schematic diagram of the data structure of the firmware header information of the present invention.
[0125] Figure 5 is the schematic diagram of the screen timing data structure of the screen timing data structure of the present invention.
[0126] Figure 6 is the schematic diagram of the touch screen attribute data structure of the present invention.
[0127] Figure 7 is the schematic diagram of the overall data structure of the EEPROM of the adapter board of the present invention. Detailed implementation manners
[0128] A general and convenient configuration method for a MIPI LCD display screen,
[0129] The components in terms of hardware include two components, namely a MIPI LCD screen and an adapter board. The adapter board is fixed on the back of the MIPI LCD screen. The adapter board is configured with an EEPROM, a backlight driver U1, and a MIPI DSI LCD interface J2 for connecting to the main control board. The MIPI DSI LCD interface J2 is respectively connected to the EEPROM, the backlight driver U1, and the MIPI LCD interface J1. The MIPI LCD interface J1 is connected to the MIPI LCD screen;
[0130] The EEPROM of the adapter board stores firmware data containing the configuration information of the MIPI LCD screen. In terms of data structure, the firmware data includes header information, screen timing, and an initialization sequence. The configuration program of the Linux kernel of the main control board is modified such that when the MIPI LCD screen is connected to the main control board, the Linux kernel reads the firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver of the Linux kernel. The parsed configuration information is used by the MIPI LCD screen driver to initialize the MIPI LCD screen and set the screen timing, realizing the automatic recognition and automatic configuration of the MIPI LCD screen by the main control board after connecting the MIPI LCD screen.
[0131] Among them, the MIPI LCD interface J1 is an interface for connecting the MIPI LCD screen, used to provide MIPI DSI signals and 3.3V power supply. Among them, the MIPI LCD interface J1 is respectively connected to the outputs of the backlight driver chip through the pins LEDA and LEDK, used to connect the positive and negative poles of the backlight of the MIPI LCD screen and supply power to the backlight. The MIPI LCD interface J1 provides a PWM control signal for controlling the current magnitude for the backlight through the pin LCD_BL_PWM. The MIPI DSI LCD interface J2 transmits the interrupt signal pin and reset signal pin of the touch screen through the pins TP_INT and TP_RST. The MIPI DSI LCD interface J2 transmits the I2C signal of the touch screen coordinate data of the touch screen through the pins TP_SCL and TP_SDA. In addition, the MIPI DSI LCD interface J2 also accesses the EEPROM of the adapter board through the pins TP_SCL and TP_SDA. The pins TP_SCL and TP_SDA of the MIPI DSI LCD interface J2 are respectively connected to the pins SCL and SDA of the EEPROM of the adapter board.
[0132] The present invention can also be used for a MIPI LCD touch display screen integrated with a touch screen, a MIPI LCD screen, and an adapter board. That is, the components of the MIPI LCD touch display screen in terms of hardware are composed of three components: a touch screen, a MIPI LCD screen, and an adapter board. The adapter board is fixed on the back of the MIPI LCD screen, and the touch screen is fixed in front of the MIPI LCD screen to form a MIPI LCD touch display screen. Figures 1 to 7 As shown, the adapter board of the MIPI LCD touch display screen is also provided with a touch screen interface J3. The MIPI DSI LCD interface J2 is connected to the touch screen interface J3, and the touch screen interface J3 is connected to the touch screen. The EEPROM is accessed to the I2C signal line between the MIPI DSI LCD interface J2 and the touch screen interface J3. The EEPROM of the adapter board of the MIPI LCD touch display screen stores firmware data including the configuration information of the MIPI LCD screen and the configuration information of the touch screen. The firmware data includes header information, screen timing sequence, initialization sequence, and touch screen attributes in terms of data structure.
[0133] The configuration program of the Linux kernel of the main control board is modified so that when the MIPI LCD touch display screen is connected to the main control board, the Linux kernel reads firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver and touch screen driver of the Linux kernel. The configuration information parsed through the MIPI LCD screen driver is used to initialize the MIPI LCD screen, set the screen timing sequence, and initialize the touch screen, realizing the automatic recognition and automatic configuration of the MIPI LCD touch display screen by the main control board after connecting the MIPI LCD screen.
[0134] The automatic recognition and configuration of the MIPI LCD screen are the same as those of the MIPI LCD screen in the MIPI LCD touch display screen respectively. The following is described in combination with the MIPI LCD touch display screen. Figures 1 to 7 as shown.
[0135] After the MIPI LCD touch display screen is connected to the main control board, the Linux kernel includes the steps of device tree writing.
[0136] The Linux kernel first initializes the EEPROM of the adapter board through the original nvmem driver, then adds the nvmem driver attribute to the device tree nodes of the MIPI LCD screen and the touch screen, associates the EEPROM of the adapter board with the MIPI LCD screen and the touch screen, and deletes the initialization sequence, exit sequence, and configuration information of the screen timing sequence of the device tree node of the MIPI LCD screen driver. The MIPI LCD screen driver of the main control board uses the configuration information read and parsed from the EEPROM of the adapter board and is used to initialize the MIPI LCD screen and the touch screen, thereby realizing the step of the main control board canceling the separate configuration of a device tree file for each model of MIPI LCD screen.
[0137] After the MIPI LCD touch display screen is connected to the main control board, the main control board automatically executes the following steps based on the Linux kernel.
[0138] S1: The main control board is powered on, and the Linux kernel of the main control board starts to work. The CPU of the main control board first executes the Bootrom code built in the main control board, searches for a bootable storage device according to the set boot order, and then loads the uboot program of the main control board from the bootable storage device.
[0139] S2: In the uboot stage, the serial port, storage device, and network interface are initialized through the uboot program, and the kernel program that boots the main control board is loaded and started.
[0140] S3: During the startup process of the kernel program, the main control board initializes the nvmem driver, the touch screen driver, and the MIPI LCD screen driver respectively;
[0141] S3.1: The main control board initializes the EEPROM of the adapter board through the nvmem driver. At the same time, it encapsulates the read and write methods of the EEPROM of the adapter board, and provides general functions for the touch screen driver and the MIPI LCD screen driver when reading and writing the EEPROM of the adapter board;
[0142] S3.2: The touch screen driver calls the read function of the nvmem driver. Through the touch screen driver calling the nvmem driver, it reads and parses the configuration information of the touch screen from the EEPROM of the adapter board, and then sets the invert_x, invert_y, and swap_x_y parameters of the touch screen to complete the initialization of the touch screen;
[0143] After the initialization of the touch screen is completed, when the touch screen is touched, the touch screen reports a touch event to the input subsystem of the Linux kernel; The invert_x, invert_y, and swap_x_y parameters of the touch screen are stored in the EEPROM of the adapter board, which is used to flexibly configure the xy-axis direction of the touch screen when the xy-axis direction of the touch screen is inconsistent with the system at the time of leaving the factory, and is used to cancel the cumbersome steps of reflashing the touch screen firmware;
[0144] S3.3: During the operation of the MIPI LCD screen driver, through the MIPI LCD screen driver calling the read function of the nvmem driver, it reads and parses the initialization sequence and screen timing of the MIPI LCD screen from the EEPROM of the adapter board. Subsequently, it sends the initialization sequence through the MIPI DSI 0P / N signal lines of the MIPI DSI LCD interface J2, and sets the screen timing to the display subsystem of the Linux kernel to prepare for the correct output of the screen display data;
[0145] After setting the screen timing, the display data is sent to the screen of the MIPI LCD screen through the CPU of the main control board, and the MIPI LCD screen displays the picture.
[0146] Among them, the Linux kernel, the uboot program, the kernel program, the nvmem driver, the touch screen driver, and the MIPI LCD screen driver based on the Linux kernel are prior arts.
[0147] Specifically, before reading the screen timing sequence and initialization sequence of the MIPI LCD screen, first read the header information of the firmware data, obtain the screen timing sequence, the offset address and length of the initialization sequence from the header information, and then obtain the corresponding data according to the offset address and length. Figure 4 and 7 As shown in 7 , the data structure of the header information of the firmware data includes
[0148] magic: The set value is 0xdead5a5a, which is used to mark whether there is firmware in the EEPROM of the adapter board;
[0149] vendor: Used to store the manufacturer names of the MIPI LCD screen and the adapter board;
[0150] model: Used to store the model of the MIPI LCD screen;
[0151] version: Used to store the version information of the firmware of the MIPI LCD screen;
[0152] timing_entry: Used to store the offset address and length of the screen timing sequence of the MIPI LCD screen;
[0153] init_seq_entry: Used to store the offset address and length of the initialization sequence of the MIPI LCD screen;
[0154] exit_seq_entry: Used to store the offset address and length of the exit sequence of the MIPI LCD screen;
[0155] touchscreen_entry: Used to store the offset address and length of the touch screen attributes of the touch screen;
[0156] firmware_size: Used to store the size of the firmware;
[0157] Figure 5 and 7 As shown in 7 , the screen timing sequence is used to set the screen display signal timing, and the data structure of the screen timing sequence includes
[0158] pixelclock: For the pixel clock, the value is (hactive + hfront_porch +
[0159] (hback_porch + hsync_len) * (vactive + vfront_porch + vback_porch + vsync_len) * 60;
[0160] hactive: For horizontal pixel size;
[0161] hfront_porch: For LCD hfp parameter;
[0162] hback_porch: For LCD hbp parameter;
[0163] hsync_len: For LCD hspw parameter;
[0164] vactive: For vertical pixel size;
[0165] vfront_porch: For LCD vfp parameter
[0166] vback_porch: For LCD vbp parameter;
[0167] vsync_len: For LCD vspw parameter;
[0168] flags: For setting the polarities of hsync, vsync, de, and clk signal lines;
[0169] Figure 6 and 7 As shown, the data structure of the touch screen attributes includes:
[0170] max_x, max_y: Read from the touch screen ic, no setting required;
[0171] invert_x: Set the x-axis flip, value of true for flipping, false for no flipping;
[0172] invert_y: Set the y-axis flip, value of true for flipping, false for no flipping;
[0173] swap_x_y: Set the xy-axis swap, value of true for swapping, false for no swapping;
[0174] The initialization sequence is an 8-bit unsigned array init_seq. The array init_seq stores the initialization sequence of the MIPI LCD screen. The data structure of the initialization sequence stored in the array init_seq is the same as the data structure used by the main control board to represent the device tree.
[0175] Each row of the array init_seq represents the command data sent to the MIPI LCD screen once, and the format is as follows:
[0176] The first three bytes of each line respectively represent Data Type, Delay, and Payload Length. The data starting from the fourth byte represents the Payload with a length of Length.
[0177] Among them, there are three types for the first byte Data Type.
[0178] The first type is 0x39, representing long packet write, and it can send more than two parameters after sending a command.
[0179] The second type is 0x15, representing short packet write, and it can only send one parameter after sending a command.
[0180] The third type is 0x05, also representing short packet write, and it cannot continue to send parameters after sending a command.
[0181] The data structure code for the initialization sequence is as follows:
[0182] static unsigned char init_seq[] = {
[0183] 0x39, 0x00, 0x04, 0xFF, 0x98, 0x81, 0x03,
[0184] 0x15, 0x00, 0x02, 0x02, 0x00,
[0185] 0x05, 0x78, 0x01, 0x11,
[0186] 0x05, 0x14, 0x01, 0x29,
[0187] };
[0188] The exit sequence is an 8-bit unsigned array exit_seq, and the array format of the array exit_seq is the same as that of the array init_seq.
[0189] The array exit_seq is used to store the commands for the MIPI LCD to enter the sleep and turn off the screen state. Using 0x28 means to turn off the display, and using 0x10 means to enter the sleep state. The data structure code is as follows:
[0190] static unsigned char exit_seq[] = {
[0191] 0x05, 0x78, 0x01, 0x28,
[0192] 0x05, 0x00, 0x01, 0x10,
[0193] };
[0194] The implementation steps for reading and parsing the initialization sequence, exit sequence, and screen timing sequence are as follows:
[0195] 1). Obtain the nvmem device:
[0196] The main control board uses the devm_nvmem_device_get function to obtain the nvmem device associated with the MIPI LCD screen, including the EEPROM device of the adapter board;
[0197] If the acquisition fails, return the error code indicating acquisition failure;
[0198] 2). Allocate memory:
[0199] The main control board uses the devm_kzalloc function to allocate memory for storing firmware_header, timing, init_seq, exit_seq, and drm_display_mode. Among them, drm_display_mode is a data structure in the drm framework used to configure the output of the display controller;
[0200] If the allocation fails, return the code ENOMEM;
[0201] 3). Read the firmware header information:
[0202] The main control board uses the nvmem_device_read function to read the firmware header information starting from the offset address 0 in the nvmem device;
[0203] Verify the legality of the firmware. If firmware_size is less than or equal to 0 or magic is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful;
[0204] When it is determined that the firmware verification fails, print an error message and return the code EINVAL;
[0205] 4). Read the screen timing sequence
[0206] The main control board reads the timing configuration from the EEPROM of the adapter board according to the offset address and length of the timing sequence in the header information using the nvmem_device_read function; if the read fails, return the corresponding error code. If the read is successful, perform step 5);
[0207] Step 5). Read the initialization and exit sequence data:
[0208] According to the offset addresses and lengths of the arrays init_seq and exit_seq in the header information, use the nvmem_device_read function to read the data of the arrays init_seq and exit_seq from the EEPROM of the adapter board respectively;
[0209] If the read fails, return the error code indicating the read failure.
[0210] 6) Convert the screen timing sequence data:
[0211] The main control board uses the drm_display_mode_from_videomode function to convert the screen timing sequence data into a drm_display_mode structure and fill it into the desc structure.
[0212] 7) Extract the bus flags:
[0213] The main control board uses the drm_bus_flags_from_videomode function to convert the flags in the timing into drm bus_flags and fill them into the desc structure.
[0214] 8) Initialize and parse the exit command sequence:
[0215] The main control board converts the sequence of the array init_seq read from the EEPROM of the adapter board into command data that can be sent by MIPI DSI by calling the panel_simple_parse_cmd_seq function;
[0216] The parsing process of the sequence of the array init_seq is as follows:
[0217] 8.1) Calculate the number of commands: First, read the first 3 bytes of the first line to obtain the value of Payload Length. 3 + Payload Length is the start position of the commands in the second line. Then continue to read 3 bytes to obtain the value of Payload Length of the second line, and then continue to add 3 + Payload Length to get the start position of the commands in the third line... and so on in the traversal process; Add variables cnt and len during the traversal process and record the number of traversals and the remaining length that has not been traversed respectively. When the value of len is less than 3, end the variable loop, and the value of the variable cnt obtained is the number of commands;
[0218] 8.2) According to the number of commands calculated above, use devm_kcalloc to allocate an array to store the commands, and then use the traversal method to fill the command array;
[0219] Each command consists of a command header and command data. The command header is the first three bytes of each line of the init_seq array. The process of traversing and filling the command array is as follows: Obtain the command header pointer of the first line of the init_seq array. Add the length of the command header to this pointer to get the pointer to the command data of the first line, and fill the content in the command header pointer and the pointer to the command data into command array 0. Then, add the length of the command data of the first line to this pointer to get the command header pointer of the second line. Add the length of the command header to this pointer to get the pointer to the command data of the second line, and fill the content in the command header pointer of the second line and the pointer to the command data into command array 1. Do the same for the third line, the fourth line, and so on.
[0220] 8.3), Send the commands in the command array to the MIPI LCD screen by calling the kernel driver function panel_simple_xfer_dsi_cmd_seq.
[0221] 8.4), The process of exiting the parsing of the command sequence is the same as the parsing process and principle of the initialization commands.
[0222] The implementation steps for reading and parsing the touch screen attribute data are as follows:
[0223] 1), Obtain the nvmem device:
[0224] The main control board uses the devm_nvmem_device_get function to obtain the nvmem device associated with the touch screen and obtain the EEPROM device of the adapter board. If the acquisition fails, return the error code indicating the acquisition failure.
[0225] 2), Allocate memory:
[0226] The main control board uses the devm_kzalloc function to allocate memory for storing the firmware_header and touch_prop;
[0227] If the allocation fails, return the code ENOMEM.
[0228] 3), Read the firmware header information:
[0229] The main control board uses the nvmem_device_read function to read the firmware header information starting from the offset address 0 in the nvmem device;
[0230] Verify the legality of the firmware. If the firmware_size is less than or equal to 0 or the magic is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful.
[0231] If the firmware verification fails, print an error message and return the code EINVAL.
[0232] If the firmware verification is successful, execute step 4).
[0233] 4) Read the touch screen configuration property touch_prop:
[0234] The main control board uses the nvmem_device_read function to read the touch_prop configuration from the EEPROM of the adapter board according to the offset address and length of touch_prop in the header information.
[0235] If the reading fails, return the error code of the reading failure. If the reading is successful, execute step 5).
[0236] 5) Use the values of invert_x, invert_y, and swap_x_y in touch_prop read from the EEPROM of the adapter board to set the members invert_x, invert_y, and swap_x_y in the touchscreen_properties structure of the touch screen properties in the system respectively.
[0237] After the setting is completed, the kernel driver of the main control board automatically determines whether the touch screen needs to flip the x-axis, flip the y-axis, or swap the xy-axis according to the values of invert_x, invert_y, and swap_x_y in the touchscreen_properties structure.
Claims
1. A configuration method for a general and convenient MIPI LCD display screen, characterized in that: The components of the MIPI LCD display screen in terms of hardware include an MIPI LCD screen and an adapter board. The adapter board is fixed to the back of the MIPI LCD screen. The adapter board is configured with an EEPROM, a backlight driver U1, and an MIPI DSI LCD interface J2 for connecting to the main control board. The MIPI DSI LCD interface J2 is respectively connected to the EEPROM, the backlight driver U1, and an MIPI LCD interface J1. The MIPI LCD interface J1 is connected to the MIPI LCD screen; The EEPROM of the adapter board stores firmware data containing the configuration information of the MIPI LCD screen. The firmware data includes header information, screen timing sequence, and initialization sequence in terms of data structure. The configuration program of the Linux kernel of the main control board is modified such that when the MIPI LCD screen is connected to the main control board, the Linux kernel reads the firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver of the Linux kernel. The parsed configuration information is used by the MIPI LCD screen driver to initialize the MIPI LCD screen and set the screen timing sequence, realizing automatic recognition and automatic configuration of the MIPI LCD screen by the main control board after the MIPI LCD screen is connected.
2. The configuration method of a general and convenient MIPI LCD display screen according to claim 1, characterized in that: The components of the MIPI LCD display screen in terms of hardware further include a touch screen. The touch screen is fixed in front of the MIPI LCD screen to form an MIPI LCD touch display screen. The adapter board is further provided with a touch screen interface J3. The MIPI DSI LCD interface J2 is connected to the touch screen interface J3, and the touch screen interface J3 is connected to the touch screen. The EEPROM is connected to the I2C signal line between the MIPI DSI LCD interface J2 and the touch screen interface J3. The EEPROM stores firmware data containing the configuration information of the MIPI LCD screen and the configuration information of the touch screen. The firmware data includes header information, screen timing sequence, initialization sequence, and touch screen attributes in terms of data structure. The configuration program of the Linux kernel of the main control board is modified such that when the MIPI LCD touch display screen is connected to the main control board, the Linux kernel reads the firmware data from the EEPROM of the adapter board and adds the configuration information parsed from the firmware data to the original MIPI LCD screen driver and touch screen driver of the Linux kernel. The parsed configuration information is used by the MIPI LCD screen driver to initialize the MIPI LCD screen, set the screen timing sequence, and initialize the touch screen, realizing automatic recognition and automatic configuration of the MIPI LCD touch display screen by the main control board after the MIPI LCD touch display screen is connected.
3. A configuration method for a general and convenient MIPI LCD display screen according to claim 2, characterized in that: After the MIPI LCD touch display screen is connected to the main control board, the Linux kernel includes steps for writing a device tree. The Linux kernel first initializes the EEPROM of the adapter board through the original nvmem driver, and then adds nvmem driver attributes to the device tree nodes of the MIPI LCD screen and the touch screen, associating the EEPROM with the MIPI LCD screen and the touch screen. It also deletes the initialization sequence, exit sequence, and configuration information of the screen timing sequence of the original device tree node of the MIPI LCD screen driver. The MIPI LCD screen driver uses the configuration information read and parsed from the EEPROM to initialize the MIPI LCD screen and the touch screen respectively, thereby implementing the step of the main control board canceling the separate configuration of a device tree file for each model of the MIPI LCD screen.
4. A configuration method for a general and convenient MIPI LCD display screen according to claim 2, characterized in that: The MIPI DSI LCD interface J2 transmits the interrupt signal pin and reset signal pin of the touch screen through pins TP_INT and TP_RST. The MIPI DSI LCD interface J2 transmits the I2C signal of the touch screen coordinate data of the touch screen through pins TP_SCL and TP_SDA. In addition, the MIPI DSI LCD interface J2 also accesses the EEPROM of the adapter board through pins TP_SCL and TP_SDA. The pins TP_SCL and TP_SDA of the MIPI DSI LCD interface J2 are respectively connected to the pins SCL and SDA of the EEPROM of the adapter board.
5. A configuration method for a general and convenient MIPI LCD display screen according to claim 1, characterized in that: The MIPI LCD interface J1 is an interface for connecting the MIPI LCD screen, providing MIPI DSI signals and 3.3V power supply. Among them, the MIPI LCD interface J1 is respectively connected to the outputs of the backlight driver chip through pins LEDA and LEDK, used to connect the positive and negative poles of the backlight of the MIPI LCD screen and supply power to the backlight. The MIPI LCD interface J1 provides a PWM control signal for controlling the current magnitude for the backlight through pin LCD_BL_PWM.
6. A configuration method for a general and convenient MIPI LCD display screen according to any one of claims 2 to 5, characterized in that: After the MIPI LCD touch display screen is connected to the main control board, the main control board automatically executes the following steps based on the Linux kernel. S1: The main control board is powered on. The CPU of the main control board first executes the Bootrom code built in the main control board, searches for a bootable storage device according to the set boot order, and then loads the uboot program of the main control board from the bootable storage device. S2: In the uboot stage, initialize the serial port, storage device, and network interface through the uboot program, and load and boot the kernel program of the main control board. S3: During the startup process of the kernel program, the main control board initializes the nvmem driver, touch screen driver, and MIPI LCD screen driver respectively. S3.1: Initialize the EEPROM of the adapter board through the nvmem driver, encapsulate the read and write methods of the EEPROM of the adapter board at the same time, and provide common functions for the touch screen driver and the MIPI LCD screen driver when reading and writing the EEPROM of the adapter board. S3.2: The touchscreen driver calls the read function of the nvmem driver to read and parse the touchscreen configuration information from the EEPROM of the adapter board, and then sets the invert_x, invert_y, and swap_x_y parameters of the touchscreen to complete the initialization of the touchscreen; After the initialization of the touchscreen is completed, when the touchscreen is touched, the touchscreen reports touch events to the input subsystem of the Linux kernel; the EEPROM of the adapter board is used to store the invert_x, invert_y, and swap_x_y parameters of the touchscreen, which is used to flexibly configure the xy-axis direction of the touchscreen when the xy-axis direction of the touchscreen is inconsistent with the system at the time of touchscreen factory, and is used to cancel the cumbersome steps of reflashing the touchscreen firmware; S3.3: During the operation of the MIPI LCD screen driver, the MIPI LCD screen driver calls the read function of the nvmem driver to read and parse the initialization sequence and screen timing of the MIPI LCD screen from the EEPROM of the adapter board, and then sends the initialization sequence through the MIPIDSID0P / N signal lines of the MIPI DSI LCD interface J2, and sets the screen timing to the display subsystem of the Linux kernel to prepare for the correct output of the screen display data; After setting the screen timing, the CPU of the main control board sends display data to the screen of the MIPI LCD screen, and the MIPI LCD screen displays the picture.
7. A configuration method for a general and convenient MIPI LCD display screen according to claim 6, characterized in that: Before reading the screen timing and the initialization sequence of the MIPI LCD screen, first read the header information of the firmware data, obtain the screen timing, the offset address and length of the initialization sequence from the header information, and then obtain the corresponding data according to the offset address and length. The data structure of the header information of the firmware data includes magic: The set value is 0xdead5a5a, which is used to mark whether there is firmware in the EEPROM of the adapter board; vendor: Used to store the manufacturer name of the MIPI LCD screen and the adapter board; model: Used to store the model of the MIPI LCD screen; version: Used to store the version information of the firmware of the MIPI LCD screen; timing_entry: Used to store the offset address and length of the screen timing of the MIPI LCD screen; init_seq_entry: Used to store the offset address and length of the initialization sequence of the MIPI LCD screen; exit_seq_entry: Used to store the offset address and length of the exit sequence of the MIPI LCD screen; touchscreen_entry: Used to store the offset address and length of the touchscreen attributes of the touchscreen; firmware_size: Used to store the size of the firmware; The screen timing is used to set the screen display signal timing. The data structure of the screen timing includes pixelclock: For pixel clock, the value is (hactive + hfront_porch + hback_porch + hsync_len) * (vactive + vfront_porch + vback_porch + vsync_len) * 60; hactive: For horizontal pixel size; hfront_porch: For LCD hfp parameter; hback_porch: For LCD hbp parameter; hsync_len: For LCD hspw parameter; vactive: For vertical pixel size; vfront_porch: For LCD vfp parameter vback_porch: For LCD vbp parameter; vsync_len: For LCD vspw parameter; flags: For setting the polarities of hsync, vsync, de, and clk signal lines; The data structure of the touch screen attributes includes: max_x, max_y: Read from the touch screen ic, no need to set; invert_x: Set the x-axis flip, the value is true for flipping and false for not flipping; invert_y: Set the y-axis flip, the value is true for flipping and false for not flipping; swap_x_y: Set the xy-axis swap, the value is true for swapping and false for not swapping; The initialization sequence is an 8-bit unsigned array init_seq. The array init_seq stores the initialization sequence of the MIPI LCD screen. The data structure of the initialization sequence stored in the array init_seq is the same as the data structure used by the main control board to represent the device tree. Each row of the array init_seq represents the command data sent to the MIPI LCD screen once, and the format is as follows: The first three bytes of each row represent Data Type, Delay, and Payload Length respectively. The data starting from the fourth byte represents the Payload with a length of Length. Among them, the first byte Data Type has three types. The first type is 0x39, representing a long packet write, and more than two parameters can be sent after sending a command; The second type is 0x15, representing a short packet write, and only one parameter can be sent after sending a command; The third type is 0x05, also representing a short packet write, and no more parameters can be sent after sending a command; The code of the data structure of the initialization sequence is as follows: static unsigned char init_seq[] = { 0x39, 0x00, 0x04, 0xFF, 0x98, 0x81, 0x03, 0x15, 0x00, 0x02, 0x02, 0x00, 0x05, 0x78, 0x01, 0x11, 0x05, 0x14, 0x01, 0x29, }; The exit sequence is an 8-bit unsigned array exit_seq. The array format of the array exit_seq is the same as that of the array init_seq. exit_seq is used to store the commands for MIPI LCD to enter the sleep and turn off the screen. 0x28 is used to indicate turning off the display, and 0x10 is used to indicate entering the sleep. The data structure code is as follows: static unsigned char exit_seq[] = { 0x05, 0x78, 0x01, 0x28, 0x05, 0x00, 0x01, 0x10, }。 8. A configuration method for a general and convenient MIPI LCD display screen according to claim 6, characterized in that: The implementation steps for reading and parsing the initialization sequence, the exit sequence, and the screen timing are as follows: 1). Obtain the nvmem device: The main control board uses the devm_nvmem_device_get function to obtain the nvmem device associated with the MIPI LCD screen, including the EEPROM device of the adapter board. If the acquisition fails, return the error code indicating the acquisition failure. 2). Allocate memory: The main control board uses the devm_kzalloc function to allocate memory for storing firmware_header, timing, init_seq, exit_seq, and drm_display_mode. Among them, drm_display_mode is a data structure in the drm framework and is used to configure the output of the display controller. If the allocation fails, return the code ENOMEM. 3). Read the firmware header information: The main control board uses the nvmem_device_read function to read the firmware header information starting from the offset address 0 in the nvmem device. Verify the legality of the firmware. If firmware_size is less than or equal to 0 or magic is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful. When it is determined that the firmware verification fails, print an error message and return the code EINVAL. 4). Read the screen timing The main control board reads the timing configuration from the EEPROM of the adapter board according to the offset address and length of the timing in the header information using the nvmem_device_read function. If the reading fails, return the corresponding error code. If the reading is successful, execute step 5). Step 5). Read the initialization and exit sequence data: According to the offset addresses and lengths of the arrays init_seq and exit_seq in the header information, use the nvmem_device_read function to read the data of the arrays init_seq and exit_seq from the EEPROM of the adapter board respectively. If the reading fails, return the error code indicating the reading failure. 6). Convert the screen timing data: The main control board uses the drm_display_mode_from_videomode function to convert the screen timing data into a drm_display_mode structure and fills it into the desc structure; 7) Extract bus flag: The main control board uses the drm_bus_flags_from_videomode function to convert the flags in timing into drm bus_flags and fill them into the desc structure; 8) Initialization and exit command sequence analysis: The main control board converts the sequence of the array init_seq read from the EEPROM of the adapter board into command data that can be sent by MIPIDSI by calling the panel_simple_parse_cmd_seq function; The parsing process of the sequence of array init_seq is as follows: 8.1) Calculate the number of commands: First, read the first 3 bytes of the first line to obtain the value of Payload Length. 3 + Payload Length is the starting position of the second line of commands. Continue reading 3 bytes to obtain the value of Payload Length of the second line. Then, add 3 + Payload Length to obtain the starting position of the third line of commands. The traversal process is similar. During the traversal process, add variables cnt and len to record the number of traversals and the remaining length of the traversal, respectively. When the value of len is less than 3, end the variable loop. The value of the variable cnt is the number of commands. 8.2) Based on the number of commands calculated above, use devm_kcalloc to allocate an array for storing commands, and then use traversal to fill the command array; Each command consists of a command header and command data. The command header is the first three bytes of each row of the init_seq array. The process of traversing and filling the command array is as follows: get the command header pointer of the first row of the init_seq array, add the length of the command header to this pointer to get the pointer of the first row of command data, and fill the content in the command header pointer and the pointer of the command data into command array 0; then add the length of the first row of command data to this pointer to get the pointer of the second row of command header, add the length of the command header to this pointer to get the pointer of the second row of command data, and fill the content in the second row of command header pointer and the pointer of the command data into command array 1; the third row, the fourth row... and so on; 8.3) Send the commands in the command array to the MIPI LCD screen by calling the kernel driver function panel_simple_xfer_dsi_cmd_seq; 8.4) The parsing process and principle of the exit command sequence are the same as those of the initialization command.
9. A configuration method for a general and convenient MIPI LCD display screen according to claim 6, characterized in that: The steps for reading and analyzing the touch screen attribute data are as follows: 1) Get nvmem device: The main control board uses the `devm_nvmem_device_get` function to obtain the nvmem device associated with the touch screen and obtain the EEPROM device of the adapter board; if the acquisition fails, it returns the error code of the acquisition failure. 2) Allocate memory: The main control board uses the `devm_kzalloc` function to allocate memory for storing the `firmware_header` and `touch_prop`. If the allocation fails, it returns the code `ENOMEM`. 3) Read the firmware header information: The main control board uses the `nvmem_device_read` function to read the firmware header information starting from the offset address 0 in the nvmem device. Verify the legality of the firmware. If `firmware_size` is less than or equal to 0 or `magic` is not equal to 0xDEAD5A5A, it is determined that the firmware verification fails; otherwise, it is determined that the firmware verification is successful. If it is determined that the firmware verification fails, it prints an error message and returns the code `EINVAL`. If it is determined that the firmware verification is successful, execute step 4). 4) Read the touch screen configuration property `touch_prop`: The main control board reads the `touch_prop` configuration from the EEPROM of the adapter board using the `nvmem_device_read` function according to the offset address and length of `touch_prop` in the header information. If the reading fails, it returns the error code of the reading failure. If the reading is successful, execute step 5). 5) Use the values of `invert_x`, `invert_y`, and `swap_x_y` in the `touch_prop` read from the EEPROM of the adapter board to set the `invert_x`, `invert_y`, and `swap_x_y` members in the `touchscreen_properties` structure of the touch screen properties in the system respectively. After the setting is completed, the kernel driver of the main control board automatically determines whether the touch screen needs to flip the x-axis, flip the y-axis, or swap the xy-axis according to the values of `invert_x`, `invert_y`, and `swap_x_y` in the `touchscreen_properties` structure.
Citation Information
Cited By
Dynamic modification method, device and system for firmware parameters of display screen
CN121979547A