From 4e6c2706c90dfffd82322c74077127abb2ba9680 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 7 Oct 2024 22:53:10 +0800 Subject: [PATCH] employ the axp2101 driver to setup the voltages --- loader/src/platform/cramium/cramium.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/loader/src/platform/cramium/cramium.rs b/loader/src/platform/cramium/cramium.rs index d8a49981e..67733cc98 100644 --- a/loader/src/platform/cramium/cramium.rs +++ b/loader/src/platform/cramium/cramium.rs @@ -261,10 +261,14 @@ pub fn early_init() -> u32 { ) }; let mut i2c = unsafe { cramium_hal::udma::I2c::new_with_ifram(i2c_channel, 100_000, perclk, i2c_ifram) }; - let ldo_adjusted = [0x57, 0x00, 0x0d, 0x14, 0x1c, 0x18, 0x0d, 0x17, 0x08, 0x00, 0x0e]; - i2c.i2c_write_async(cramium_hal::board::I2C_AXP2101_ADR, 0x90, &ldo_adjusted).unwrap(); - i2c.i2c_await(None, false).unwrap(); - crate::println!("AXP2101 LDOs configured"); + let mut pmic = cramium_hal::axp2101::Axp2101::new(&mut i2c); + pmic.set_ldo(&mut i2c, Some(2.5), cramium_hal::axp2101::WhichLdo::Aldo2).unwrap(); + pmic.set_dcdc(&mut i2c, Some((1.2, false)), cramium_hal::axp2101::WhichDcDc::Dcdc4).unwrap(); + + // let ldo_adjusted = [0x57, 0x00, 0x0d, 0x14, 0x1c, 0x18, 0x0d, 0x17, 0x08, 0x00, 0x0e]; + // i2c.i2c_write_async(cramium_hal::board::I2C_AXP2101_ADR, 0x90, &ldo_adjusted).unwrap(); + //i2c.i2c_await(None, false).unwrap(); + crate::println!("AXP2101 configure: {:?}", pmic); // show the boot logo crate::platform::cramium::bootlogo::show_logo(freq, &mut udma_global, &mut iox);