Skip to content

Commit 13eff74

Browse files
committed
lt8912b: HDMI support.
1 parent 977d561 commit 13eff74

File tree

13 files changed

+1529
-13
lines changed

13 files changed

+1529
-13
lines changed

LCD.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ The list of available LCD displays and links to LCD driver component and touch d
2020
| <img src="docu/pics/st7796.jpg" width="150"> | Parallel/SPI | ST7796 | [Component Manager](https://components.espressif.com/component/espressif/esp_lcd_st7796) | - | - | |
2121
| <img src="docu/pics/esp32-s3-lcd-ev-board_480x480.png" width="150"> | [ESP32-S3-LCD-EV-Board](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html) | GC9503 | [Component Manager](https://components.espressif.com/component/espressif/esp_lcd_gc9503) | FT5X06 | [Component Manager](https://components.espressif.com/component/espressif/esp_lcd_touch_ft5x06) | |
2222
| <img src="docu/pics/esp32-s3-lcd-ev-board_800x480.png" width="150"> | [ESP32-S3-LCD-EV-Board-2](https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s3/esp32-s3-lcd-ev-board/user_guide.html) | ST7262E43 | **N/A** | GT1151 | [Component Manager](https://components.espressif.com/component/espressif/esp_lcd_touch_gt1151) | |
23+
| <img src="docu/pics/Lontium.webp" width="150"> | HDMI | LT8912B | [Component Manager](https://components.espressif.com/component/espressif/esp_lcd_lt8912b) | - | - | |

bsp/esp32_p4_function_ev_board/Kconfig

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
menu "Board Support Package(ESP32-P4)"
1+
menu "Board Support Package (ESP32-P4)"
22

33
config BSP_ERROR_CHECK
44
bool "Enable error check in BSP"
@@ -131,7 +131,26 @@ menu "Board Support Package(ESP32-P4)"
131131
bool "LCD 7-inch 1024x600 - ek79007"
132132
config BSP_LCD_TYPE_1280_800
133133
bool "LCD 1280x800 - ili9881c"
134-
endchoice
134+
config BSP_LCD_TYPE_HDMI
135+
bool "HDMI - lt8912b"
136+
endchoice
137+
138+
choice BSP_LCD_HDMI_RESOLUTION
139+
depends on BSP_LCD_TYPE_HDMI
140+
prompt "Select HDMI resolution"
141+
default BSP_LCD_HDMI_1280x720_60HZ
142+
help
143+
Select the HDMI resolution.
144+
145+
config BSP_LCD_HDMI_800x600_60HZ
146+
bool "800x600@60HZ"
147+
config BSP_LCD_HDMI_1280x720_60HZ
148+
bool "1280x720@60HZ"
149+
config BSP_LCD_HDMI_1280x800_60HZ
150+
bool "1280x800@60HZ"
151+
config BSP_LCD_HDMI_1920x1080_30HZ
152+
bool "1920x1080@30HZ"
153+
endchoice
135154

136155
endmenu
137156

bsp/esp32_p4_function_ev_board/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,24 @@ ESP32-P4 Function EV Board is internal Espressif board for testing features on E
1515
Configuration in `menuconfig`.
1616

1717
Selection LCD display `Board Support Package(ESP32-P4) --> Display --> Select LCD type`
18-
- LCD 7-inch 1280x800 - ili9881c (default)
18+
- LCD 1280x800 - ili9881c (default)
1919
- LCD 1024x600 - ek79007
20+
- HDMI - lt8912b
21+
- 800x600@60HZ
22+
- 1280x720@60HZ
23+
- 1280x800@60HZ
24+
- 1920x1080@30HZ
2025

2126
Selection color format `Board Support Package(ESP32-P4) --> Display --> Select LCD color format`
2227
- RGB565 (default)
2328
- RGB888
2429

30+
## HDMI Support
31+
32+
This BSP supports HDMI converter Lontium LT8912B. Follow these rules for using it with HDMI:
33+
- Use ESP-IDF 5.4 or older (from commit [93fdbf2](https://github.com/espressif/esp-idf/commit/93fdbf25b3ea7e44d1f519ed61050847dcc8a076))
34+
- Only RGB888 is supported with HDMI
35+
- Use MIPI-DSI to HDMI converter Lontium LT8912B
2536

2637
<!-- Autogenerated start: Dependencies -->
2738
### Capabilities and dependencies

bsp/esp32_p4_function_ev_board/esp32_p4_function_ev_board.c

Lines changed: 110 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#if CONFIG_BSP_LCD_TYPE_1024_600
2323
#include "esp_lcd_ek79007.h"
24+
#elif CONFIG_BSP_LCD_TYPE_HDMI
25+
#include "esp_lcd_lt8912b.h"
2426
#else
2527
#include "esp_lcd_ili9881c.h"
2628
#endif
@@ -402,12 +404,14 @@ esp_err_t bsp_display_new(const bsp_display_config_t *config, esp_lcd_panel_hand
402404
esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_lcd_handles_t *ret_handles)
403405
{
404406
esp_err_t ret = ESP_OK;
407+
esp_lcd_panel_io_handle_t io = NULL;
408+
esp_lcd_panel_handle_t disp_panel = NULL;
405409

406410
ESP_RETURN_ON_ERROR(bsp_display_brightness_init(), TAG, "Brightness init failed");
407411
ESP_RETURN_ON_ERROR(bsp_enable_dsi_phy_power(), TAG, "DSI PHY power failed");
408412

409413
/* create MIPI DSI bus first, it will initialize the DSI PHY as well */
410-
esp_lcd_dsi_bus_handle_t mipi_dsi_bus;
414+
esp_lcd_dsi_bus_handle_t mipi_dsi_bus = NULL;
411415
esp_lcd_dsi_bus_config_t bus_config = {
412416
.bus_id = 0,
413417
.num_data_lanes = BSP_LCD_MIPI_DSI_LANE_NUM,
@@ -416,17 +420,17 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
416420
};
417421
ESP_RETURN_ON_ERROR(esp_lcd_new_dsi_bus(&bus_config, &mipi_dsi_bus), TAG, "New DSI bus init failed");
418422

423+
#if !CONFIG_BSP_LCD_TYPE_HDMI
419424
ESP_LOGI(TAG, "Install MIPI DSI LCD control panel");
420425
// we use DBI interface to send LCD commands and parameters
421-
esp_lcd_panel_io_handle_t io;
422426
esp_lcd_dbi_io_config_t dbi_config = {
423427
.virtual_channel = 0,
424-
.lcd_cmd_bits = 8, // according to the LCD ILI9881C spec
425-
.lcd_param_bits = 8, // according to the LCD ILI9881C spec
428+
.lcd_cmd_bits = 8, // according to the LCD spec
429+
.lcd_param_bits = 8, // according to the LCD spec
426430
};
427431
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_io_dbi(mipi_dsi_bus, &dbi_config, &io), err, TAG, "New panel IO failed");
432+
#endif
428433

429-
esp_lcd_panel_handle_t disp_panel = NULL;
430434
#if CONFIG_BSP_LCD_TYPE_1024_600
431435
// create EK79007 control panel
432436
ESP_LOGI(TAG, "Install EK79007 LCD control panel");
@@ -453,7 +457,7 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
453457
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_ek79007(io, &lcd_dev_config, &disp_panel), err, TAG, "New LCD panel EK79007 failed");
454458
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
455459
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
456-
#else
460+
#elif CONFIG_BSP_LCD_TYPE_1280_800
457461
// create ILI9881C control panel
458462
ESP_LOGI(TAG, "Install ILI9881C LCD control panel");
459463
#if CONFIG_BSP_LCD_COLOR_FORMAT_RGB888
@@ -480,15 +484,100 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
480484
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
481485
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
482486
ESP_GOTO_ON_ERROR(esp_lcd_panel_disp_on_off(disp_panel, true), err, TAG, "LCD panel ON failed");
487+
488+
#elif CONFIG_BSP_LCD_TYPE_HDMI
489+
490+
#if !CONFIG_BSP_LCD_COLOR_FORMAT_RGB888
491+
#error The color format must be RGB888 in HDMI display type!
492+
#endif
493+
ESP_LOGI(TAG, "Install MIPI DSI HDMI control panel");
494+
ESP_RETURN_ON_ERROR(bsp_i2c_init(), TAG, "I2C init failed");
495+
496+
/* Main IO */
497+
esp_lcd_panel_io_i2c_config_t io_config = LT8912B_IO_CFG(CONFIG_BSP_I2C_CLK_SPEED_HZ, LT8912B_IO_I2C_MAIN_ADDRESS);
498+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_handle, &io_config, &io));
499+
500+
/* CEC DSI IO */
501+
esp_lcd_panel_io_handle_t io_cec_dsi = NULL;
502+
esp_lcd_panel_io_i2c_config_t io_config_cec = LT8912B_IO_CFG(CONFIG_BSP_I2C_CLK_SPEED_HZ, LT8912B_IO_I2C_CEC_ADDRESS);
503+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_handle, &io_config_cec, &io_cec_dsi));
504+
505+
/* AVI IO */
506+
esp_lcd_panel_io_handle_t io_avi = NULL;
507+
esp_lcd_panel_io_i2c_config_t io_config_avi = LT8912B_IO_CFG(CONFIG_BSP_I2C_CLK_SPEED_HZ, LT8912B_IO_I2C_AVI_ADDRESS);
508+
ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_handle, &io_config_avi, &io_avi));
509+
510+
/* DPI config */
511+
#if CONFIG_BSP_LCD_HDMI_800x600_60HZ
512+
ESP_LOGI(TAG, "HDMI configuration for 800x600@60HZ");
513+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_800x600_PANEL_60HZ_DPI_CONFIG();
514+
#elif CONFIG_BSP_LCD_HDMI_1024x768_60HZ
515+
ESP_LOGI(TAG, "HDMI configuration for 1024x768@60HZ");
516+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_1024x768_PANEL_60HZ_DPI_CONFIG();
517+
#elif CONFIG_BSP_LCD_HDMI_1280x720_60HZ
518+
ESP_LOGI(TAG, "HDMI configuration for 1280x720@60HZ");
519+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_1280x720_PANEL_60HZ_DPI_CONFIG();
520+
#elif CONFIG_BSP_LCD_HDMI_1280x800_60HZ
521+
ESP_LOGI(TAG, "HDMI configuration for 1280x800@60HZ");
522+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_1280x800_PANEL_60HZ_DPI_CONFIG();
523+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_30HZ
524+
ESP_LOGI(TAG, "HDMI configuration for 1920x1080@30HZ");
525+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_1920x1080_PANEL_30HZ_DPI_CONFIG();
526+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_60HZ
527+
ESP_LOGI(TAG, "HDMI configuration for 1920x1080@60HZ");
528+
/* This setting is not working yet, it is only for developing and testing */
529+
esp_lcd_dpi_panel_config_t dpi_config = LT8912B_1920x1080_PANEL_60HZ_DPI_CONFIG();
530+
#else
531+
#error Unsupported display type
483532
#endif
533+
dpi_config.num_fbs = CONFIG_BSP_LCD_DPI_BUFFER_NUMS;
534+
lt8912b_vendor_config_t vendor_config = {
535+
#if CONFIG_BSP_LCD_HDMI_800x600_60HZ
536+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_800x600_60Hz(),
537+
#elif CONFIG_BSP_LCD_HDMI_1024x768_60HZ
538+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_1024x768_60Hz(),
539+
#elif CONFIG_BSP_LCD_HDMI_1280x720_60HZ
540+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_1280x720_60Hz(),
541+
#elif CONFIG_BSP_LCD_HDMI_1280x800_60HZ
542+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_1280x800_60Hz(),
543+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_30HZ
544+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_1920x1080_30Hz(),
545+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_60HZ
546+
/* This setting is not working yet, it is only for developing and testing */
547+
.video_timing = ESP_LCD_LT8912B_VIDEO_TIMING_1920x1080_60Hz(),
548+
#else
549+
#error Unsupported display type
550+
#endif
551+
.mipi_config = {
552+
.dsi_bus = mipi_dsi_bus,
553+
.dpi_config = &dpi_config,
554+
.lane_num = BSP_LCD_MIPI_DSI_LANE_NUM,
555+
},
556+
};
557+
const esp_lcd_panel_dev_config_t panel_config = {
558+
.bits_per_pixel = 24,
559+
.rgb_ele_order = BSP_LCD_COLOR_SPACE,
560+
.reset_gpio_num = BSP_LCD_RST,
561+
.vendor_config = &vendor_config,
562+
};
563+
const esp_lcd_panel_lt8912b_io_t io_all = {
564+
.main = io,
565+
.cec_dsi = io_cec_dsi,
566+
.avi = io_avi,
567+
};
568+
ESP_ERROR_CHECK(esp_lcd_new_panel_lt8912b(&io_all, &panel_config, &disp_panel));
569+
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
570+
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
571+
572+
#endif //CONFIG_BSP_LCD_TYPE_
484573

