Skip to content

Commit 11f0a3f

Browse files
committed
boards/esp32p4-tab5: add the ILI9881C and GT911 hardware variant
The Tab5 ships in two hardware variants and the board supported only one of them. The earlier units carry an ILI9881C panel and a GT911 touch controller, the later ones a ST7121/ST7123 panel and a ST7123 touch controller, and the two always come as a pair. On an earlier unit the panel stays lit but black, and the touch bring-up fails with "failed to register ST7123: -5". Add the ILI9881C initialization table, taken from the Espressif BSP, along with the display timings it needs, which differ from the ST7123 ones in the DPI clock (60 MHz instead of 70 MHz) and in every porch. The panel identification lives on command page 1 and is read and logged during bring-up, so the boot log says which panel answered. Add the GT911 to the touch controller choice. These units have a pull-up to 3V3 on the touch interrupt line that keeps the controller from scanning, so the line is driven low instead of being used as an interrupt, and contacts are picked up when the device is read. The controller identification is logged the same way. Split esp32p4_touch.c into one file per controller, which is how the panels are already handled, and document both variants together with the I2C scan that tells which one is fitted. The defaults are unchanged, so an existing configuration still selects the ST7121 panel and the ST7123 touch controller. Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
1 parent 2bd75a4 commit 11f0a3f

10 files changed

Lines changed: 930 additions & 16 deletions

File tree

Documentation/platforms/risc-v/esp32p4/boards/esp32p4-tab5/index.rst

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,45 @@ The Tab5 ships with ESP32-P4 **revision v1.0**. The ``nsh`` defconfig sets
140140
``CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y`` accordingly. A harmless boot warning
141141
is printed because the upstream default targets rev >= 3.0.
142142

143+
Display panel and touch controller
144+
==================================
145+
146+
The Tab5 ships in two hardware variants, and they always come as a pair:
147+
148+
======================= ============================ ==========================
149+
Variant Panel Touch controller
150+
======================= ============================ ==========================
151+
Earlier units ILI9881C GT911 (I2C ``0x14``)
152+
Later units ST7121 / ST7123 ST7123 (I2C ``0x55``)
153+
======================= ============================ ==========================
154+
155+
The panels need different initialization tables and different display
156+
timings, so the wrong selection leaves the panel lit but black, and the wrong
157+
touch selection fails the bring-up with::
158+
159+
ERROR: failed to register ST7123: -5
160+
161+
Identify the board by scanning I2C0 with the ``nsh`` configuration. The
162+
address that answers tells which variant is fitted, and therefore which
163+
panel to select as well::
164+
165+
nsh> i2c dev -b 0 0x03 0x77
166+
167+
Select the panel with ``ESP32P4_TAB5_LCD_ST7121`` (the default),
168+
``ESP32P4_TAB5_LCD_ST7123`` or ``ESP32P4_TAB5_LCD_ILI9881C``, and the touch
169+
controller with ``ESP32P4_TAB5_TOUCH_ST7123`` (the default) or
170+
``ESP32P4_TAB5_TOUCH_GT911``, both under the board menu.
171+
172+
Both panels report their identification at boot, which confirms the
173+
selection. The ILI9881C answers ``98 81`` in the first two ID registers::
174+
175+
ili9881c: panel ID 98 81 5c
176+
gt911: product "911" (39 31 31 00) fw 1060
177+
178+
On the GT911 units the touch interrupt line has a pull-up to 3V3 that keeps
179+
the controller from scanning, so the board drives it low instead of using it
180+
as an interrupt. Contacts are picked up when the device is read.
181+
143182
Configurations
144183
==============
145184

@@ -165,7 +204,6 @@ lvgl_demo
165204
---------
166205

167206
LVGL demo configuration with touch support.
168-
Requires the ST7123 touch controller version.
169207

170208
.. note::
171209
This configuration redirects the console to UART0 instead of the USB Serial/JTAG port
@@ -181,11 +219,12 @@ lvgl_term
181219
---------
182220

183221
LVGL terminal configuration with touch support.
184-
Requires the ST7123 touch controller version.
185222

186223
.. note::
187-
This configuration redirects the console to UART0 instead of the USB Serial/JTAG port
188-
and sets a custom entry point to open LVGL terminal on screen.
224+
This configuration starts the LVGL terminal on the panel as its entry
225+
point, and it runs its own NSH on a pseudo-terminal. The console is kept
226+
on the USB Serial/JTAG port (exposed as ``ttyACM`` on the host), which
227+
carries the system log.
189228

190229
.. code-block:: console
191230

boards/risc-v/esp32p4/esp32p4-tab5/Kconfig

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,53 @@ config ESP32P4_TAB5_LCD_ST7123
9696
---help---
9797
Use the ST7123 initialization table and display timings.
9898

