diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-11 04:53:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-14 05:58:23 -0400 |
commit | da07ecd93b196819dcec488b7ebec69a71f3819e (patch) | |
tree | a4d9f7b306911bf7dfb692418c1ad82792d8c4ee /include | |
parent | 30ab1e78864ca5781de5b1fb501bed9df2c215f1 (diff) |
regulator: Implement deferred disable support
It is a reasonably common pattern for hardware to require some delay after
being quiesced before the disable has finalised, especially in mixed signal
devices. For example, an active discharge may be required to ensure that
the circuit starts up again in a known state. Avoid having to implement
such delays in the regulator API by providing regulator_deferred_disable()
which will do a regulator_disable() a specified number of milliseconds
after it is called.
Due to the reference counting done on regulators a deferred disable can
be cancelled by doing another regulator_enable().
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/regulator/consumer.h | 7 | ||||
-rw-r--r-- | include/linux/regulator/driver.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 26f6ea4444e3..6fae97a6ce7d 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -141,6 +141,7 @@ int regulator_enable(struct regulator *regulator); | |||
141 | int regulator_disable(struct regulator *regulator); | 141 | int regulator_disable(struct regulator *regulator); |
142 | int regulator_force_disable(struct regulator *regulator); | 142 | int regulator_force_disable(struct regulator *regulator); |
143 | int regulator_is_enabled(struct regulator *regulator); | 143 | int regulator_is_enabled(struct regulator *regulator); |
144 | int regulator_disable_deferred(struct regulator *regulator, int ms); | ||
144 | 145 | ||
145 | int regulator_bulk_get(struct device *dev, int num_consumers, | 146 | int regulator_bulk_get(struct device *dev, int num_consumers, |
146 | struct regulator_bulk_data *consumers); | 147 | struct regulator_bulk_data *consumers); |
@@ -211,6 +212,12 @@ static inline int regulator_disable(struct regulator *regulator) | |||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
213 | 214 | ||
215 | static inline int regulator_disable_deferred(struct regulator *regulator, | ||
216 | int ms) | ||
217 | { | ||
218 | return 0; | ||
219 | } | ||
220 | |||
214 | static inline int regulator_is_enabled(struct regulator *regulator) | 221 | static inline int regulator_is_enabled(struct regulator *regulator) |
215 | { | 222 | { |
216 | return 1; | 223 | return 1; |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 1a80bc77517d..12a1aa04b720 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
@@ -199,6 +199,9 @@ struct regulator_dev { | |||
199 | struct regulation_constraints *constraints; | 199 | struct regulation_constraints *constraints; |
200 | struct regulator *supply; /* for tree */ | 200 | struct regulator *supply; /* for tree */ |
201 | 201 | ||
202 | struct delayed_work disable_work; | ||
203 | int deferred_disables; | ||
204 | |||
202 | void *reg_data; /* regulator_dev data */ | 205 | void *reg_data; /* regulator_dev data */ |
203 | 206 | ||
204 | #ifdef CONFIG_DEBUG_FS | 207 | #ifdef CONFIG_DEBUG_FS |