summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/as3722.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/power/as3722.c b/drivers/power/as3722.c
index c09e1de06f4..9f2d9d56b28 100644
--- a/drivers/power/as3722.c
+++ b/drivers/power/as3722.c
@@ -22,7 +22,8 @@
#define AS3722_LDO_VOLTAGE(n) (0x10 + (n))
#define AS3722_GPIO_SIGNAL_OUT 0x20
#define AS3722_SD_CONTROL 0x4d
-#define AS3722_LDO_CONTROL 0x4e
+#define AS3722_LDO_CONTROL0 0x4e
+#define AS3722_LDO_CONTROL1 0x4f
#define AS3722_ASIC_ID1 0x90
#define AS3722_DEVICE_ID 0x0c
#define AS3722_ASIC_ID2 0x91
@@ -111,13 +112,19 @@ int as3722_sd_set_voltage(struct udevice *pmic, unsigned int sd, u8 value)
int as3722_ldo_enable(struct udevice *pmic, unsigned int ldo)
{
+ u8 ctrl_reg = AS3722_LDO_CONTROL0;
u8 value;
int err;
if (ldo > 11)
return -EINVAL;
- err = as3722_read(pmic, AS3722_LDO_CONTROL, &value);
+ if (ldo > 7) {
+ ctrl_reg = AS3722_LDO_CONTROL1;
+ ldo -= 8;
+ }
+
+ err = as3722_read(pmic, ctrl_reg, &value);
if (err) {
error("failed to read LDO control register: %d", err);
return err;
@@ -125,7 +132,7 @@ int as3722_ldo_enable(struct udevice *pmic, unsigned int ldo)
value |= 1 << ldo;
- err = as3722_write(pmic, AS3722_LDO_CONTROL, value);
+ err = as3722_write(pmic, ctrl_reg, value);
if (err < 0) {
error("failed to write LDO control register: %d", err);
return err;