99+
config ESP32P4_TAB5_LCD_ILI9881C
100+
bool "ILI9881C"
101+
---help---
102+
Use the ILI9881C initialization table and display timings. This is
103+
the panel fitted to the earlier Tab5 units, the ones that also carry
104+
the GT911 touch controller.
105+
99106
endchoice
100107

101108
config ESP32P4_TAB5_TOUCHSCREEN
102109
bool "Touch Screen Controller"
103110
default n
104111
select INPUT
105-
select INPUT_ST7123
106112
select ESP32P4_TAB5_HMI_POWER
107113
---help---
108-
Initialize the ST7123 touch screen controller.
114+
Initialize the touch screen controller.
115+
116+
if ESP32P4_TAB5_TOUCHSCREEN
117+
118+
choice
119+
prompt "Touch screen controller"
120+
default ESP32P4_TAB5_TOUCH_ST7123
121+
122+
config ESP32P4_TAB5_TOUCH_ST7123
123+
bool "ST7123"
124+
select INPUT_ST7123
125+
---help---
126+
Sitronix ST7123, fitted to the Tab5 units that ship with the
127+
ST7121/ST7123 panel. Answers on I2C address 0x55.
128+
129+
config ESP32P4_TAB5_TOUCH_GT911
130+
bool "GT911"
131+
select INPUT_GT9XX
132+
---help---
133+
Goodix GT911, fitted to the earlier Tab5 units.
134+
135+
endchoice
136+
137+
config ESP32P4_TAB5_TOUCH_GT911_ADDR
138+
hex "GT911 I2C address"
139+
depends on ESP32P4_TAB5_TOUCH_GT911
140+
default 0x14
141+
---help---
142+
The GT911 latches its I2C address from the INT pin while it is
143+
held in reset: either 0x14 or 0x5d. Scan the bus with
144+
"i2c dev -b 0 0x03 0x77" if unsure.
145+
146+
endif # ESP32P4_TAB5_TOUCHSCREEN
109147

110148
endif # ARCH_BOARD_ESP32P4_TAB5

boards/risc-v/esp32p4/esp32p4-tab5/include/board.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,42 @@
6363
*
6464
* Enable /dev/fb0 with CONFIG_ESP32P4_TAB5_LCD (see configs/lcd), which
6565
* selects power + MIPI host + VIDEO_FB. Select the matching panel with
66-
* CONFIG_ESP32P4_TAB5_LCD_ST7121 or CONFIG_ESP32P4_TAB5_LCD_ST7123.
66+
* CONFIG_ESP32P4_TAB5_LCD_ST7121, CONFIG_ESP32P4_TAB5_LCD_ST7123 or
67+
* CONFIG_ESP32P4_TAB5_LCD_ILI9881C (board version 1, paired with GT911).
6768
*/
6869

6970
#define TAB5_GPIO_LCD_BL_EN 22 /* Backlight enable -> ME2212 boost EN */
7071

7172
#define TAB5_MIPI_DSI_H_RES 720
7273
#define TAB5_MIPI_DSI_V_RES 1280
73-
#define TAB5_MIPI_DSI_DPI_CLK_MHZ 70
74-
#define TAB5_MIPI_DSI_HSYNC_PULSE_WIDTH 2
75-
#define TAB5_MIPI_DSI_HSYNC_BACK_PORCH 40
76-
#define TAB5_MIPI_DSI_HSYNC_FRONT_PORCH 40
7774
#define TAB5_MIPI_DSI_LANES 2
7875

