Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mark Brown and committed by
Liam Girdwood
688fe99a 993af7c0

+28 -2
+1 -2
drivers/regulator/Makefile
··· 3 3 # 4 4 5 5 6 - obj-$(CONFIG_REGULATOR) += core.o 6 + obj-$(CONFIG_REGULATOR) += core.o dummy.o 7 7 obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o 8 8 obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o 9 9 obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o 10 10 11 11 obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o 12 12 obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o 13 - obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o 14 13 obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o 15 14 obj-$(CONFIG_REGULATOR_LP3972) += lp3972.o 16 15 obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
+22
drivers/regulator/core.c
··· 33 33 static LIST_HEAD(regulator_list); 34 34 static LIST_HEAD(regulator_map_list); 35 35 static int has_full_constraints; 36 + static bool board_wants_dummy_regulator; 36 37 37 38 /* 38 39 * struct regulator_map ··· 1107 1106 rdev = map->regulator; 1108 1107 goto found; 1109 1108 } 1109 + } 1110 + 1111 + if (board_wants_dummy_regulator) { 1112 + rdev = dummy_regulator_rdev; 1113 + goto found; 1110 1114 } 1111 1115 1112 1116 #ifdef CONFIG_REGULATOR_DUMMY ··· 2467 2461 has_full_constraints = 1; 2468 2462 } 2469 2463 EXPORT_SYMBOL_GPL(regulator_has_full_constraints); 2464 + 2465 + /** 2466 + * regulator_use_dummy_regulator - Provide a dummy regulator when none is found 2467 + * 2468 + * Calling this function will cause the regulator API to provide a 2469 + * dummy regulator to consumers if no physical regulator is found, 2470 + * allowing most consumers to proceed as though a regulator were 2471 + * configured. This allows systems such as those with software 2472 + * controllable regulators for the CPU core only to be brought up more 2473 + * readily. 2474 + */ 2475 + void regulator_use_dummy_regulator(void) 2476 + { 2477 + board_wants_dummy_regulator = true; 2478 + } 2479 + EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator); 2470 2480 2471 2481 /** 2472 2482 * rdev_get_drvdata - get rdev regulator driver data
+5
include/linux/regulator/machine.h
··· 189 189 190 190 #ifdef CONFIG_REGULATOR 191 191 void regulator_has_full_constraints(void); 192 + void regulator_use_dummy_regulator(void); 192 193 #else 193 194 static inline void regulator_has_full_constraints(void) 195 + { 196 + } 197 + 198 + static inline void regulator_use_dummy_regulator(void) 194 199 { 195 200 } 196 201 #endif