Adapt to ATK-MIPI-720p screen display
1. MIPI interface of LKD3588 development board
Neardi’s LKD3588 development board displays interfaces HDMI1.4, HDMI2.0, dual-channel LVDS, and DP, and does not bring out the MIPI interface. However, the RK3588 chip has a MIPI signal interface. Looking at the schematic diagram of Neardi LKD3588, there are two MIPI-D-Phy outputs, but Neardi converts them to LVDS and HDMI interfaces. Next, MIPI_DPHY1_TX is brought out and adapted to the 720PMIPI screen of Zhengdian Atom:
MIPI_DPHY1_TX signal is converted to HDMI signal. For convenience, modify it directly in the Neardi-3588-SDK-Android-V2.0/kernel-5.10/arch/arm64/boot/dts/rockchip/rk3588-neardi-android-ld160-mipi2hdmi.dtsi device tree file. Before modifying, check the MIPI screen related information.
2. MIPI screen hardware schematic diagram
The MIPI screen used has two interfaces (4Lane and 2Lane), and the 4Lane interface is used here.
3. MIPI screen driver debugging
There are three main parts to debugging the MIPI screen:
1) Screen backlight debugging, this is the first thing to do. If the backlight is not bright, nothing can be seen on the screen. This is relatively simple and belongs to PWM related knowledge. How to debug the backlight will also be explained later.
2) Send an initialization sequence to the screen.
3) Debug the DPI parameters of the screen. Finally, you need to debug the DPI parameters of the MIPI screen, that is, HBP, HFP, VBP, VFP and other parameters.
3.1.1. PWM
The screen backlight is controlled by PWM, and the screen brightness is adjusted by the PWM waveform. In the interface diagram, Pin7 (LCD_BL) is used to control the backlight. Since the MIPI interface is not brought out on the LKD3588, there is naturally no related pin configuration. Since the PWM7 pin of the LKD3588 is brought out, we directly use PWM7 (PWM7_M3_GPIO4_C6_d_IO3_1V8) to control the backlight, and connect GPIO4_C6 to the LCD_BL pin of the MIPI screen.
GPIO4_C6 pinctrl configuration, find the following in rk3588s-pinctrl.dtsi or rk3588-vccio3-pinctrl.dtsi:
1.pwm7 {
2./omit-if-no-ref/
3.pwm7m3_pins: pwm7m3-pins {
4.rockchip,pins =
5./* pwm7_ir_m3 */
6.<4 RK_PC6 11 &pcfg_pull_none>;
7.};
8.};
Then append the following to pwm7 in rk3588-neardi-android-ld160-mipi2hdmi.dtsi:
1.pwm7: pwm@febd0030 {
2.compatible = “rockchip,rk3588-pwm”, “rockchip,rk3328-pwm”;
3.reg = <0x0 0xfebd0030 0x0 0x10>;
4.#pwm-cells = <3>;
5.pinctrl-names = “active”;
6.pinctrl-0 = <&pwm7m3_pins>; // Use the configuration in rk3588-vccio3-pinctrl.dtsi
7.clocks = <&cru CLK_PWM1>, <&cru PCLK_PWM1>;
8.clock-names = “pwm”, “pclk”;
9.status = “okay”; // Enabled status
10.};
3.1.2. Backlight node settings
Because we only modify one interface, all modifications are added to the last level of the device tree file (rk3588-neardi-android-ld160-mipi2hdmi.dtsi), and the DSI device node is modified as follows:
39 00 04 B9 FF 83 94
39 00 07 BA 63 03 68 6B B2 C0
//15 00 02 36 01(Reverse display)
//15 00 02 36 02(Positive display)
15 00 02 36 01
39 00 0B B1 48 12 72 09 32 54 71 71 57 47
39 00 07 B2 00 80 64 0C 0D 2F
39 00 16 B4 73 74 73 74 73 74 01 0C 86 75 00 3F 73 74 73 74 73 74 01 0C 86
39 00 03 B6 6E 6E
39 00 22 D3 00 00 07 07 40 07 0C 00 08 10 08 00 08 54 15 0A 05 0A 02 15 06 05 06 47 44 0A 0A 4B 10 07 07 0C 40
39 00 2D D5 1C 1C 1D 1D 00 01 02 03 04 05 06 07 08 09 0A 0B 24 25 18 18 26 27 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 20 21 18 18 18 18
39 00 2D D6 1C 1C 1D 1D 07 06 05 04 03 02 01 00 0B 0A 09 08 21 20 18 18 27 26 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 25 24 18 18 18 18
39 00 3B E0 00 0A 15 1B 1E 21 24 22 47 56 65 66 6E 82 88 8B 9A 9D 98 A8 B9 5D 5C 61 66 6A 6F 7F 7F 00 0A 15 1B 1E 21 24 22 47 56 65 65 6E 81 87 8B 98 9D 99 A8 BA 5D 5D 62 67 6B 72 7F 7F
39 00 03 C0 1F 31
15 00 02 CC 03
15 00 02 D4 02
15 00 02 BD 02
39 00 0D D8 FF FF FF FF FF FF FF FF FF FF FF FF
15 00 02 BD 00
15 00 02 BD 01
15 00 02 B1 00
15 00 02 BD 00
39 00 08 BF 40 81 50 00 1A FC 01
15 00 02 C6 ED
05 64 01 11
05 78 01 29
];
4. MIPI-RESET
To light up the MIPI screen, MIPI-RESET needs to be configured. In 3588, I defined GPIO2_PB6 as reset.
Add content to pinctrl in the rk3588-neardi-android-ld160-mipi2hdmi.dtsi device tree as follows:
&pinctrl{
lcd {
/omit-if-no-ref/
mipi_dsi1_rst: mipi-dsi1-rst {
rockchip,pins = <2 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
// rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};
At the same time, the relevant content in dsi1_panel is modified as follows:
dsi1_panel: panel@0 {
status = “okay”;
compatible = “simple-panel-dsi”;
reset-gpios = <&gpio2 RK_PB6 GPIO_ACTIVE_LOW>; // Low level reset
pinctrl-names = “default”;
pinctrl-0 = <&mipi_dsi1_rst>; // Reference mipi_dsi1_rst definition
reg = <0>;
backlight = <&backlight>;
reset-delay-ms = <100>; // Time taken for the panel to completely reset
init-delay-ms = <80>; // Time between panel reset and sending initialization sequence
enable-delay-ms = <60>;
prepare-delay-ms = <60>;
unprepare-delay-ms = <60>;
disable-delay-ms = <60>;
…
…
Screen adaptation completed.
Adapt ATK-MIPI-720p screen touch (gt9147)
There are two touch modes for touch screens: polling and interrupt. Take the ATK-MIPI 5.5-inch screen as an example, using the interrupt trigger mode, the touch IC is gt9147, the touch IC provides an interrupt signal pin (INT), and the touch information is obtained through interrupts.
1. Schematic Analysis
Add i2c device and match gt9147 related configuration in rk3588-neardi-android-ld160-mipi2hdmi.dtsi.
Interrupt, reset GPIO configuration
2. Device tree modification
Add i2c device and match gt9147 related configuration in rk3588-neardi-android-ld160-mipi2hdmi.dtsi.
Interrupt, reset GPIO configuration
3. Touch driver configuration
3. Touch driver configuration
Add driver:
Create and add gt9147 driver file gt9147.c in kernel-5.10/drivers/input/touchscreen/directory
Generate gt9147.ko file after compilation, the directory is the same as gt9147.c
Driver configuration
Compile the added driver in kernel-5.10/drivers/input/touchscreen/Makefile
obj-m += gt9147.o // Compile to .ko driver file for subsequent testing
4. Debugging
After the modified code is compiled and burned to the development board and wiring is completed, start debugging.