79-
#ifdef CONFIG_ESP32P4_TAB5_LCD_ST7123
76+
#if defined(CONFIG_ESP32P4_TAB5_LCD_ILI9881C)
77+
# define TAB5_LCD_PANEL_NAME "ILI9881C"
78+
# define TAB5_MIPI_DSI_DPI_CLK_MHZ 60
79+
# define TAB5_MIPI_DSI_HSYNC_PULSE_WIDTH 40
80+
# define TAB5_MIPI_DSI_HSYNC_BACK_PORCH 140
81+
# define TAB5_MIPI_DSI_HSYNC_FRONT_PORCH 40
82+
# define TAB5_MIPI_DSI_VSYNC_PULSE_WIDTH 4
83+
# define TAB5_MIPI_DSI_VSYNC_BACK_PORCH 20
84+
# define TAB5_MIPI_DSI_VSYNC_FRONT_PORCH 20
85+
# define TAB5_MIPI_DSI_LANE_BITRATE_MBPS 1000
86+
#elif defined(CONFIG_ESP32P4_TAB5_LCD_ST7123)
8087
# define TAB5_LCD_PANEL_NAME "ST7123"
88+
# define TAB5_MIPI_DSI_DPI_CLK_MHZ 70
89+
# define TAB5_MIPI_DSI_HSYNC_PULSE_WIDTH 2
90+
# define TAB5_MIPI_DSI_HSYNC_BACK_PORCH 40
91+
# define TAB5_MIPI_DSI_HSYNC_FRONT_PORCH 40
8192
# define TAB5_MIPI_DSI_VSYNC_PULSE_WIDTH 2
8293
# define TAB5_MIPI_DSI_VSYNC_BACK_PORCH 8
8394
# define TAB5_MIPI_DSI_VSYNC_FRONT_PORCH 220
8495
# define TAB5_MIPI_DSI_LANE_BITRATE_MBPS 1000
8596
#else
8697
# define TAB5_LCD_PANEL_NAME "ST7121"
98+
# define TAB5_MIPI_DSI_DPI_CLK_MHZ 70
99+
# define TAB5_MIPI_DSI_HSYNC_PULSE_WIDTH 2
100+
# define TAB5_MIPI_DSI_HSYNC_BACK_PORCH 40
101+
# define TAB5_MIPI_DSI_HSYNC_FRONT_PORCH 40
87102
# define TAB5_MIPI_DSI_VSYNC_PULSE_WIDTH 20
88103
# define TAB5_MIPI_DSI_VSYNC_BACK_PORCH 24
89104
# define TAB5_MIPI_DSI_VSYNC_FRONT_PORCH 200

boards/risc-v/esp32p4/esp32p4-tab5/src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ if(CONFIG_ESP32P4_TAB5_LCD)
3636
list(APPEND SRCS esp32p4_lcd_st7121.c)
3737
elseif(CONFIG_ESP32P4_TAB5_LCD_ST7123)
3838
list(APPEND SRCS esp32p4_lcd_st7123.c)
39+
elseif(CONFIG_ESP32P4_TAB5_LCD_ILI9881C)
40+
list(APPEND SRCS esp32p4_lcd_ili9881c.c)
3941
endif()
4042
endif()
4143

4244
if(CONFIG_ESP32P4_TAB5_TOUCHSCREEN)
43-
list(APPEND SRCS esp32p4_touch.c)
45+
if(CONFIG_ESP32P4_TAB5_TOUCH_ST7123)
46+
list(APPEND SRCS esp32p4_touch_st7123.c)
47+
elseif(CONFIG_ESP32P4_TAB5_TOUCH_GT911)
48+
list(APPEND SRCS esp32p4_touch_gt911.c)
49+
endif()
4450
endif()
4551

4652
if(CONFIG_BOARDCTL)

boards/risc-v/esp32p4/esp32p4-tab5/src/Make.defs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@ ifeq ($(CONFIG_ESP32P4_TAB5_LCD),y)
4242
CSRCS += esp32p4_lcd_st7121.c
4343
else ifeq ($(CONFIG_ESP32P4_TAB5_LCD_ST7123),y)
4444
CSRCS += esp32p4_lcd_st7123.c
45+
else ifeq ($(CONFIG_ESP32P4_TAB5_LCD_ILI9881C),y)
46+
CSRCS += esp32p4_lcd_ili9881c.c
4547
endif
4648
endif
4749

4850
ifeq ($(CONFIG_ESP32P4_TAB5_TOUCHSCREEN),y)
49-
CSRCS += esp32p4_touch.c
51+
ifeq ($(CONFIG_ESP32P4_TAB5_TOUCH_ST7123),y)
52+
CSRCS += esp32p4_touch_st7123.c
53+
else ifeq ($(CONFIG_ESP32P4_TAB5_TOUCH_GT911),y)
54+
CSRCS += esp32p4_touch_gt911.c
55+
endif
5056
endif
5157

5258
ifeq ($(CONFIG_BOARDCTL),y)

boards/risc-v/esp32p4/esp32p4-tab5/src/esp32p4_display.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@
5454

5555
#include "esp32p4-tab5.h"
5656

57-
#ifdef CONFIG_ESP32P4_TAB5_LCD_ST7123
57+
#if defined(CONFIG_ESP32P4_TAB5_LCD_ILI9881C)
58+
# include "esp32p4_lcd_ili9881c.h"
59+
# define tab5_panel_initialize tab5_ili9881c_initialize
60+
#elif defined(CONFIG_ESP32P4_TAB5_LCD_ST7123)
5861
# include "esp32p4_lcd_st7123.h"
5962
# define tab5_panel_initialize tab5_st7123_initialize
6063
#else

0 commit comments

Comments
 (0)