···2828 help2929 Say yes here to enable debugging support.30303131-config REGULATOR_DUMMY3232- bool "Provide a dummy regulator if regulator lookups fail"3333- help3434- If this option is enabled then when a regulator lookup fails3535- and the board has not specified that it has provided full3636- constraints the regulator core will provide an always3737- enabled dummy regulator, allowing consumer drivers to continue.3838-3939- A warning will be generated when this substitution is done.4040-4131config REGULATOR_FIXED_VOLTAGE4232 tristate "Fixed voltage regulator support"4333 help
+15-34
drivers/regulator/core.c
···5555static LIST_HEAD(regulator_ena_gpio_list);5656static LIST_HEAD(regulator_supply_alias_list);5757static bool has_full_constraints;5858-static bool board_wants_dummy_regulator;59586059static struct dentry *debugfs_root;6160···1302130313031304/* Internal regulator request function */13041305static struct regulator *_regulator_get(struct device *dev, const char *id,13051305- bool exclusive)13061306+ bool exclusive, bool allow_dummy)13061307{13071308 struct regulator_dev *rdev;13081309 struct regulator *regulator = ERR_PTR(-EPROBE_DEFER);13091310 const char *devname = NULL;13101310- int ret = 0;13111311+ int ret = -EPROBE_DEFER;1311131213121313 if (id == NULL) {13131314 pr_err("get() with no identifier\n");···13231324 if (rdev)13241325 goto found;1325132613271327+ regulator = ERR_PTR(ret);13281328+13261329 /*13271330 * If we have return value from dev_lookup fail, we do not expect to13281331 * succeed, so, quit with appropriate error value13291332 */13301330- if (ret) {13311331- regulator = ERR_PTR(ret);13331333+ if (ret && ret != -ENODEV) {13321334 goto out;13331335 }1334133613351335- if (board_wants_dummy_regulator) {13361336- rdev = dummy_regulator_rdev;13371337- goto found;13381338- }13391339-13401340-#ifdef CONFIG_REGULATOR_DUMMY13411337 if (!devname)13421338 devname = "deviceless";1343133913441344- /* If the board didn't flag that it was fully constrained then13451345- * substitute in a dummy regulator so consumers can continue.13401340+ /*13411341+ * Assume that a regulator is physically present and enabled13421342+ * even if it isn't hooked up and just provide a dummy.13461343 */13471347- if (!has_full_constraints) {13441344+ if (has_full_constraints && allow_dummy) {13481345 pr_warn("%s supply %s not found, using dummy regulator\n",13491346 devname, id);13471347+13501348 rdev = dummy_regulator_rdev;13511349 goto found;13501350+ } else {13511351+ dev_err(dev, "dummy supplies not allowed\n");13521352 }13531353-#endif1354135313551354 mutex_unlock(®ulator_list_mutex);13561355 return regulator;···14061409 */14071410struct regulator *regulator_get(struct device *dev, const char *id)14081411{14091409- return _regulator_get(dev, id, false);14121412+ return _regulator_get(dev, id, false, true);14101413}14111414EXPORT_SYMBOL_GPL(regulator_get);14121415···14331436 */14341437struct regulator *regulator_get_exclusive(struct device *dev, const char *id)14351438{14361436- return _regulator_get(dev, id, true);14391439+ return _regulator_get(dev, id, true, false);14371440}14381441EXPORT_SYMBOL_GPL(regulator_get_exclusive);14391442···14621465 */14631466struct regulator *regulator_get_optional(struct device *dev, const char *id)14641467{14651465- return _regulator_get(dev, id, 0);14681468+ return _regulator_get(dev, id, false, false);14661469}14671470EXPORT_SYMBOL_GPL(regulator_get_optional);14681471···36593662 has_full_constraints = 1;36603663}36613664EXPORT_SYMBOL_GPL(regulator_has_full_constraints);36623662-36633663-/**36643664- * regulator_use_dummy_regulator - Provide a dummy regulator when none is found36653665- *36663666- * Calling this function will cause the regulator API to provide a36673667- * dummy regulator to consumers if no physical regulator is found,36683668- * allowing most consumers to proceed as though a regulator were36693669- * configured. This allows systems such as those with software36703670- * controllable regulators for the CPU core only to be brought up more36713671- * readily.36723672- */36733673-void regulator_use_dummy_regulator(void)36743674-{36753675- board_wants_dummy_regulator = true;36763676-}36773677-EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);3678366536793666/**36803667 * rdev_get_drvdata - get rdev regulator driver data