summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-09-09 16:21:19 +0100
committerLiam Girdwood <lrg@slimlogic.co.uk>2008-10-13 21:51:51 +0100
commite06f5b4fea243b152c79fe5d9552a852069de483 (patch)
tree6c245bd909d03f36de170c1a5ae31bdb321da0b4 /drivers/regulator
parent46fabe1edd44a8893d88d7982f88d01ccf77f0bb (diff)
regulator: Additional diagnostics for machine constraints
Try to find a human readable name for the regulator we're failing on and print a specific diagnostic when we fail to set the suspend state. 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.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 65e07b941a36..04408896705e 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -669,6 +669,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
struct regulation_constraints *constraints)
{
int ret = 0;
+ const char *name;
+
+ if (constraints->name)
+ name = constraints->name;
+ else if (rdev->desc->name)
+ name = rdev->desc->name;
+ else
+ name = "regulator";
rdev->constraints = constraints;
@@ -679,9 +687,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
ret = rdev->desc->ops->set_voltage(rdev,
rdev->constraints->min_uV, rdev->constraints->max_uV);
if (ret < 0) {
- printk(KERN_ERR "%s: failed to apply %duV"
- " constraint\n", __func__,
- rdev->constraints->min_uV);
+ printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
+ __func__,
+ rdev->constraints->min_uV, name);
rdev->constraints = NULL;
goto out;
}
@@ -692,8 +700,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
rdev->use_count = 1;
/* do we need to setup our suspend state */
- if (constraints->initial_state)
+ if (constraints->initial_state) {
ret = suspend_prepare(rdev, constraints->initial_state);
+ if (ret < 0) {
+ printk(KERN_ERR "%s: failed to set suspend state for %s\n",
+ __func__, name);
+ rdev->constraints = NULL;
+ goto out;
+ }
+ }
print_constraints(rdev);
out: