summaryrefslogtreecommitdiff
path: root/drivers/regulator/anatop-regulator.c
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2017-01-10 19:30:14 +0300
committerMark Brown <broonie@kernel.org>2017-01-23 21:15:44 +0300
commitca7734ad77b4ffb83a03c80b8d64d40c7ef49263 (patch)
tree1ab7dd6bb69a4981852b93b6c3a086df03bb8ee8 /drivers/regulator/anatop-regulator.c
parentd00b74613fb18dfd0a5aa99270ee2e72d5c808d7 (diff)
downloadlinux-ca7734ad77b4ffb83a03c80b8d64d40c7ef49263.tar.xz
regulator: anatop: Add support for "anatop-enable-bit"
Add code to support support for "anatop-enable-bit" device-tree property. This property translates to LINREG_ENABLE bit in real hardware and is present on 1p1, 2p5 and 3p0 regulators on i.MX6 and 1p0d regulator on i.MX7. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r--drivers/regulator/anatop-regulator.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 3a6d0290c54c..b041f277a38b 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev)
return -EINVAL;
}
} else {
+ u32 enable_bit;
+
rdesc->ops = &anatop_rops;
+
+ if (!of_property_read_u32(np, "anatop-enable-bit",
+ &enable_bit)) {
+ anatop_rops.enable = regulator_enable_regmap;
+ anatop_rops.disable = regulator_disable_regmap;
+ anatop_rops.is_enabled = regulator_is_enabled_regmap;
+
+ rdesc->enable_reg = sreg->control_reg;
+ rdesc->enable_mask = BIT(enable_bit);
+ }
}
/* register regulator */