diff options
author | Ćukasz Majewski <l.majewski@samsung.com> | 2012-11-13 03:22:04 (GMT) |
---|---|---|
committer | Anatolij Gustschin <agust@denx.de> | 2012-11-14 10:21:10 (GMT) |
commit | bf995a9a28c7a987be0b3df9d4f84da63c9bfb1c (patch) | |
tree | 3e2ce0935072444370efd3f23d4bd47c88245ca0 /drivers | |
parent | b95aacd332cde91299cf05e1a87dc6d7de545adb (diff) | |
download | u-boot-fsl-qoriq-bf995a9a28c7a987be0b3df9d4f84da63c9bfb1c.tar.xz |
pmic:max8997: Function for calculating LDO internal register value
Function for calculating LDO internal register value from passed micro
Volt.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/pmic/pmic_max8997.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/power/pmic/pmic_max8997.c b/drivers/power/pmic/pmic_max8997.c index 7fe1b53..2e46884 100644 --- a/drivers/power/pmic/pmic_max8997.c +++ b/drivers/power/pmic/pmic_max8997.c @@ -27,6 +27,22 @@ #include <i2c.h> #include <errno.h> +unsigned char max8997_reg_ldo(int uV) +{ + unsigned char ret; + if (uV <= 800000) + return 0; + if (uV >= 3950000) + return MAX8997_LDO_MAX_VAL; + ret = (uV - 800000) / 50000; + if (ret > MAX8997_LDO_MAX_VAL) { + printf("MAX8997 LDO SETTING ERROR (%duV) -> %u\n", uV, ret); + ret = MAX8997_LDO_MAX_VAL; + } + + return ret; +} + int pmic_init(unsigned char bus) { static const char name[] = "MAX8997_PMIC"; |