[U-Boot] [PATCH 10/16] pmic:max8997: Function for calculating LDO internal register value

Lukasz Majewski
2012-09-14T15:40:09Z

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>
---
drivers/misc/pmic_max8997.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/pmic_max8997.c b/drivers/misc/pmic_max8997.c
index 4e8283a..a4158e2 100644
--- a/drivers/misc/pmic_max8997.c
+++ b/drivers/misc/pmic_max8997.c
@@ -42,3 +42,20 @@ int pmic_init(unsigned char bus)

return 0;
}
+
+unsigned char max8997_reg_ldo(int uV)
+{
+ unsigned char ret;
+ if (uV <= 800000)
+ return 0;
+ if (uV >= 3950000)
+ return 0x3f;
+ ret = (uV - 800000) / 50000;
+ if (ret > 0x3f) {
+ printf("MAX8997 LDO SETTING ERROR (%duV) -> %u\n", uV, ret);
+ ret = 0x3f;
+ }
+
+ return ret;
+}
+
--
1.7.2.3