]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/power/axp152.c
3 * Henrik Nordstrom <henrik@henriknordstrom.net>
5 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/arch/pmic_bus.h>
11 static u8
axp152_mvolt_to_target(int mvolt
, int min
, int max
, int div
)
18 return (mvolt
- min
) / div
;
21 int axp_set_dcdc2(unsigned int mvolt
)
26 target
= axp152_mvolt_to_target(mvolt
, 700, 2275, 25);
28 /* Do we really need to be this gentle? It has built-in voltage slope */
29 while ((rc
= pmic_bus_read(AXP152_DCDC2_VOLTAGE
, ¤t
)) == 0 &&
35 rc
= pmic_bus_write(AXP152_DCDC2_VOLTAGE
, current
);
42 int axp_set_dcdc3(unsigned int mvolt
)
44 u8 target
= axp152_mvolt_to_target(mvolt
, 700, 3500, 50);
46 return pmic_bus_write(AXP152_DCDC3_VOLTAGE
, target
);
49 int axp_set_dcdc4(unsigned int mvolt
)
51 u8 target
= axp152_mvolt_to_target(mvolt
, 700, 3500, 25);
53 return pmic_bus_write(AXP152_DCDC4_VOLTAGE
, target
);
56 int axp_set_aldo2(unsigned int mvolt
)
58 u8 target
= axp152_mvolt_to_target(mvolt
, 700, 3500, 100);
60 return pmic_bus_write(AXP152_LDO2_VOLTAGE
, target
);
72 rc
= pmic_bus_read(AXP152_CHIP_VERSION
, &ver
);