aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-07-11 22:20:37 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2011-07-22 06:43:00 -0400
commit89f425ed5bf3d4fd97e840296dccd75b8e0fe4c9 (patch)
tree16d384fbeadbeba18685803588a459c0db415a58 /drivers/regulator
parent39aa9b6e3cb1b2a564d3422eedb7f725179162d3 (diff)
regulator: Make core more chatty about some errors
Prevent some head scratching by making the core log about some rare but possible errors with invalid voltage ranges and modes being set. 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.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f59821f10fd..3700d0953d7 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -151,8 +151,11 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
151 if (*min_uV < rdev->constraints->min_uV) 151 if (*min_uV < rdev->constraints->min_uV)
152 *min_uV = rdev->constraints->min_uV; 152 *min_uV = rdev->constraints->min_uV;
153 153
154 if (*min_uV > *max_uV) 154 if (*min_uV > *max_uV) {
155 rdev_err(rdev, "unsupportable voltage range: %d-%duV\n",
156 min_uV, max_uV);
155 return -EINVAL; 157 return -EINVAL;
158 }
156 159
157 return 0; 160 return 0;
158} 161}
@@ -205,8 +208,11 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
205 if (*min_uA < rdev->constraints->min_uA) 208 if (*min_uA < rdev->constraints->min_uA)
206 *min_uA = rdev->constraints->min_uA; 209 *min_uA = rdev->constraints->min_uA;
207 210
208 if (*min_uA > *max_uA) 211 if (*min_uA > *max_uA) {
212 rdev_err(rdev, "unsupportable current range: %d-%duA\n",
213 min_uA, max_uA);
209 return -EINVAL; 214 return -EINVAL;
215 }
210 216
211 return 0; 217 return 0;
212} 218}
@@ -221,6 +227,7 @@ static int regulator_mode_constrain(struct regulator_dev *rdev, int *mode)
221 case REGULATOR_MODE_STANDBY: 227 case REGULATOR_MODE_STANDBY:
222 break; 228 break;
223 default: 229 default:
230 rdev_err(rdev, "invalid mode %x specified\n", *mode);
224 return -EINVAL; 231 return -EINVAL;
225 } 232 }
226 233