1e41f4b71Sopenharmony_ci# LCD
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Overview
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci### Function
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThe Liquid Crystal Display (LCD) driver performs operations such as powering on the LCD and initializing the internal registers of the driver integrated circuits (ICs).
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciThe display driver model based on the [Hardware Driver Foundation (HDF)](driver-overview-foundation.md) provides the following functions:
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci- Provides a basic framework for LCD driver development to improve development efficiency.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci- Facilitates driver porting across OSs and chip platforms.
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThe following figure shows the HDF-based display driver model.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Figure 1** HDF-based display driver model
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci![image](figures/architecture-of-the-display-driver-model.png "Display Driver Model")
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciThe display driver model consists of the display common driver layer, SoC adapter layer, and LCD panel driver layer. The HDF-based display driver model shields the differences between kernel forms through platform and OSAL APIs so that the LCD driver can be easily ported across OSs and chip platforms. The display driver model connects to the display common Hardware Abstraction Layer (HAL), supports the implementation of the Hardware Device Interface (HDI), and provides various driver capability interfaces for graphics services through the Display-HDI.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci- Display common driver layer: connects to the display common HAL through the IOService data channel provided by the HDF to receive and process various upper-layer calls in a centralized manner.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci- SoC adapter layer: decouples the display driver from the SoC driver, configures parameters related to the chip platform, and passes the calls from the platform driver layer to the LCD driver layer.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci- LCD panel driver layer: provides LCD-related APIs for sending the initialization sequence, powering on/off, and setting the backlight.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciThe display driver model leverages the capabilities and APIs provided by the platform to simplify the display driver development and improve the efficiency.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci### Basic Concepts
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ciThe LCD interfaces include the Mobile Industry Processor Interface (MIPI) Display Serial Interface (DSI), Transistor-Transistor Logic (TTL) interface, and Low Voltage Differential Signaling (LVDS) interface. The MIPI DSI and TTL interfaces are commonly used. Here is a brief introduction to them.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci- MIPI DSI
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci    **Figure 2** MIPI DSI
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci    ![](figures/mipi-dsi.png "MIPI DSI")
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci    The DSI is defined by the MIPI Alliance for the displays used in mobile devices. The MIPI DSI is used to transmit image data, in compliance with the MIPI protocol. Generally, control information is sent to the peer IC in the form of MIPI packets over the MIPI DSI, without the need of additional peripheral interfaces.
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci- TTL interface
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci    **Figure 3** TTL interface
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci    ![](figures/ttl-interface.png "ttl-interface")
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci    TTL level signals are generated by TTL devices, which are a major type of digital integrated circuits. TTL devices are manufactured using the bipolar process and feature high speed, low power consumption, and diversified types.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci    The TTL interface is used to transmit data in parallel mode under control signals. It transmits data signals, clock signals, and control signals (such as line synchronization signals, frame synchronization signals, and data validity signals). For the LCD with the TTL, additional peripheral interfaces, such as the Serial Peripheral Interface (SPI) and Inter-Integrated Circuit (I2C), are required for the read and write of the internal registers.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci### Constraints
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ciIn addition to the IC model, you must consider the LCD peripheral circuit design, LCD interface unit of the baseband chip, backlight IC control, and upper-layer software programs. All these factors affect the development of the LCD driver.
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci## Development Guidelines
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci### When to Use
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ciBefore applying your device with OpenHarmony system, you need to perform LCD driver adaption. The HDF-based display driver model provides a unified driver model for LCD adaptation regardless of the OS (LiteOS or Linux OS) and chip platform (Hi35xx, Hi38xx, or V3S).
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci### Available APIs
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ciTo adjust the parameters of the LCD, establish a display channel with the display, and implement the display effect, use **display::host** to register the **PanelInfo** struct and interface information and add device description.
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ciTable 1 APIs required for LCD driver adaptation
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci| API                                                 | Description               |
70e41f4b71Sopenharmony_ci| :------------------------------------------------------ | ------------------- |
71e41f4b71Sopenharmony_ci| static int32_t MipiDsiInit(struct PanelInfo *info)      | Initializes the corresponding chip platform driver.|
72e41f4b71Sopenharmony_ci| static int32_t LcdResetOn(void)                         | Sets the status of the reset pin.|
73e41f4b71Sopenharmony_ci| int32_t SampleEntryInit(struct HdfDeviceObject *object) | Initializes the entry function of the device driver.   |
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci### How to Develop
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci1. Add the device configuration related to the LCD driver.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci2. Adapt the driver to the chip at the SoC adapter layer.
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci3. Add the LCD panel driver and register the panel driver data in the driver entry function **Init**. The driver data interface implements the following features:
83e41f4b71Sopenharmony_ci   - Powering on/off the LCD device
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci      Based on the LCD hardware connection, use the GPIO APIs provided by the platform to perform operations on the LCD pins, such as the reset pin and IOVCC pin. For details about the power-on sequence, see the SPEC provided by the LCD supplier.
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci   - Sending the initialization sequence
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci      Based on the LCD hardware interfaces, use the I2C, SPI, and MIPI interfaces provided by the platform to download the LCD initialization sequence. For details, see the SPEC provided by the LCD supplier.
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci4. (Optional) Implement other HDF interfaces as required.
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci5. (Optional) Create other device nodes for implementing service logic or debugging based on the HDF as required.
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci### Example
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciThe following uses the Hi35xx series chips as an example to describe how to perform LCD driver adaptation.
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci1. Add device information in the **vendor/bearpi/bearpi_hm_micro/hdf_config/device_info/device_info.hcs** file.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci   ```c++
102e41f4b71Sopenharmony_ci   /* Configuration of the devices related to the display driver */
103e41f4b71Sopenharmony_ci   display :: host {
104e41f4b71Sopenharmony_ci       hostName = "display_host";
105e41f4b71Sopenharmony_ci       /* Configuration of the HDF display driver */
106e41f4b71Sopenharmony_ci       device_hdf_disp :: device {
107e41f4b71Sopenharmony_ci           device0 :: deviceNode {
108e41f4b71Sopenharmony_ci               policy = 2;
109e41f4b71Sopenharmony_ci               priority = 200;
110e41f4b71Sopenharmony_ci               permission = 0660;
111e41f4b71Sopenharmony_ci               moduleName = "HDF_DISP";
112e41f4b71Sopenharmony_ci               serviceName = "hdf_disp";
113e41f4b71Sopenharmony_ci           }
114e41f4b71Sopenharmony_ci       }
115e41f4b71Sopenharmony_ci       /* Configuration of the driver device at the SoC adapter layer */
116e41f4b71Sopenharmony_ci       device_hi35xx_disp :: device {
117e41f4b71Sopenharmony_ci           device0 :: deviceNode {
118e41f4b71Sopenharmony_ci               policy = 0;
119e41f4b71Sopenharmony_ci               priority = 199;
120e41f4b71Sopenharmony_ci               moduleName = "HI351XX_DISP";
121e41f4b71Sopenharmony_ci           }
122e41f4b71Sopenharmony_ci       }
123e41f4b71Sopenharmony_ci       /* Configuration of the LCD driver */
124e41f4b71Sopenharmony_ci       device_lcd :: device {
125e41f4b71Sopenharmony_ci           device0 :: deviceNode {
126e41f4b71Sopenharmony_ci               policy = 0;
127e41f4b71Sopenharmony_ci               priority = 100;
128e41f4b71Sopenharmony_ci               preload = 0;
129e41f4b71Sopenharmony_ci               moduleName = "LCD_Sample";
130e41f4b71Sopenharmony_ci           }
131e41f4b71Sopenharmony_ci           device1 :: deviceNode {
132e41f4b71Sopenharmony_ci               policy = 0;
133e41f4b71Sopenharmony_ci               priority = 100;
134e41f4b71Sopenharmony_ci               preload = 2;
135e41f4b71Sopenharmony_ci               moduleName = "LCD_SampleXX";
136e41f4b71Sopenharmony_ci           }
137e41f4b71Sopenharmony_ci       }
138e41f4b71Sopenharmony_ci   }
139e41f4b71Sopenharmony_ci   ```
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci2. Configure the chip platform driver information in **drivers/hdf_core/framework/model/display/driver/adapter_soc/hi35xx_disp.c**.
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci   ```c++
144e41f4b71Sopenharmony_ci   /* Configuration of the display driver to adapt to the MIPI and chip platform */
145e41f4b71Sopenharmony_ci   static int32_t MipiDsiInit(struct PanelInfo *info)
146e41f4b71Sopenharmony_ci   {
147e41f4b71Sopenharmony_ci       int32_t ret;
148e41f4b71Sopenharmony_ci       struct DevHandle *mipiHandle = NULL;
149e41f4b71Sopenharmony_ci       struct MipiCfg cfg;
150e41f4b71Sopenharmony_ci   
151e41f4b71Sopenharmony_ci       mipiHandle = MipiDsiOpen(0);
152e41f4b71Sopenharmony_ci       if (mipiHandle == NULL) {
153e41f4b71Sopenharmony_ci           HDF_LOGE("%s: MipiDsiOpen failure", __func__);
154e41f4b71Sopenharmony_ci           return HDF_FAILURE;
155e41f4b71Sopenharmony_ci       }
156e41f4b71Sopenharmony_ci       cfg.lane = info->mipi.lane;
157e41f4b71Sopenharmony_ci       cfg.mode = info->mipi.mode;
158e41f4b71Sopenharmony_ci       cfg.format = info->mipi.format;
159e41f4b71Sopenharmony_ci       cfg.burstMode = info->mipi.burstMode;
160e41f4b71Sopenharmony_ci       cfg.timing.xPixels = info->width;
161e41f4b71Sopenharmony_ci       cfg.timing.hsaPixels = info->hsw;
162e41f4b71Sopenharmony_ci       cfg.timing.hbpPixels = info->hbp;
163e41f4b71Sopenharmony_ci       cfg.timing.hlinePixels = info->width + info->hbp + info->hfp + info->hsw;
164e41f4b71Sopenharmony_ci       cfg.timing.vsaLines = info->vsw;
165e41f4b71Sopenharmony_ci       cfg.timing.vbpLines = info->vbp;
166e41f4b71Sopenharmony_ci       cfg.timing.vfpLines = info->vfp;
167e41f4b71Sopenharmony_ci       cfg.timing.ylines = info->height;
168e41f4b71Sopenharmony_ci       /* 0 : no care */
169e41f4b71Sopenharmony_ci       cfg.timing.edpiCmdSize = 0;
170e41f4b71Sopenharmony_ci       cfg.pixelClk = CalcPixelClk(info);
171e41f4b71Sopenharmony_ci       cfg.phyDataRate = CalcDataRate(info);
172e41f4b71Sopenharmony_ci       /* Configure the MIPI device. */
173e41f4b71Sopenharmony_ci       ret = MipiDsiSetCfg(mipiHandle, &cfg);
174e41f4b71Sopenharmony_ci       if (ret != HDF_SUCCESS) {
175e41f4b71Sopenharmony_ci           HDF_LOGE("%s:MipiDsiSetCfg failure", __func__);
176e41f4b71Sopenharmony_ci       }
177e41f4b71Sopenharmony_ci       MipiDsiClose(mipiHandle);
178e41f4b71Sopenharmony_ci       HDF_LOGI("%s:pixelClk = %d, phyDataRate = %d\n", __func__,
179e41f4b71Sopenharmony_ci           cfg.pixelClk, cfg.phyDataRate);
180e41f4b71Sopenharmony_ci       return ret;
181e41f4b71Sopenharmony_ci   }
182e41f4b71Sopenharmony_ci   ```
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci3. Add a device.
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci   - Define driver-related interfaces (**drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci     ```c++
189e41f4b71Sopenharmony_ci     #define RESET_GPIO                5
190e41f4b71Sopenharmony_ci     #define MIPI_DSI0                 0
191e41f4b71Sopenharmony_ci     #define BLK_PWM1                  1
192e41f4b71Sopenharmony_ci     #define PWM_MAX_PERIOD            100000
193e41f4b71Sopenharmony_ci     /* Set the backlight. */
194e41f4b71Sopenharmony_ci     #define MIN_LEVEL                 0
195e41f4b71Sopenharmony_ci     #define MAX_LEVEL                 255
196e41f4b71Sopenharmony_ci     #define DEFAULT_LEVEL             100
197e41f4b71Sopenharmony_ci     #define WIDTH                     480
198e41f4b71Sopenharmony_ci     #define HEIGHT                    960
199e41f4b71Sopenharmony_ci     #define HORIZONTAL_BACK_PORCH     20
200e41f4b71Sopenharmony_ci     #define HORIZONTAL_FRONT_PORCH    20
201e41f4b71Sopenharmony_ci     #define HORIZONTAL_SYNC_WIDTH     10
202e41f4b71Sopenharmony_ci     #define VERTICAL_BACK_PORCH       14
203e41f4b71Sopenharmony_ci     #define VERTICAL_FRONT_PORCH      16
204e41f4b71Sopenharmony_ci     #define VERTICAL_SYNC_WIDTH       2
205e41f4b71Sopenharmony_ci     #define FRAME_RATE                60
206e41f4b71Sopenharmony_ci     ```
207e41f4b71Sopenharmony_ci
208e41f4b71Sopenharmony_ci   - Define the **PanelInfo** struct (**drivers/hdf_core/framework/model/display/driver/hdf_disp.h**).
209e41f4b71Sopenharmony_ci
210e41f4b71Sopenharmony_ci     ```c++
211e41f4b71Sopenharmony_ci     struct PanelInfo {
212e41f4b71Sopenharmony_ci         uint32_t width;	          // Width
213e41f4b71Sopenharmony_ci         uint32_t height;	      // Height
214e41f4b71Sopenharmony_ci         uint32_t hbp;		      // Horizontal back porch
215e41f4b71Sopenharmony_ci         uint32_t hfp;		      // Horizontal front porch
216e41f4b71Sopenharmony_ci         uint32_t hsw; 		      // Horizontal synchronization width
217e41f4b71Sopenharmony_ci         uint32_t vbp;		      // Vertical back porch
218e41f4b71Sopenharmony_ci         uint32_t vfp;		      // Vertical front porch
219e41f4b71Sopenharmony_ci         uint32_t vsw;		      // Vertical synchronization width
220e41f4b71Sopenharmony_ci         uint32_t frameRate;             // Frame rate
221e41f4b71Sopenharmony_ci         enum LcdIntfType intfType; // LCD interface type
222e41f4b71Sopenharmony_ci         enum IntfSync intfSync;    // User timing parameter
223e41f4b71Sopenharmony_ci         struct MipiDsiDesc mipi;
224e41f4b71Sopenharmony_ci         struct BlkDesc blk;
225e41f4b71Sopenharmony_ci         struct PwmCfg pwm;
226e41f4b71Sopenharmony_ci     };
227e41f4b71Sopenharmony_ci     ```
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ci   - Initialize the LCD (**drivers/hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci     ```c++
232e41f4b71Sopenharmony_ci     static uint8_t g_payLoad0[] = { 0xF0, 0x5A, 0x5A };
233e41f4b71Sopenharmony_ci     static uint8_t g_payLoad1[] = { 0xF1, 0xA5, 0xA5 };
234e41f4b71Sopenharmony_ci     static uint8_t g_payLoad2[] = { 0xB3, 0x03, 0x03, 0x03, 0x07, 0x05, 0x0D, 0x0F, 0x11, 0x13, 0x09, 0x0B };
235e41f4b71Sopenharmony_ci     static uint8_t g_payLoad3[] = { 0xB4, 0x03, 0x03, 0x03, 0x06, 0x04, 0x0C, 0x0E, 0x10, 0x12, 0x08, 0x0A };
236e41f4b71Sopenharmony_ci     static uint8_t g_payLoad4[] = { 0xB0, 0x54, 0x32, 0x23, 0x45, 0x44, 0x44, 0x44, 0x44, 0x60, 0x00, 0x60, 0x1C };
237e41f4b71Sopenharmony_ci     static uint8_t g_payLoad5[] = { 0xB1, 0x32, 0x84, 0x02, 0x87, 0x12, 0x00, 0x50, 0x1C };
238e41f4b71Sopenharmony_ci     static uint8_t g_payLoad6[] = { 0xB2, 0x73, 0x09, 0x08 };
239e41f4b71Sopenharmony_ci     static uint8_t g_payLoad7[] = { 0xB6, 0x5C, 0x5C, 0x05 };
240e41f4b71Sopenharmony_ci     static uint8_t g_payLoad8[] = { 0xB8, 0x23, 0x41, 0x32, 0x30, 0x03 };
241e41f4b71Sopenharmony_ci     static uint8_t g_payLoad9[] = { 0xBC, 0xD2, 0x0E, 0x63, 0x63, 0x5A, 0x32, 0x22, 0x14, 0x22, 0x03 };
242e41f4b71Sopenharmony_ci     static uint8_t g_payLoad10[] = { 0xb7, 0x41 };
243e41f4b71Sopenharmony_ci     static uint8_t g_payLoad11[] = { 0xC1, 0x0c, 0x10, 0x04, 0x0c, 0x10, 0x04 };
244e41f4b71Sopenharmony_ci     static uint8_t g_payLoad12[] = { 0xC2, 0x10, 0xE0 };
245e41f4b71Sopenharmony_ci     static uint8_t g_payLoad13[] = { 0xC3, 0x22, 0x11 };
246e41f4b71Sopenharmony_ci     static uint8_t g_payLoad14[] = { 0xD0, 0x07, 0xFF };
247e41f4b71Sopenharmony_ci     static uint8_t g_payLoad15[] = { 0xD2, 0x63, 0x0B, 0x08, 0x88 };
248e41f4b71Sopenharmony_ci     static uint8_t g_payLoad16[] = { 0xC6, 0x08, 0x15, 0xFF, 0x10, 0x16, 0x80, 0x60 };
249e41f4b71Sopenharmony_ci     static uint8_t g_payLoad17[] = { 0xc7, 0x04 };
250e41f4b71Sopenharmony_ci     static uint8_t g_payLoad18[] = {
251e41f4b71Sopenharmony_ci         0xC8, 0x7C, 0x50, 0x3B, 0x2C, 0x25, 0x16, 0x1C, 0x08, 0x27, 0x2B, 0x2F, 0x52, 0x43, 0x4C, 0x40,
252e41f4b71Sopenharmony_ci         0x3D, 0x30, 0x1E, 0x06, 0x7C, 0x50, 0x3B, 0x2C, 0x25, 0x16, 0x1C, 0x08, 0x27, 0x2B, 0x2F, 0x52,
253e41f4b71Sopenharmony_ci         0x43, 0x4C, 0x40, 0x3D, 0x30, 0x1E, 0x06
254e41f4b71Sopenharmony_ci     };
255e41f4b71Sopenharmony_ci     static uint8_t g_payLoad19[] = { 0x11 };
256e41f4b71Sopenharmony_ci     static uint8_t g_payLoad20[] = { 0x29 };
257e41f4b71Sopenharmony_ci     static DevHandle g_mipiHandle = NULL;
258e41f4b71Sopenharmony_ci     static DevHandle g_pwmHandle = NULL;
259e41f4b71Sopenharmony_ci     ```
260e41f4b71Sopenharmony_ci
261e41f4b71Sopenharmony_ci   - Set the Reset pin status (**/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci     ```c++
264e41f4b71Sopenharmony_ci     static int32_t LcdResetOn(void)
265e41f4b71Sopenharmony_ci     {
266e41f4b71Sopenharmony_ci         int32_t ret;
267e41f4b71Sopenharmony_ci	 /* Set the pin direction. */
268e41f4b71Sopenharmony_ci         ret = GpioSetDir(RESET_GPIO, GPIO_DIR_OUT);
269e41f4b71Sopenharmony_ci         if (ret != HDF_SUCCESS) {
270e41f4b71Sopenharmony_ci             HDF_LOGE("GpioSetDir failure, ret:%d", ret);
271e41f4b71Sopenharmony_ci             return HDF_FAILURE;
272e41f4b71Sopenharmony_ci         }
273e41f4b71Sopenharmony_ci	 /* Write the GPIO. */
274e41f4b71Sopenharmony_ci         ret = GpioWrite(RESET_GPIO, GPIO_VAL_HIGH);
275e41f4b71Sopenharmony_ci         if (ret != HDF_SUCCESS) {
276e41f4b71Sopenharmony_ci             HDF_LOGE("GpioWrite failure, ret:%d", ret);
277e41f4b71Sopenharmony_ci             return HDF_FAILURE;
278e41f4b71Sopenharmony_ci         }
279e41f4b71Sopenharmony_ci         /* Set the delay to 20 ms. */
280e41f4b71Sopenharmony_ci         OsalMSleep(20);
281e41f4b71Sopenharmony_ci         return HDF_SUCCESS;
282e41f4b71Sopenharmony_ci     }
283e41f4b71Sopenharmony_ci     ```
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_ci   - Define the device driver entry function (**/drivers_hdf_core/framework/model/display/driver/panel/mipi_icn9700.c**).
286e41f4b71Sopenharmony_ci
287e41f4b71Sopenharmony_ci     ```c++
288e41f4b71Sopenharmony_ci     /* Initialize the entry function. */
289e41f4b71Sopenharmony_ci     int32_t SampleEntryInit(struct HdfDeviceObject *object)
290e41f4b71Sopenharmony_ci     {
291e41f4b71Sopenharmony_ci         HDF_LOGI("%s: enter", __func__);
292e41f4b71Sopenharmony_ci         if (object == NULL) {
293e41f4b71Sopenharmony_ci             HDF_LOGE("%s: param is null!", __func__);
294e41f4b71Sopenharmony_ci             return HDF_FAILURE;
295e41f4b71Sopenharmony_ci         }
296e41f4b71Sopenharmony_ci         /* Register the device driver APIs with the platform driver. */
297e41f4b71Sopenharmony_ci         if (PanelDataRegister(&g_panelData) != HDF_SUCCESS) {
298e41f4b71Sopenharmony_ci             HDF_LOGE("%s: PanelDataRegister error!", __func__);
299e41f4b71Sopenharmony_ci             return HDF_FAILURE;
300e41f4b71Sopenharmony_ci         }
301e41f4b71Sopenharmony_ci         return HDF_SUCCESS;
302e41f4b71Sopenharmony_ci     }
303e41f4b71Sopenharmony_ci     
304e41f4b71Sopenharmony_ci     /* Implement the driver. */
305e41f4b71Sopenharmony_ci     struct HdfDriverEntry g_sampleDevEntry = {
306e41f4b71Sopenharmony_ci         .moduleVersion = 1,
307e41f4b71Sopenharmony_ci         .moduleName = "LCD_SAMPLE",
308e41f4b71Sopenharmony_ci         .Init = SampleEntryInit,
309e41f4b71Sopenharmony_ci     };
310e41f4b71Sopenharmony_ci     
311e41f4b71Sopenharmony_ci     HDF_INIT(g_sampleDevEntry);
312e41f4b71Sopenharmony_ci     ```
313