diff options
author | Chen-Yu Tsai <wens@csie.org> | 2016-03-29 19:26:48 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2016-03-31 18:03:58 +0300 |
commit | 38491d9c6515eafd97d881cab0420652f07d92a5 (patch) | |
tree | 43c2174a8b6f4ecde4a85d96271b0ede5d57f20d /drivers/power/axp818.c | |
parent | 4c6a9ca103f953b6e5e6dfcd56fb558e61ca3c05 (diff) | |
download | u-boot-38491d9c6515eafd97d881cab0420652f07d92a5.tar.xz |
power: axp818: Add support for FLDOs
The FLDOs on AXP818 PMIC normally provide power to CPUS and USB HSIC PHY
on the A83T/H8.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-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 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c index e885d02984..3ac05ffefe 100644 --- a/drivers/power/axp818.c +++ b/drivers/power/axp818.c @@ -191,6 +191,40 @@ int axp_set_eldo(int eldo_num, unsigned int mvolt) AXP818_OUTPUT_CTRL2_ELDO1_EN << (eldo_num - 1)); } +int axp_set_fldo(int fldo_num, unsigned int mvolt) +{ + int ret; + u8 cfg; + + if (fldo_num < 1 || fldo_num > 3) + return -EINVAL; + + if (mvolt == 0) + return pmic_bus_clrbits(AXP818_OUTPUT_CTRL3, + AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1)); + + if (fldo_num < 3) { + cfg = axp818_mvolt_to_cfg(mvolt, 700, 1450, 50); + ret = pmic_bus_write(AXP818_FLDO1_CTRL + (fldo_num - 1), cfg); + } else { + /* + * Special case for FLDO3, which is DCDC5 / 2 or FLDOIN / 2 + * Since FLDOIN is unknown, test against DCDC5. + */ + if (mvolt * 2 == CONFIG_AXP_DCDC5_VOLT) + ret = pmic_bus_clrbits(AXP818_FLDO2_3_CTRL, + AXP818_FLDO2_3_CTRL_FLDO3_VOL); + else + ret = pmic_bus_setbits(AXP818_FLDO2_3_CTRL, + AXP818_FLDO2_3_CTRL_FLDO3_VOL); + } + if (ret) + return ret; + + return pmic_bus_setbits(AXP818_OUTPUT_CTRL3, + AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1)); +} + int axp_init(void) { u8 axp_chip_id; |