modify default voltages; normalize the setting location

This commit is contained in:
bunnie 2025-10-25 01:37:21 +08:00
parent e1f685f70d
commit d11d2f8cd5
2 changed files with 17 additions and 4 deletions

View file

@ -124,10 +124,21 @@ pub fn early_init(mut board_type: bao1x_api::BoardTypeCoding) -> (bao1x_api::Boa
// set PWM mode on DCDC2. greatly reduces noise on the regulator line
pmic.set_pwm_mode(&mut i2c, bao1x_hal::axp2101::WhichDcDc::Dcdc2, true).unwrap();
// make sure the DCDC2 is set to 0.9V, which will allow us to enter high-speed run
// mode. It defaults to 0.85V on boot.
pmic.set_dcdc(&mut i2c, Some((0.9, true)), bao1x_hal::axp2101::WhichDcDc::Dcdc2)
.unwrap();
// make sure the DCDC2 is set. Target 20mV above the acceptable run threshold because
// we have to take into account the transistor loss on the
// power switch.
pmic.set_dcdc(
&mut i2c,
Some((
(bao1x_hal::board::DEFAULT_CPU_VOLTAGE_MV
+ bao1x_hal::board::VDD85_SWITCH_MARGIN_MV)
as f32
/ 1000.0,
true,
)),
bao1x_hal::axp2101::WhichDcDc::Dcdc2,
)
.unwrap();
break;
}

View file

@ -2,6 +2,8 @@
use bao1x_api::*;
pub const DEFAULT_FCLK_FREQUENCY: u32 = bao1x_api::offsets::baosec::DEFAULT_FCLK_FREQUENCY;
pub const DEFAULT_CPU_VOLTAGE_MV: u32 = 820;
pub const VDD85_SWITCH_MARGIN_MV: u32 = 20; // margin, in mV, for the transistor power switch
pub const I2C_AXP2101_ADR: u8 = 0x34;
pub const I2C_TUSB320_ADR: u8 = 0x47;