diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 04408896705e..9a6757decd3d 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -670,6 +670,7 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
670 | { | 670 | { |
671 | int ret = 0; | 671 | int ret = 0; |
672 | const char *name; | 672 | const char *name; |
673 | struct regulator_ops *ops = rdev->desc->ops; | ||
673 | 674 | ||
674 | if (constraints->name) | 675 | if (constraints->name) |
675 | name = constraints->name; | 676 | name = constraints->name; |
@@ -683,8 +684,8 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
683 | /* do we need to apply the constraint voltage */ | 684 | /* do we need to apply the constraint voltage */ |
684 | if (rdev->constraints->apply_uV && | 685 | if (rdev->constraints->apply_uV && |
685 | rdev->constraints->min_uV == rdev->constraints->max_uV && | 686 | rdev->constraints->min_uV == rdev->constraints->max_uV && |
686 | rdev->desc->ops->set_voltage) { | 687 | ops->set_voltage) { |
687 | ret = rdev->desc->ops->set_voltage(rdev, | 688 | ret = ops->set_voltage(rdev, |
688 | rdev->constraints->min_uV, rdev->constraints->max_uV); | 689 | rdev->constraints->min_uV, rdev->constraints->max_uV); |
689 | if (ret < 0) { | 690 | if (ret < 0) { |
690 | printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n", | 691 | printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n", |
@@ -710,6 +711,20 @@ static int set_machine_constraints(struct regulator_dev *rdev, | |||
710 | } | 711 | } |
711 | } | 712 | } |
712 | 713 | ||
714 | /* if always_on is set then turn the regulator on if it's not | ||
715 | * already on. */ | ||
716 | if (constraints->always_on && ops->enable && | ||
717 | ((ops->is_enabled && !ops->is_enabled(rdev)) || | ||
718 | (!ops->is_enabled && !constraints->boot_on))) { | ||
719 | ret = ops->enable(rdev); | ||
720 | if (ret < 0) { | ||
721 | printk(KERN_ERR "%s: failed to enable %s\n", | ||
722 | __func__, name); | ||
723 | rdev->constraints = NULL; | ||
724 | goto out; | ||
725 | } | ||
726 | } | ||
727 | |||
713 | print_constraints(rdev); | 728 | print_constraints(rdev); |
714 | out: | 729 | out: |
715 | return ret; | 730 | return ret; |