]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
regulator: Add option for machine drivers to enable the dummy regulator
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 6 Oct 2010 02:18:32 +0000 (19:18 -0700)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Thu, 28 Oct 2010 21:40:31 +0000 (22:40 +0100)
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>
drivers/regulator/Makefile
drivers/regulator/core.c
include/linux/regulator/machine.h

index 6cae6419b8b17dcf4c4f0da05e4cdb8e8089e0bc..bff81573678000503a71e6304581a69e41b85abc 100644 (file)
@@ -3,14 +3,13 @@
 #
 
 
-obj-$(CONFIG_REGULATOR) += core.o
+obj-$(CONFIG_REGULATOR) += core.o dummy.o
 obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
 obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o
 
 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
 obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
-obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o
 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
index cc8b337b9119de5e955aabe1935ad931a895c71a..4fa08c85f3cedbe1bdd32d6237fca81ffb389677 100644 (file)
@@ -33,6 +33,7 @@ static DEFINE_MUTEX(regulator_list_mutex);
 static LIST_HEAD(regulator_list);
 static LIST_HEAD(regulator_map_list);
 static int has_full_constraints;
+static bool board_wants_dummy_regulator;
 
 /*
  * struct regulator_map
@@ -1108,6 +1109,11 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
                }
        }
 
+       if (board_wants_dummy_regulator) {
+               rdev = dummy_regulator_rdev;
+               goto found;
+       }
+
 #ifdef CONFIG_REGULATOR_DUMMY
        if (!devname)
                devname = "deviceless";
@@ -2462,6 +2468,22 @@ void regulator_has_full_constraints(void)
 }
 EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
 
+/**
+ * regulator_use_dummy_regulator - Provide a dummy regulator when none is found
+ *
+ * Calling this function will cause the regulator API to provide a
+ * dummy regulator to consumers if no physical regulator is found,
+ * allowing most consumers to proceed as though a regulator were
+ * configured.  This allows systems such as those with software
+ * controllable regulators for the CPU core only to be brought up more
+ * readily.
+ */
+void regulator_use_dummy_regulator(void)
+{
+       board_wants_dummy_regulator = true;
+}
+EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
+
 /**
  * rdev_get_drvdata - get rdev regulator driver data
  * @rdev: regulator
index e2980287245e8cb28275dae09fcc33373fa6c538..761c745b9c24d11159c619e296c41fded18099f3 100644 (file)
@@ -189,10 +189,15 @@ int regulator_suspend_prepare(suspend_state_t state);
 
 #ifdef CONFIG_REGULATOR
 void regulator_has_full_constraints(void);
+void regulator_use_dummy_regulator(void);
 #else
 static inline void regulator_has_full_constraints(void)
 {
 }
+
+static inline void regulator_use_dummy_regulator(void)
+{
+}
 #endif
 
 #endif