aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-07-21 11:00:23 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-09-22 08:32:38 -0400
commit5ffbd136e6c51c8d1eec7a4a0c5d2180c81aea30 (patch)
tree1281ca42478aea061ba5de5be045e2361cd282d5 /include/linux/regulator
parentc1b60873ca2078bfca94b73bc88ef1c5adcc928b (diff)
regulator: Add regulator_get_exclusive() API
Some consumers require complete control of the regulator and can't tolerate sharing it with other consumers, most commonly because they need to have the regulator actually disabled so can't have other consumers forcing it on. This new regulator_get_exclusive() API call allows these consumers to explicitly request this, documenting the assumptions that they are making. In order to simplify coding of such consumers the use count for regulators they request is forced to match the enabled state of the regulator when it is requested. This is not possible for consumers which can share regulators due to the need to keep track of the ownership of use counts. A new API call is used rather than an additional argument to the existing regulator_get() in order to avoid merge headaches with driver code in other trees. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'include/linux/regulator')
-rw-r--r--include/linux/regulator/consumer.h2
-rw-r--r--include/linux/regulator/driver.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 277f4b964df5..976b57b6912c 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -125,6 +125,8 @@ struct regulator_bulk_data {
125/* regulator get and put */ 125/* regulator get and put */
126struct regulator *__must_check regulator_get(struct device *dev, 126struct regulator *__must_check regulator_get(struct device *dev,
127 const char *id); 127 const char *id);
128struct regulator *__must_check regulator_get_exclusive(struct device *dev,
129 const char *id);
128void regulator_put(struct regulator *regulator); 130void regulator_put(struct regulator *regulator);
129 131
130/* regulator output control and status */ 132/* regulator output control and status */
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index ce1be708ca16..73c9cd6cda7d 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -162,6 +162,8 @@ struct regulator_desc {
162struct regulator_dev { 162struct regulator_dev {
163 struct regulator_desc *desc; 163 struct regulator_desc *desc;
164 int use_count; 164 int use_count;
165 int open_count;
166 int exclusive;
165 167
166 /* lists we belong to */ 168 /* lists we belong to */
167 struct list_head list; /* list of all regulators */ 169 struct list_head list; /* list of all regulators */