aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-10-05 22:18:32 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-10-28 17:40:31 -0400
commit688fe99a439f7c9dfcc52fbf7cb347f140a2dc8b (patch)
tree0a8c8e8fcd3513dd4f7d24abf738e97f28497975 /drivers/regulator
parent993af7c048f414121bc81e0d6e69456e3862a06b (diff)
regulator: Add option for machine drivers to enable the dummy regulator
Allow machine drivers to explicitly enable the use of the dummy regulator, enabling simpler support for systems with only a few specific supplies visible to software. It is strongly recommended that this is not used on systems with substantial software control over their PMICs, for maximum functionality constrints should be as fully specified as possible. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/Makefile3
-rw-r--r--drivers/regulator/core.c22
2 files changed, 23 insertions, 2 deletions
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 6cae6419b8b1..bff815736780 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -3,14 +3,13 @@
3# 3#
4 4
5 5
6obj-$(CONFIG_REGULATOR) += core.o 6obj-$(CONFIG_REGULATOR) += core.o dummy.o
7obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o 7obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
8obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o 8obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
9obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o 9obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
10 10
11obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o 11obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
12obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o 12obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
13obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
14obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o 13obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
15obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o 14obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
16obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o 15obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index cc8b337b9119..4fa08c85f3ce 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -33,6 +33,7 @@ static DEFINE_MUTEX(regulator_list_mutex);
33static LIST_HEAD(regulator_list); 33static LIST_HEAD(regulator_list);
34static LIST_HEAD(regulator_map_list); 34static LIST_HEAD(regulator_map_list);
35static int has_full_constraints; 35static int has_full_constraints;
36static bool board_wants_dummy_regulator;
36 37
37/* 38/*
38 * struct regulator_map 39 * struct regulator_map
@@ -1108,6 +1109,11 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
1108 } 1109 }
1109 } 1110 }
1110 1111
1112 if (board_wants_dummy_regulator) {
1113 rdev = dummy_regulator_rdev;
1114 goto found;
1115 }
1116
1111#ifdef CONFIG_REGULATOR_DUMMY 1117#ifdef CONFIG_REGULATOR_DUMMY
1112 if (!devname) 1118 if (!devname)
1113 devname = "deviceless"; 1119 devname = "deviceless";
@@ -2463,6 +2469,22 @@ void regulator_has_full_constraints(void)
2463EXPORT_SYMBOL_GPL(regulator_has_full_constraints); 2469EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
2464 2470
2465/** 2471/**
2472 * regulator_use_dummy_regulator - Provide a dummy regulator when none is found
2473 *
2474 * Calling this function will cause the regulator API to provide a
2475 * dummy regulator to consumers if no physical regulator is found,
2476 * allowing most consumers to proceed as though a regulator were
2477 * configured. This allows systems such as those with software
2478 * controllable regulators for the CPU core only to be brought up more
2479 * readily.
2480 */
2481void regulator_use_dummy_regulator(void)
2482{
2483 board_wants_dummy_regulator = true;
2484}
2485EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
2486
2487/**
2466 * rdev_get_drvdata - get rdev regulator driver data 2488 * rdev_get_drvdata - get rdev regulator driver data
2467 * @rdev: regulator 2489 * @rdev: regulator
2468 * 2490 *