mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
regulator: add verbose error messages for invalid voltage requests
Add error messages into the regulator_check_voltage() and regulator_check_consumers() functions which explain exactly what is not correct about given voltage requests. This makes debugging regulator_set_voltage() errors easier. Change-Id: I8b3ec8d6a78c94b436b57bd2228b8bd5c362cecd Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
df8ac4a79d
commit
85a85aada0
1 changed files with 17 additions and 0 deletions
|
|
@ -431,6 +431,15 @@ int regulator_check_voltage(struct regulator_dev *rdev,
|
|||
return -EPERM;
|
||||
}
|
||||
|
||||
/* check if requested voltage range actually overlaps the constraints */
|
||||
if (*max_uV < rdev->constraints->min_uV ||
|
||||
*min_uV > rdev->constraints->max_uV) {
|
||||
rdev_err(rdev, "requested voltage range [%d, %d] does not fit within constraints: [%d, %d]\n",
|
||||
*min_uV, *max_uV, rdev->constraints->min_uV,
|
||||
rdev->constraints->max_uV);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (*max_uV > rdev->constraints->max_uV)
|
||||
*max_uV = rdev->constraints->max_uV;
|
||||
if (*min_uV < rdev->constraints->min_uV)
|
||||
|
|
@ -460,6 +469,8 @@ int regulator_check_consumers(struct regulator_dev *rdev,
|
|||
{
|
||||
struct regulator *regulator;
|
||||
struct regulator_voltage *voltage;
|
||||
int init_min_uV = *min_uV;
|
||||
int init_max_uV = *max_uV;
|
||||
|
||||
list_for_each_entry(regulator, &rdev->consumer_list, list) {
|
||||
voltage = ®ulator->voltage[state];
|
||||
|
|
@ -470,6 +481,12 @@ int regulator_check_consumers(struct regulator_dev *rdev,
|
|||
if (!voltage->min_uV && !voltage->max_uV)
|
||||
continue;
|
||||
|
||||
if (init_max_uV < voltage->min_uV
|
||||
|| init_min_uV > voltage->max_uV)
|
||||
rdev_err(rdev, "requested voltage range [%d, %d] does not fit within previously voted range: [%d, %d]\n",
|
||||
init_min_uV, init_max_uV, voltage->min_uV,
|
||||
voltage->max_uV);
|
||||
|
||||
if (*max_uV > voltage->max_uV)
|
||||
*max_uV = voltage->max_uV;
|
||||
if (*min_uV < voltage->min_uV)
|
||||
|
|
|
|||
Loading…
Reference in a new issue