aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-22 11:31:31 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-12-17 05:27:24 -0500
commit8f031b48cd2eab5fc3e4dffa06706372e90d63fe (patch)
tree3b5e2dca0134669925c31cb8bb011a41b773453c /drivers/regulator
parentaf5866c9cdc9e43ef775a14765fd8eab95c7fd20 (diff)
regulator: Display actual settings with constraints
When voltage or current constraints are either missing or specify a range display the actual setting along with the constraints if we can. This can aid debugging of configuration problems. 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.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1848a3f0980e..d3be67e18519 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -641,25 +641,43 @@ static void print_constraints(struct regulator_dev *rdev)
641{ 641{
642 struct regulation_constraints *constraints = rdev->constraints; 642 struct regulation_constraints *constraints = rdev->constraints;
643 char buf[80]; 643 char buf[80];
644 int count; 644 int count = 0;
645 int ret;
645 646
646 if (rdev->desc->type == REGULATOR_VOLTAGE) { 647 if (constraints->min_uV && constraints->max_uV) {
647 if (constraints->min_uV == constraints->max_uV) 648 if (constraints->min_uV == constraints->max_uV)
648 count = sprintf(buf, "%d mV ", 649 count += sprintf(buf + count, "%d mV ",
649 constraints->min_uV / 1000); 650 constraints->min_uV / 1000);
650 else 651 else
651 count = sprintf(buf, "%d <--> %d mV ", 652 count += sprintf(buf + count, "%d <--> %d mV ",
652 constraints->min_uV / 1000, 653 constraints->min_uV / 1000,
653 constraints->max_uV / 1000); 654 constraints->max_uV / 1000);
654 } else { 655 }
656
657 if (!constraints->min_uV ||
658 constraints->min_uV != constraints->max_uV) {
659 ret = _regulator_get_voltage(rdev);
660 if (ret > 0)
661 count += sprintf(buf + count, "at %d mV ", ret / 1000);
662 }
663
664 if (constraints->min_uA && constraints->max_uA) {
655 if (constraints->min_uA == constraints->max_uA) 665 if (constraints->min_uA == constraints->max_uA)
656 count = sprintf(buf, "%d mA ", 666 count += sprintf(buf + count, "%d mA ",
657 constraints->min_uA / 1000); 667 constraints->min_uA / 1000);
658 else 668 else
659 count = sprintf(buf, "%d <--> %d mA ", 669 count += sprintf(buf + count, "%d <--> %d mA ",
660 constraints->min_uA / 1000, 670 constraints->min_uA / 1000,
661 constraints->max_uA / 1000); 671 constraints->max_uA / 1000);
662 } 672 }
673
674 if (!constraints->min_uA ||
675 constraints->min_uA != constraints->max_uA) {
676 ret = _regulator_get_current_limit(rdev);
677 if (ret > 0)
678 count += sprintf(buf + count, "at %d uA ", ret / 1000);
679 }
680
663 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST) 681 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
664 count += sprintf(buf + count, "fast "); 682 count += sprintf(buf + count, "fast ");
665 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL) 683 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL)