diff options
author | Olliver Schinagl | 2018-11-21 20:05:29 +0200 |
---|---|---|
committer | Jagan Teki | 2018-12-07 22:24:33 +0530 |
commit | 3f7d76a7ed92e75ff30c7e6287eca71f09da0bcf (patch) | |
tree | a8bab77f1f936d2f8fce3654b48410b813477fcc /drivers | |
parent | f5eebc792559d33ddf973f640f7570d042e3bbe8 (diff) |
power: axp209: Reduce magic values by adding defines for LDO[234]
The AXP209 has a few 'magisc-ish' values that are better served with
clear defines.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/axp209.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c index e13c762a810..819b168a84b 100644 --- a/drivers/power/axp209.c +++ b/drivers/power/axp209.c @@ -81,8 +81,7 @@ int axp_set_aldo2(unsigned int mvolt) if (rc) return rc; - /* LDO2 configuration is in upper 4 bits */ - reg = (reg & 0x0f) | (cfg << 4); + reg |= AXP209_LDO24_LDO2_SET(reg, cfg); rc = pmic_bus_write(AXP209_LDO24_VOLTAGE, reg); if (rc) return rc; @@ -99,10 +98,12 @@ int axp_set_aldo3(unsigned int mvolt) return pmic_bus_clrbits(AXP209_OUTPUT_CTRL, AXP209_OUTPUT_CTRL_LDO3); - if (mvolt == -1) - cfg = 0x80; /* determined by LDO3IN pin */ - else + if (mvolt == -1) { + cfg = AXP209_LDO3_VOLTAGE_FROM_LDO3IN; + } else { cfg = axp209_mvolt_to_cfg(mvolt, 700, 3500, 25); + cfg = AXP209_LDO3_VOLTAGE_SET(cfg); + } rc = pmic_bus_write(AXP209_LDO3_VOLTAGE, cfg); if (rc) @@ -131,8 +132,7 @@ int axp_set_aldo4(unsigned int mvolt) if (rc) return rc; - /* LDO4 configuration is in lower 4 bits */ - reg = (reg & 0xf0) | (cfg << 0); + reg |= AXP209_LDO24_LDO4_SET(reg, cfg); rc = pmic_bus_write(AXP209_LDO24_VOLTAGE, reg); if (rc) return rc; |