feat(efuse): Adds calibration efuses for ESP32-P4 ECO5

This commit is contained in:
Konstantin Kondrashov
2025-10-15 15:36:56 +03:00
parent 969d017c56
commit 6f9e137336
7 changed files with 1927 additions and 140 deletions
@@ -142,29 +142,17 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_controller_st
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_active_hp_dbias(void)
{
#ifdef EFUSE_ACTIVE_HP_DBIAS
return EFUSE.rd_mac_sys_4.active_hp_dbias;
#else
return 0;
#endif
}
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_active_lp_dbias(void)
{
#ifdef EFUSE_ACTIVE_LP_DBIAS
return EFUSE.rd_mac_sys_4.active_lp_dbias;
#else
return 0;
#endif
}
__attribute__((always_inline)) static inline int32_t efuse_ll_get_dbias_vol_gap(void)
{
#ifdef EFUSE_LP_DCDC_DBIAS_VOL_GAP
return EFUSE.rd_mac_sys_5.lp_dcdc_dbias_vol_gap;
#else
return 0;
#endif
}
/******************* eFuse control functions *************************/
+3 -8
View File
@@ -69,16 +69,14 @@ static inline bool ldo_ll_is_valid_ldo_channel(int ldo_chan)
__attribute__((always_inline))
static inline void ldo_ll_voltage_to_dref_mul(int ldo_unit, int voltage_mv, uint8_t *dref, uint8_t *mul, bool *use_rail_voltage)
{
uint8_t efuse_k = 0;
uint8_t efuse_vos = 0;
uint8_t efuse_c = 0;
// to avoid using FPU, enlarge the constants by 1000 as fixed point
int K_1000 = 1000;
int Vos_1000 = 0;
int C_1000 = 1000;
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) < 300
uint8_t efuse_k = 0;
uint8_t efuse_vos = 0;
uint8_t efuse_c = 0;
if (efuse_hal_blk_version() >= 1) {
// load the calibration values from the eFuse
if (ldo_unit == 2) {
@@ -102,7 +100,6 @@ static inline void ldo_ll_voltage_to_dref_mul(int ldo_unit, int voltage_mv, uint
C_1000 = efuse_c & 0x20 ? -1 * (efuse_c & 0x1F) + 990 : efuse_c + 990;
}
}
#endif
// iterate all the possible dref and mul values to find the best match
int min_voltage_diff = 400000000;
@@ -124,7 +121,6 @@ static inline void ldo_ll_voltage_to_dref_mul(int ldo_unit, int voltage_mv, uint
}
}
#if HAL_CONFIG(CHIP_SUPPORT_MIN_REV) < 300
if (efuse_hal_blk_version() >= 1) {
// For unit0 and unit1, the mul and dref value are calibrated and saved in the efuse, load them when available
if (ldo_unit == 0 && voltage_mv == 1800) {
@@ -140,7 +136,6 @@ static inline void ldo_ll_voltage_to_dref_mul(int ldo_unit, int voltage_mv, uint
}
}
}
#endif
*dref = matched_dref;
*mul = matched_mul;