fix(bod): Remove config for bod on p4 v0.x

This commit is contained in:
C.S.M 2024-11-01 11:08:50 +08:00 committed by BOT
parent 8ea7ae7086
commit 2db5607060
2 changed files with 14 additions and 34 deletions

View File

@ -10,55 +10,30 @@ menu "Brownout Detector"
choice ESP_BROWNOUT_DET_LVL_SEL
prompt "Brownout voltage level"
depends on ESP_BROWNOUT_DET && (ESP32P4_REV_MIN_FULL <= 1)
default ESP_BROWNOUT_DET_LVL_SEL_7
depends on ESP_BROWNOUT_DET
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each chip.
Please note that this config is only valid when P4 SOC version is above v1.0. When you are using a
earlier P4 SOC version (v0.x), the brownout value should be fixed around 2.52V and not configurable.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_7
bool "2.51V"
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.64V"
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.76V"
config ESP_BROWNOUT_DET_LVL_SEL_4
bool "2.92V"
config ESP_BROWNOUT_DET_LVL_SEL_3
bool "3.10V"
config ESP_BROWNOUT_DET_LVL_SEL_2
bool "3.27V"
endchoice
choice ESP_BROWNOUT_DET_LVL_SEL_V2
prompt "Brownout voltage level"
default ESP_BROWNOUT_DET_LVL_SEL_7_V2
depends on ESP_BROWNOUT_DET && (ESP32P4_REV_MIN_FULL >= 100)
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each chip.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_7_V2
bool "2.6V"
config ESP_BROWNOUT_DET_LVL_SEL_6_V2
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.52V"
config ESP_BROWNOUT_DET_LVL_SEL_5_V2
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.42V"
endchoice
config ESP_BROWNOUT_DET_LVL
int
default 2 if ESP_BROWNOUT_DET_LVL_SEL_2
default 3 if ESP_BROWNOUT_DET_LVL_SEL_3
default 4 if ESP_BROWNOUT_DET_LVL_SEL_4
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5 || ESP_BROWNOUT_DET_LVL_SEL_5_V2
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6 || ESP_BROWNOUT_DET_LVL_SEL_6_V2
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7 || ESP_BROWNOUT_DET_LVL_SEL_7_V2
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
endmenu

View File

@ -17,6 +17,8 @@
#include "hal/regi2c_ctrl.h"
#include "hal/psdet_types.h"
#include "soc/regi2c_brownout.h"
#include "hal/efuse_hal.h"
#include "soc/chip_revision.h"
#define BROWNOUT_DETECTOR_LL_FIB_ENABLE (BIT(1))
@ -68,6 +70,9 @@ static inline void brownout_ll_reset_config(bool reset_ena, uint32_t reset_wait,
*/
static inline void brownout_ll_set_threshold(uint8_t threshold)
{
if (!ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 100)) {
threshold = 0; // Fix this level as 0 so that on v0.x brownout value will be fixed around 2.52v.
}
REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_L, threshold);
REGI2C_WRITE_MASK(I2C_BOD, I2C_BOD_THRESHOLD_H, threshold);
}