485574
/* Return all handles */
486575
ret_handles->io = io;
487576
ret_handles->mipi_dsi_bus = mipi_dsi_bus;
488577
ret_handles->panel = disp_panel;
489578
ret_handles->control = NULL;
490579

491-
ESP_LOGI(TAG, "Display initialized");
580+
ESP_LOGI(TAG, "Display initialized with resolution %dx%d", BSP_LCD_H_RES, BSP_LCD_V_RES);
492581

493582
return ret;
494583

@@ -499,12 +588,21 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
499588
if (io) {
500589
esp_lcd_panel_io_del(io);
501590
}
591+
#if CONFIG_BSP_LCD_TYPE_HDMI
592+
if (io_cec_dsi) {
593+
esp_lcd_panel_io_del(io_cec_dsi);
594+
}
595+
if (io_avi) {
596+
esp_lcd_panel_io_del(io_avi);
597+
}
598+
#endif
502599
if (mipi_dsi_bus) {
503600
esp_lcd_del_dsi_bus(mipi_dsi_bus);
504601
}
505602
return ret;
506603
}
507604

605+
#if !CONFIG_BSP_LCD_TYPE_HDMI
508606
esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t *ret_touch)
509607
{
510608
/* Initilize I2C */
@@ -537,6 +635,7 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t
537635
ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, "");
538636
return esp_lcd_touch_new_i2c_gt911(tp_io_handle, &tp_cfg, ret_touch);
539637
}
638+
#endif //!CONFIG_BSP_LCD_TYPE_HDMI
540639

