Skip to content

Commit 330abc4

Browse files
JarmouniAcarlescufi
authored andcommitted
boards: shields: st_b_lcd40_dsi1_mb1166: refactoring
Minimize code duplication chances when multiple boards will be added eventually as supporting this shield. Define an alias for board i2c node used by on-shield touch controller. Move H747I-specific LVGL/display optimization options to a dedicated defconfig file. Signed-off-by: Abderrahmane Jarmouni <[email protected]>
1 parent c386c7a commit 330abc4

File tree

8 files changed

+134
-91
lines changed

8 files changed

+134
-91
lines changed

boards/shields/st_b_lcd40_dsi1_mb1166/Kconfig.defconfig

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,13 @@
44

55
if SHIELD_ST_B_LCD40_DSI1_MB1166 || SHIELD_ST_B_LCD40_DSI1_MB1166_A09
66

7-
# Double frame buffer maintained by lvgl.
8-
if LVGL
7+
orsource "boards/*.defconfig"
98

10-
config STM32_LTDC_FB_NUM
11-
default 0
9+
if LVGL
1210

1311
config INPUT
1412
default y
1513

16-
config LV_Z_VDB_SIZE
17-
default 100
18-
19-
config LV_Z_DOUBLE_VDB
20-
default y
21-
22-
config LV_Z_VBD_CUSTOM_SECTION
23-
default y
24-
25-
config LV_Z_FULL_REFRESH
26-
default y
27-
2814
config LV_Z_BITS_PER_PIXEL
2915
default 32
3016

boards/shields/st_b_lcd40_dsi1_mb1166/boards/st_b_lcd40_dsi1_mb1166/stm32h747i_disco_stm32h747xx_m7.overlay

Lines changed: 0 additions & 21 deletions
This file was deleted.

