提交 e06f5b4f 编写于 作者: M Mark Brown 提交者: Liam Girdwood

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: NMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: NLiam Girdwood <lrg@slimlogic.co.uk>
上级 46fabe1e
...@@ -669,6 +669,14 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -669,6 +669,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
struct regulation_constraints *constraints) struct regulation_constraints *constraints)
{ {
int ret = 0; 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; rdev->constraints = constraints;
...@@ -679,9 +687,9 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -679,9 +687,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,
ret = rdev->desc->ops->set_voltage(rdev, ret = rdev->desc->ops->set_voltage(rdev,
rdev->constraints->min_uV, rdev->constraints->max_uV); rdev->constraints->min_uV, rdev->constraints->max_uV);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "%s: failed to apply %duV" printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
" constraint\n", __func__, __func__,
rdev->constraints->min_uV); rdev->constraints->min_uV, name);
rdev->constraints = NULL; rdev->constraints = NULL;
goto out; goto out;
} }
...@@ -692,8 +700,15 @@ static int set_machine_constraints(struct regulator_dev *rdev, ...@@ -692,8 +700,15 @@ static int set_machine_constraints(struct regulator_dev *rdev,
rdev->use_count = 1; rdev->use_count = 1;
/* do we need to setup our suspend state */ /* do we need to setup our suspend state */
if (constraints->initial_state) if (constraints->initial_state) {
ret = suspend_prepare(rdev, 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); print_constraints(rdev);
out: out:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册