diff options
author | Chen-Yu Tsai <wens@csie.org> | 2016-01-12 14:42:40 +0800 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2016-01-26 16:20:05 +0100 |
commit | f3c5045a95e0b9f164178bbf8de98b9adf3b099e (patch) | |
tree | 9e9c2abc4245f4236f42ea709a8875d2e9036c6b /drivers/power/axp818.c | |
parent | f7b4fff3f08e75c58f1819e8e7ca68af8afa61c2 (diff) | |
download | u-boot-f3c5045a95e0b9f164178bbf8de98b9adf3b099e.tar.gz |
sunxi: power: axp818: Enable support for ALDOs
Previously, AXP818 ALDO support was partially added to Kconfig, but
never enabled in the board file, nor properly set or configured in
Kconfig. The boards continue to work because the AXP818 is designed
to pair with the A83T/H8, and the default voltages match the reference
design's requirements.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/power/axp818.c')
-rw-r--r-- | drivers/power/axp818.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c index 3119b64ea1..e885d02984 100644 --- a/drivers/power/axp818.c +++ b/drivers/power/axp818.c @@ -110,6 +110,43 @@ int axp_set_dcdc5(unsigned int mvolt) AXP818_OUTPUT_CTRL1_DCDC5_EN); } +int axp_set_aldo(int aldo_num, unsigned int mvolt) +{ + int ret; + u8 cfg; + + if (aldo_num < 1 || aldo_num > 3) + return -EINVAL; + + if (mvolt == 0) + return pmic_bus_clrbits(AXP818_OUTPUT_CTRL3, + AXP818_OUTPUT_CTRL3_ALDO1_EN << (aldo_num - 1)); + + cfg = axp818_mvolt_to_cfg(mvolt, 700, 3300, 100); + ret = pmic_bus_write(AXP818_ALDO1_CTRL + (aldo_num - 1), cfg); + if (ret) + return ret; + + return pmic_bus_setbits(AXP818_OUTPUT_CTRL3, + AXP818_OUTPUT_CTRL3_ALDO1_EN << (aldo_num - 1)); +} + +/* TODO: re-work other AXP drivers to consolidate ALDO functions. */ +int axp_set_aldo1(unsigned int mvolt) +{ + return axp_set_aldo(1, mvolt); +} + +int axp_set_aldo2(unsigned int mvolt) +{ + return axp_set_aldo(2, mvolt); +} + +int axp_set_aldo3(unsigned int mvolt) +{ + return axp_set_aldo(3, mvolt); +} + int axp_set_dldo(int dldo_num, unsigned int mvolt) { int ret; |