boards/shields/st_b_lcd40_dsi1_mb1166/boards/st_b_lcd40_dsi1_mb1166_a09/stm32h747i_disco_stm32h747xx_m7.overlay

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,9 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <zephyr/dt-bindings/display/panel.h>
8-
9-
&mipi_dsi {
7+
&zephyr_mipi_dsi {
8+
status = "okay";
109
loosely-packed;
1110
largest-packet-size = <64>;
1211
bta-ack-disable;
1312
};
14-
15-
&ltdc {
16-
/* frida, nt35510 */
17-
display-timings {
18-
compatible = "zephyr,panel-timing";
19-
hsync-active = <0>;
20-
vsync-active = <0>;
21-
de-active = <0>;
22-
pixelclk-active = <0>;
23-
hsync-len = <2>;
24-
vsync-len = <120>;
25-
hback-porch = <34>;
26-
vback-porch = <150>;
27-
hfront-porch = <34>;
28-
vfront-porch = <150>;
29-
};
30-
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Linumiz
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_STM32H747I_DISCO_STM32H747XX_M7
5+
if LVGL
6+
7+
# Double frame buffer maintained by lvgl.
8+
config STM32_LTDC_FB_NUM
9+
default 0
10+
11+
config LV_Z_DOUBLE_VDB
12+
default y
13+
14+
config LV_Z_VBD_CUSTOM_SECTION
15+
default y
16+
17+
config LV_Z_FULL_REFRESH
18+
default y
19+
20+
endif #LVGL
21+
endif # BOARD_STM32H747I_DISCO_STM32H747XX_M7

boards/shields/st_b_lcd40_dsi1_mb1166/boards/stm32h747i_disco_stm32h747xx_m7.overlay

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,17 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <zephyr/dt-bindings/display/panel.h>
8-
9-
/ {
10-
lvgl_pointer {
11-
compatible = "zephyr,lvgl-pointer-input";
12-
input = <&ft5336>;
13-
invert-y;
14-
};
15-
16-
chosen {
17-
zephyr,display = &ltdc;
18-
};
19-
};
20-
217
&sdram2 {
22-
/* Frame buffer memory cache will cause screen flickering. */
8+
/* Frame buffer memory when cached causes screen flickering. */
239
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>;
2410
};
2511

26-
&ltdc {
12+
&zephyr_lcd_controller {
2713
status = "okay";
2814
ext-sdram = <&sdram2>;
29-
width = <800>;
30-
height = <480>;
3115
def-back-color-red = <0>;
3216
def-back-color-green = <0>;
3317
def-back-color-blue = <0>;
34-
pixel-format = <PANEL_PIXEL_FORMAT_RGB_888>;
3518
};
3619

3720
/* ltdc uses pll3_r as pixel clock */
@@ -45,7 +28,7 @@
4528
div-r = <24>; /* 27.5 MHz */
4629
};
4730

48-
&mipi_dsi {
31+
&zephyr_mipi_dsi {
4932
status = "okay";
5033

5134
/* DSI HOST dedicated PLL
@@ -61,15 +44,3 @@
6144
hs-active-high;
6245
de-active-high;
6346
};
64-
65-
&i2c4 {
66-
pinctrl-0 = <&i2c4_scl_pd12 &i2c4_sda_pd13>;
67-
pinctrl-names = "default";
68-
clock-frequency = <I2C_BITRATE_FAST>;
69-
status = "okay";
70-
71-
ft5336: ft5336@38 {
72-
compatible = "focaltech,ft5336";
73-
reg = <0x38>;
74-
};
75-
};

boards/shields/st_b_lcd40_dsi1_mb1166/st_b_lcd40_dsi1_mb1166.overlay

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
&mipi_dsi {
7+
#include <zephyr/dt-bindings/display/panel.h>
8+
9+
/ {
10+
lvgl_pointer {
11+
compatible = "zephyr,lvgl-pointer-input";
12+
input = <&ft5336>;
13+
invert-y;
14+
};
15+
16+
chosen {
17+
zephyr,display = &zephyr_lcd_controller;
18+
};
19+
};
20+
21+
&zephyr_mipi_dsi {
22+
status = "okay";
823
otm8009a: otm8009a@0 {
924
status = "okay";
1025
compatible = "orisetech,otm8009a";
@@ -18,3 +33,33 @@
1833
rotation = <90>;
1934
};
2035
};
36+
37+
&zephyr_lcd_controller {
38+
status = "okay";
39+
width = <800>;
40+
height = <480>;
41+
pixel-format = <PANEL_PIXEL_FORMAT_RGB_888>;
42+
/* orisetech, otm8009a */
43+
display-timings {
44+
compatible = "zephyr,panel-timing";
45+
hsync-active = <0>;
46+
vsync-active = <0>;
47+
de-active = <0>;
48+
pixelclk-active = <0>;
49+
hsync-len = <2>;
50+
vsync-len = <1>;
51+
hback-porch = <34>;
52+
vback-porch = <15>;
53+
hfront-porch = <34>;
54+
vfront-porch = <16>;
55+
};
56+
};
57+
58+
&qsh_030_i2c {
59+
ft5336: ft5336@38 {
60+
compatible = "focaltech,ft5336";
61+
reg = <0x38>;
62+
int-gpios = <&dsi_lcd_qsh_030 4 0>;
63+
status = "okay";
64+
};
65+
};

boards/shields/st_b_lcd40_dsi1_mb1166/st_b_lcd40_dsi1_mb1166_a09.overlay

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
&mipi_dsi {
7+
#include <zephyr/dt-bindings/display/panel.h>
8+
9+
/ {
10+
lvgl_pointer {
11+
compatible = "zephyr,lvgl-pointer-input";
12+
input = <&ft5336>;
13+
invert-y;
14+
};
15+
16+
chosen {
17+
zephyr,display = &zephyr_lcd_controller;
18+
};
19+
};
20+
21+
&zephyr_mipi_dsi {
22+
status = "okay";
823
nt35510: nt35510@0 {
924
status = "okay";
1025
compatible = "frida,nt35510";
@@ -18,3 +33,33 @@
1833
rotation = <90>;
1934
};
2035
};
36+
37+
&zephyr_lcd_controller {
38+
status = "okay";
39+
width = <800>;
40+
height = <480>;
41+
pixel-format = <PANEL_PIXEL_FORMAT_RGB_888>;
42+
/* frida, nt35510 */
43+
display-timings {
44+
compatible = "zephyr,panel-timing";
45+
hsync-active = <0>;
46+
vsync-active = <0>;
47+
de-active = <0>;
48+
pixelclk-active = <0>;
49+
hsync-len = <2>;
50+
vsync-len = <120>;
51+
hback-porch = <34>;
52+
vback-porch = <150>;
53+
hfront-porch = <34>;
54+
vfront-porch = <150>;
55+
};
56+
};
57+
58+
&qsh_030_i2c {
59+
ft5336: ft5336@38 {
60+
compatible = "focaltech,ft5336";
61+
reg = <0x38>;
62+
int-gpios = <&dsi_lcd_qsh_030 4 0>;
63+
status = "okay";
64+
};
65+
};

boards/st/stm32h747i_disco/stm32h747i_disco_stm32h747xx_m7.dts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,17 @@ zephyr_udc0: &usbotg_hs {
278278
};
279279

280280
arduino_spi: &spi5 {};
281+
282+
/* alias used by display shields with touch control */
283+
qsh_030_i2c: &i2c4 {
284+
pinctrl-0 = <&i2c4_scl_pd12 &i2c4_sda_pd13>;
285+
pinctrl-names = "default";
286+
clock-frequency = <I2C_BITRATE_FAST>;
287+
status = "okay";
288+
};
289+
290+
/* alias used by display shields */
291+
zephyr_mipi_dsi: &mipi_dsi {};
292+
293+
/* alias used by LCD display shields */
294+
zephyr_lcd_controller: &ltdc {};

0 commit comments

Comments
 (0)