diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2017-01-10 11:30:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-01-23 13:15:44 -0500 |
commit | ca7734ad77b4ffb83a03c80b8d64d40c7ef49263 (patch) | |
tree | 1ab7dd6bb69a4981852b93b6c3a086df03bb8ee8 | |
parent | d00b74613fb18dfd0a5aa99270ee2e72d5c808d7 (diff) |
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>
-rw-r--r-- | Documentation/devicetree/bindings/regulator/anatop-regulator.txt | 1 | ||||
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt index 37c4ea076f88..1d58c8cfdbc0 100644 --- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt | |||
@@ -14,6 +14,7 @@ Optional properties: | |||
14 | - anatop-delay-bit-shift: Bit shift for the step time register | 14 | - anatop-delay-bit-shift: Bit shift for the step time register |
15 | - anatop-delay-bit-width: Number of bits used in the step time register | 15 | - anatop-delay-bit-width: Number of bits used in the step time register |
16 | - vin-supply: The supply for this regulator | 16 | - vin-supply: The supply for this regulator |
17 | - anatop-enable-bit: Regulator enable bit offset | ||
17 | 18 | ||
18 | Any property defined as part of the core regulator | 19 | Any property defined as part of the core regulator |
19 | binding, defined in regulator.txt, can also be used. | 20 | binding, defined in regulator.txt, can also be used. |
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) | |||
301 | return -EINVAL; | 301 | return -EINVAL; |
302 | } | 302 | } |
303 | } else { | 303 | } else { |
304 | u32 enable_bit; | ||
305 | |||
304 | rdesc->ops = &anatop_rops; | 306 | rdesc->ops = &anatop_rops; |
307 | |||
308 | if (!of_property_read_u32(np, "anatop-enable-bit", | ||
309 | &enable_bit)) { | ||
310 | anatop_rops.enable = regulator_enable_regmap; | ||
311 | anatop_rops.disable = regulator_disable_regmap; | ||
312 | anatop_rops.is_enabled = regulator_is_enabled_regmap; | ||
313 | |||
314 | rdesc->enable_reg = sreg->control_reg; | ||
315 | rdesc->enable_mask = BIT(enable_bit); | ||
316 | } | ||
305 | } | 317 | } |
306 | 318 | ||
307 | /* register regulator */ | 319 | /* register regulator */ |