From 56b40a028d35ad7ee0bbd303aafe96f32da6db96 Mon Sep 17 00:00:00 2001 From: morris Date: Mon, 25 Mar 2024 18:27:17 +0800 Subject: [PATCH] change(mipi): use public ldo driver for powering dphy --- .../lcd/mipi_dsi/main/idf_component.yml | 2 +- .../mipi_dsi/main/mipi_dsi_lcd_example_main.c | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/examples/peripherals/lcd/mipi_dsi/main/idf_component.yml b/examples/peripherals/lcd/mipi_dsi/main/idf_component.yml index 8e0bcd79b5..4cf2c942b0 100644 --- a/examples/peripherals/lcd/mipi_dsi/main/idf_component.yml +++ b/examples/peripherals/lcd/mipi_dsi/main/idf_component.yml @@ -1,3 +1,3 @@ dependencies: - lvgl/lvgl: "~9.0.0" + lvgl/lvgl: "^9.0.0" esp_lcd_ili9881c: "*" diff --git a/examples/peripherals/lcd/mipi_dsi/main/mipi_dsi_lcd_example_main.c b/examples/peripherals/lcd/mipi_dsi/main/mipi_dsi_lcd_example_main.c index 48910abb2a..292266adb7 100644 --- a/examples/peripherals/lcd/mipi_dsi/main/mipi_dsi_lcd_example_main.c +++ b/examples/peripherals/lcd/mipi_dsi/main/mipi_dsi_lcd_example_main.c @@ -9,11 +9,11 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" -#include "esp_private/esp_ldo.h" #include "esp_timer.h" #include "esp_lcd_panel_ops.h" #include "esp_lcd_mipi_dsi.h" #include "esp_lcd_ili9881c.h" +#include "esp_ldo_regulator.h" #include "driver/gpio.h" #include "esp_err.h" #include "esp_log.h" @@ -43,8 +43,8 @@ static const char *TAG = "example"; //////////////////// Please update the following configuration according to your Board Design ////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// The "VDD_MIPI_DPHY" should be supplied with 2.5V, it can source from the integrated LDO unit or from external LDO chip -#define EXAMPLE_MIPI_DSI_PHY_PWR_LDO_UNIT 3 // LDO_VO3 is connected to VDD_MIPI_DPHY +// The "VDD_MIPI_DPHY" should be supplied with 2.5V, it can source from the internal LDO regulator or from external LDO chip +#define EXAMPLE_MIPI_DSI_PHY_PWR_LDO_CHAN 3 // LDO_VO3 is connected to VDD_MIPI_DPHY #define EXAMPLE_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV 2500 #define EXAMPLE_LCD_BK_LIGHT_ON_LEVEL 1 #define EXAMPLE_LCD_BK_LIGHT_OFF_LEVEL !EXAMPLE_LCD_BK_LIGHT_ON_LEVEL @@ -126,17 +126,13 @@ static bool example_notify_lvgl_flush_ready(esp_lcd_panel_handle_t panel, esp_lc static void example_bsp_enable_dsi_phy_power(void) { // Turn on the power for MIPI DSI PHY, so it can go from "No Power" state to "Shutdown" state - esp_ldo_unit_handle_t phy_pwr_unit = NULL; -#if EXAMPLE_MIPI_DSI_PHY_PWR_LDO_UNIT > 0 - esp_ldo_unit_init_cfg_t ldo_cfg = { - .unit_id = EXAMPLE_MIPI_DSI_PHY_PWR_LDO_UNIT, - .cfg = { - .voltage_mv = EXAMPLE_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV, - }, + esp_ldo_channel_handle_t ldo_mipi_phy = NULL; +#ifdef EXAMPLE_MIPI_DSI_PHY_PWR_LDO_CHAN + esp_ldo_channel_config_t ldo_mipi_phy_config = { + .chan_id = EXAMPLE_MIPI_DSI_PHY_PWR_LDO_CHAN, + .voltage_mv = EXAMPLE_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV, }; - ESP_ERROR_CHECK(esp_ldo_init_unit(&ldo_cfg, &phy_pwr_unit)); - ESP_ERROR_CHECK(esp_ldo_enable_unit(phy_pwr_unit)); - + ESP_ERROR_CHECK(esp_ldo_acquire_channel(&ldo_mipi_phy_config, &ldo_mipi_phy)); ESP_LOGI(TAG, "MIPI DSI PHY Powered on"); #endif }