aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-04-26 10:18:14 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-05-25 05:16:01 -0400
commit0178f3e28e2166664916265c5d4922b1376b9fa1 (patch)
tree00dbd793ed75ad98e8d32a5798ab243c0f5b4185 /drivers/regulator
parent7e125f7b9cbfce4101191b8076d606c517a73066 (diff)
regulator: Allow regulator-regulator supplies to be specified by name
When one regulator supplies another allow the relationship to be specified using names rather than struct regulators, in a similar manner to that allowed for consumer supplies. This allows static configuration at compile time, reducing the need for dynamic init code. Also change the references to LINE supply to be system supply since line is sometimes used for actual supplies and therefore potentially confusing. 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/core.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 51cf2bb37438..eb112d961515 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2328,7 +2328,37 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
2328 goto scrub; 2328 goto scrub;
2329 2329
2330 /* set supply regulator if it exists */ 2330 /* set supply regulator if it exists */
2331 if (init_data->supply_regulator && init_data->supply_regulator_dev) {
2332 dev_err(dev,
2333 "Supply regulator specified by both name and dev\n");
2334 goto scrub;
2335 }
2336
2337 if (init_data->supply_regulator) {
2338 struct regulator_dev *r;
2339 int found = 0;
2340
2341 list_for_each_entry(r, &regulator_list, list) {
2342 if (strcmp(rdev_get_name(r),
2343 init_data->supply_regulator) == 0) {
2344 found = 1;
2345 break;
2346 }
2347 }
2348
2349 if (!found) {
2350 dev_err(dev, "Failed to find supply %s\n",
2351 init_data->supply_regulator);
2352 goto scrub;
2353 }
2354
2355 ret = set_supply(rdev, r);
2356 if (ret < 0)
2357 goto scrub;
2358 }
2359
2331 if (init_data->supply_regulator_dev) { 2360 if (init_data->supply_regulator_dev) {
2361 dev_warn(dev, "Uses supply_regulator_dev instead of regulator_supply\n");
2332 ret = set_supply(rdev, 2362 ret = set_supply(rdev,
2333 dev_get_drvdata(init_data->supply_regulator_dev)); 2363 dev_get_drvdata(init_data->supply_regulator_dev));
2334 if (ret < 0) 2364 if (ret < 0)