aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-09-09 11:21:19 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2008-10-13 16:51:51 -0400
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,
669 struct regulation_constraints *constraints) 669 struct regulation_constraints *constraints)
670{ 670{
671 int ret = 0; 671 int ret = 0;
672 const char *name;
673
674 if (constraints->name)
675 name = constraints->name;
676 else if (rdev->desc->name)
677 name = rdev->desc->name;
678 else
679 name = "regulator";
672 680
673 rdev->constraints = constraints; 681 rdev->constraints = constraints;
674 682
@@ -679,9 +687,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
679 ret = rdev->desc->ops->set_voltage(rdev, 687 ret = rdev->desc->ops->set_voltage(rdev,
680 rdev->constraints->min_uV, rdev->constraints->max_uV); 688 rdev->constraints->min_uV, rdev->constraints->max_uV);
681 if (ret < 0) { 689 if (ret < 0) {
682 printk(KERN_ERR "%s: failed to apply %duV" 690 printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
683 " constraint\n", __func__, 691 __func__,
684 rdev->constraints->min_uV); 692 rdev->constraints->min_uV, name);
685 rdev->constraints = NULL; 693 rdev->constraints = NULL;
686 goto out; 694 goto out;
687 } 695 }
@@ -692,8 +700,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
692 rdev->use_count = 1; 700 rdev->use_count = 1;
693 701
694 /* do we need to setup our suspend state */ 702 /* do we need to setup our suspend state */
695 if (constraints->initial_state) 703 if (constraints->initial_state) {
696 ret = suspend_prepare(rdev, constraints->initial_state); 704 ret = suspend_prepare(rdev, constraints->initial_state);
705 if (ret < 0) {
706 printk(KERN_ERR "%s: failed to set suspend state for %s\n",
707 __func__, name);
708 rdev->constraints = NULL;
709 goto out;
710 }
711 }
697 712
698 print_constraints(rdev); 713 print_constraints(rdev);
699out: 714out: