docs(ldo): corrected the LDO channel numbers in the programming guide

This commit is contained in:
morris
2026-06-02 11:20:12 +08:00
parent 6495ce4fda
commit 36063fbfb4
9 changed files with 30 additions and 22 deletions
@@ -21,7 +21,6 @@
extern "C" {
#endif
#define LDO_LL_NUM_UNITS 4 // Number of LDO units
#define LDO_LL_ADJUSTABLE_CHAN_MASK 0x0F // all the 4 channels are adjustable by setting "mul" and "dref" registers
#define LDO_LL_RECOMMEND_MAX_VOLTAGE_MV 2700
@@ -51,7 +50,7 @@ typedef enum {
__attribute__((always_inline))
static inline bool ldo_ll_is_valid_ldo_channel(int ldo_chan)
{
return (ldo_chan > 0) && (ldo_chan <= LDO_LL_NUM_UNITS);
return (ldo_chan > 0) && (ldo_chan <= 4);
}
/**
@@ -154,7 +153,7 @@ static inline void ldo_ll_voltage_to_dref_mul(int ldo_unit, int voltage_mv, uint
__attribute__((always_inline))
static inline void ldo_ll_set_owner(int ldo_unit, ldo_ll_unit_owner_t owner)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
/*
* force_tieh_sel:
* - 0: efuse, i.e. by hardware
@@ -185,7 +184,7 @@ static inline void ldo_ll_set_owner(int ldo_unit, ldo_ll_unit_owner_t owner)
__attribute__((always_inline))
static inline void ldo_ll_adjust_voltage(int ldo_unit, uint8_t dref, uint8_t mul, bool use_rail_voltage)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
/**
* tieh:
* - 0: Vref * Mul
@@ -205,7 +204,7 @@ static inline void ldo_ll_adjust_voltage(int ldo_unit, uint8_t dref, uint8_t mul
__attribute__((always_inline))
static inline void ldo_ll_enable(int ldo_unit, bool enable)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
if (ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 100) && (ldo_unit == 0)) {
// If chip_rev >= v1.0, slp_mem_dbias[3] is used to control the volt output of VO1.
PMU.hp_sys[PMU_MODE_HP_ACTIVE].regulator0.xpd_0p1a = (enable ? 8 : 0);
@@ -222,7 +221,7 @@ static inline void ldo_ll_enable(int ldo_unit, bool enable)
__attribute__((always_inline))
static inline void ldo_ll_enable_power_on_delay(int ldo_unit, bool enable)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo.tieh_pos_en = enable;
}
@@ -235,7 +234,7 @@ static inline void ldo_ll_enable_power_on_delay(int ldo_unit, bool enable)
__attribute__((always_inline))
static inline void ldo_ll_enable_power_off_delay(int ldo_unit, bool enable)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo.tieh_neg_en = enable;
}
@@ -249,7 +248,7 @@ static inline void ldo_ll_enable_power_off_delay(int ldo_unit, bool enable)
__attribute__((always_inline))
static inline void ldo_ll_set_delay_target(int ldo_unit, uint8_t target0, uint8_t target1)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
HAL_FORCE_MODIFY_U32_REG_FIELD(PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo, target0, target0);
HAL_FORCE_MODIFY_U32_REG_FIELD(PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo, target1, target1);
}
@@ -263,7 +262,7 @@ static inline void ldo_ll_set_delay_target(int ldo_unit, uint8_t target0, uint8_
__attribute__((always_inline))
static inline void ldo_ll_enable_current_limit(int ldo_unit, bool enable)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo_ana.en_cur_lim = enable;
}
@@ -276,7 +275,7 @@ static inline void ldo_ll_enable_current_limit(int ldo_unit, bool enable)
__attribute__((always_inline))
static inline void ldo_ll_enable_ripple_suppression(int ldo_unit, bool enable)
{
uint8_t index_array[LDO_LL_NUM_UNITS] = {0, 3, 1, 4};
uint8_t index_array[4] = {0, 3, 1, 4};
PMU.ext_ldo[index_array[ldo_unit]].pmu_ext_ldo_ana.en_vdet = enable;
}
@@ -16,7 +16,6 @@
extern "C" {
#endif
#define LDO_LL_NUM_UNITS 1 // Number of LDO units
#define LDO_LL_ADJUSTABLE_CHAN_MASK 0x01 // all the channels are adjustable by setting "mul" and "dref" registers
#define LDO_LL_RECOMMEND_MAX_VOLTAGE_MV 2700
@@ -46,7 +45,7 @@ typedef enum {
__attribute__((always_inline))
static inline bool ldo_ll_is_valid_ldo_channel(int ldo_chan)
{
return (ldo_chan > 0) && (ldo_chan <= LDO_LL_NUM_UNITS);
return (ldo_chan > 0) && (ldo_chan <= 1);
}
/**
@@ -33,8 +33,8 @@ static const uint32_t s_ldo_channel_adjustable_mask = LDO_LL_ADJUSTABLE_CHAN_MAS
// Allocate LDO channel memory statically
// LDO is a fundamental module and should be usable even without a heap allocator
static ldo_regulator_channel_t s_ldo_channels[LDO_LL_NUM_UNITS] = {
[0 ... LDO_LL_NUM_UNITS - 1] = {
static ldo_regulator_channel_t s_ldo_channels[SOC_GP_LDO_NUM_UNITS] = {
[0 ... SOC_GP_LDO_NUM_UNITS - 1] = {
.chan_id = -1,
.voltage_mv = 0,
.ref_cnt = 0,
@@ -178,7 +178,7 @@ esp_err_t esp_ldo_dump(FILE *stream)
char line[100];
fprintf(stream, "ESP LDO Channel State:\n");
fprintf(stream, "%-5s %-5s %-10s %-12s %-5s\n", "Index", "ID", "ref_cnt", "voltage_mv", "adjustable");
for (int i = 0; i < LDO_LL_NUM_UNITS; i++) {
for (int i = 0; i < SOC_GP_LDO_NUM_UNITS; i++) {
char *buf = line;
size_t len = sizeof(line);
memset(line, 0x0, len);
@@ -1083,6 +1083,10 @@ config SOC_LEDC_SUPPORT_ETM
bool
default y
config SOC_GP_LDO_NUM_UNITS
int
default 4
config SOC_MMU_PERIPH_NUM
int
default 2
@@ -112,7 +112,7 @@
#define SOC_SPI_FLASH_SUPPORTED 1
#define SOC_TOUCH_SENSOR_SUPPORTED 1
#define SOC_RNG_SUPPORTED 1
#define SOC_GP_LDO_SUPPORTED 1 // General purpose LDO
#define SOC_GP_LDO_SUPPORTED 1
#define SOC_PPA_SUPPORTED 1
#define SOC_LIGHT_SLEEP_SUPPORTED 1
#define SOC_DEEP_SLEEP_SUPPORTED 1
@@ -395,6 +395,9 @@
#define SOC_LEDC_SUPPORT_SLEEP_RETENTION (1)
#define SOC_LEDC_SUPPORT_ETM (1)
/*-------------------------- LDO CAPS ----------------------------------------*/
#define SOC_GP_LDO_NUM_UNITS 4 // Number of general purpose LDO units
/*-------------------------- MMU CAPS ----------------------------------------*/
#define SOC_MMU_PERIPH_NUM (2U)
#define SOC_MMU_LINEAR_ADDRESS_REGION_NUM (2U)
@@ -739,6 +739,10 @@ config SOC_LEDC_SUPPORT_ETM
bool
default y
config SOC_GP_LDO_NUM_UNITS
int
default 1
config SOC_RMT_MEM_WORDS_PER_CHANNEL
int
default 48
@@ -278,6 +278,9 @@
#define SOC_LEDC_SUPPORT_SLEEP_RETENTION (1)
#define SOC_LEDC_SUPPORT_ETM (1)
/*-------------------------- LDO CAPS ----------------------------------------*/
#define SOC_GP_LDO_NUM_UNITS 1U // Number of general purpose LDO units
/*--------------------------- RMT CAPS ---------------------------------------*/
#define SOC_RMT_MEM_WORDS_PER_CHANNEL 48 /*!< Each channel owns 48 words memory (1 word = 4 Bytes) */
#define SOC_RMT_SUPPORT_RX_PINGPONG 1 /*!< Support Ping-Pong mode on RX path */
@@ -3,12 +3,10 @@ Low Dropout Voltage Regulator (LDO)
:link_to_translation:`zh_CN:[中文]`
{IDF_TARGET_LDO_CHANNELS:default="unknown", esp32p4="4"}
Introduction
------------
The {IDF_TARGET_NAME} chip internally integrates {IDF_TARGET_LDO_CHANNELS} channels of low-dropout voltage regulators (LDOs). Each channel's voltage is programmable. In our hardware reference designs, some of these LDO outputs are typically used to power the internal Flash and PSRAM, while the remaining LDOs can be used to supply external devices.
The {IDF_TARGET_NAME} chip internally integrates {IDF_TARGET_SOC_GP_LDO_NUM_UNITS} channels of low-dropout voltage regulators (LDOs). Each channel's voltage is programmable. In our hardware reference designs, some of these LDO outputs are typically used to power the internal Flash and PSRAM, while the remaining LDOs can be used to supply external devices.
.. note::
@@ -3,12 +3,10 @@
:link_to_translation:`en:[English]`
{IDF_TARGET_LDO_CHANNELS:default="unknown", esp32p4="4"}
简介
----
{IDF_TARGET_NAME} 芯片内部集成了 {IDF_TARGET_LDO_CHANNELS} 路低压差线性稳压器 (LDO),每路的电压都是可编程调节的。在硬件的参考设计中,我们通常会将其中一些的 LDO 输出作为内部 Flash 和 PSRAM 的电源,剩余的一些 LDO 可以用于给外部设备供电。
{IDF_TARGET_NAME} 芯片内部集成了 {IDF_TARGET_SOC_GP_LDO_NUM_UNITS} 路低压差线性稳压器 (LDO),每路的电压都是可编程调节的。在硬件的参考设计中,我们通常会将其中一些的 LDO 输出作为内部 Flash 和 PSRAM 的电源,剩余的一些 LDO 可以用于给外部设备供电。
.. note::