diff options
| -rw-r--r-- | drivers/regulator/Makefile | 3 | ||||
| -rw-r--r-- | drivers/regulator/core.c | 22 | ||||
| -rw-r--r-- | include/linux/regulator/machine.h | 5 |
3 files changed, 28 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 | ||
| 6 | obj-$(CONFIG_REGULATOR) += core.o | 6 | obj-$(CONFIG_REGULATOR) += core.o dummy.o |
| 7 | obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o | 7 | obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o |
| 8 | obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o | 8 | obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o |
| 9 | obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o | 9 | obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o |
| 10 | 10 | ||
| 11 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o | 11 | obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o |
| 12 | obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o | 12 | obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o |
| 13 | obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o | ||
| 14 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o | 13 | obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o |
| 15 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o | 14 | obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o |
| 16 | obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o | 15 | obj-$(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); | |||
| 33 | static LIST_HEAD(regulator_list); | 33 | static LIST_HEAD(regulator_list); |
| 34 | static LIST_HEAD(regulator_map_list); | 34 | static LIST_HEAD(regulator_map_list); |
| 35 | static int has_full_constraints; | 35 | static int has_full_constraints; |
| 36 | static 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) | |||
| 2463 | EXPORT_SYMBOL_GPL(regulator_has_full_constraints); | 2469 | EXPORT_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 | */ | ||
| 2481 | void regulator_use_dummy_regulator(void) | ||
| 2482 | { | ||
| 2483 | board_wants_dummy_regulator = true; | ||
| 2484 | } | ||
| 2485 | EXPORT_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 | * |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index e2980287245e..761c745b9c24 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -189,10 +189,15 @@ int regulator_suspend_prepare(suspend_state_t state); | |||
| 189 | 189 | ||
| 190 | #ifdef CONFIG_REGULATOR | 190 | #ifdef CONFIG_REGULATOR |
| 191 | void regulator_has_full_constraints(void); | 191 | void regulator_has_full_constraints(void); |
| 192 | void regulator_use_dummy_regulator(void); | ||
| 192 | #else | 193 | #else |
| 193 | static inline void regulator_has_full_constraints(void) | 194 | static inline void regulator_has_full_constraints(void) |
| 194 | { | 195 | { |
| 195 | } | 196 | } |
| 197 | |||
| 198 | static inline void regulator_use_dummy_regulator(void) | ||
| 199 | { | ||
| 200 | } | ||
| 196 | #endif | 201 | #endif |
| 197 | 202 | ||
| 198 | #endif | 203 | #endif |