541640
#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
542641
static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
@@ -601,6 +700,7 @@ static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
601700
return lvgl_port_add_disp_dsi(&disp_cfg, &dpi_cfg);
602701
}
603702

703+
#if !CONFIG_BSP_LCD_TYPE_HDMI
604704
static lv_indev_t *bsp_display_indev_init(lv_display_t *disp)
605705
{
606706
esp_lcd_touch_handle_t tp;
@@ -615,6 +715,7 @@ static lv_indev_t *bsp_display_indev_init(lv_display_t *disp)
615715

616716
return lvgl_port_add_touch(&touch_cfg);
617717
}
718+
#endif //!CONFIG_BSP_LCD_TYPE_HDMI
618719

619720
lv_display_t *bsp_display_start(void)
620721
{
@@ -645,9 +746,9 @@ lv_display_t *bsp_display_start_with_config(const bsp_display_cfg_t *cfg)
645746
BSP_ERROR_CHECK_RETURN_NULL(bsp_display_brightness_init());
646747

647748
BSP_NULL_CHECK(disp = bsp_display_lcd_init(cfg), NULL);
648-
749+
#if !CONFIG_BSP_LCD_TYPE_HDMI
649750
BSP_NULL_CHECK(disp_indev = bsp_display_indev_init(disp), NULL);
650-
751+
#endif
651752
return disp;
652753
}
653754

bsp/esp32_p4_function_ev_board/idf_component.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "4.1.1"
1+
version: "4.2.0"
22
description: Board Support Package (BSP) for ESP32-P4 Function EV Board (preview)
33
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_p4_function_ev_board
44

@@ -23,3 +23,7 @@ dependencies:
2323
esp_codec_dev:
2424
version: "1.2.*"
2525
public: true
26+
27+
espressif/esp_lcd_lt8912b:
28+
version: ">=0.1.0,<1.0.0"
29+
override_path: "../../components/lcd/esp_lcd_lt8912b"

bsp/esp32_p4_function_ev_board/include/bsp/display.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,37 @@
4747
#define BSP_LCD_MIPI_DSI_LCD_VSYNC (635)
4848
#define BSP_LCD_MIPI_DSI_LCD_VBP (23)
4949
#define BSP_LCD_MIPI_DSI_LCD_VFP (12)
50+
51+
#elif CONFIG_BSP_LCD_TYPE_HDMI
52+
#if CONFIG_BSP_LCD_HDMI_800x600_60HZ
53+
/* LCD display definition 800x600 60Hz */
54+
#define BSP_LCD_H_RES (800)
55+
#define BSP_LCD_V_RES (600)
56+
#elif CONFIG_BSP_LCD_HDMI_1024x768_60HZ
57+
/* LCD display definition 1024x768 60Hz */
58+
#define BSP_LCD_H_RES (1024)
59+
#define BSP_LCD_V_RES (768)
60+
#elif CONFIG_BSP_LCD_HDMI_1280x720_60HZ
61+
/* LCD display definition 1280x720 60Hz */
62+
#define BSP_LCD_H_RES (1280)
63+
#define BSP_LCD_V_RES (720)
64+
#elif CONFIG_BSP_LCD_HDMI_1280x800_60HZ
65+
/* LCD display definition 1280x800 60Hz */
66+
#define BSP_LCD_H_RES (1280)
67+
#define BSP_LCD_V_RES (800)
68+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_30HZ
69+
/* LCD display definition 1920x1080 30Hz */
70+
#define BSP_LCD_H_RES (1920)
71+
#define BSP_LCD_V_RES (1080)
72+
#elif CONFIG_BSP_LCD_HDMI_1920x1080_60HZ
73+
/* LCD display definition 1920x1080 60Hz */
74+
/* This setting is not working yet, it is only for developing and testing */
75+
#define BSP_LCD_H_RES (1920)
76+
#define BSP_LCD_V_RES (1080)
77+
#else
78+
#error Unsupported display type
79+
#endif
80+
5081
#else
5182
/* LCD display definition 1280x800 */
5283
#define BSP_LCD_H_RES (800)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
idf_component_register(SRCS "esp_lcd_lt8912b.c"
2+
INCLUDE_DIRS "include"
3+
REQUIRES "esp_lcd"
4+
PRIV_REQUIRES "esp_driver_gpio")
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ESP LCD LT8912B
2+
3+
[![Component Registry](https://components.espressif.com/components/espressif/esp_lcd_lt8912b/badge.svg)](https://components.espressif.com/components/espressif/esp_lcd_lt8912b)
4+
5+
Implementation of the LT8912B MIPI-DSI to HDMI bridge with esp_lcd component.
6+
7+
| LCD controller | Communication interface | Component name | Link to datasheet |
8+
| :------------: | :---------------------: | :------------: | :---------------: |
9+
| LT8912B | I2C | esp_lcd_lt8912b | [Specification](http://www.lontiumsemi.com/UploadFiles/2022-03/LT8912B_Brief_R1.3.pdf) |
10+
11+
> [!WARNING]
12+
> This controller suports only RGB888 color mode.
13+
14+
## Add to project
15+
16+
Packages from this repository are uploaded to [Espressif's component service](https://components.espressif.com/).
17+
You can add them to your project via `idf.py add-dependency`, e.g.
18+
19+
```text
20+
idf.py add-dependency esp_lcd_lt8912b
21+
```
22+
23+
Alternatively, you can create `idf_component.yml`. More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).
24+

0 commit comments

Comments
 (0)