aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-11-30 03:52:49 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-02 10:15:14 -0500
commitdbc705183a41f8ae209673fbc555d9923b0ebb7f (patch)
tree93e02c1afdc94cce0e0cb71918e7ac6699e19573 /drivers/regulator
parent9997f3ffbbcde01bcd5966eeb26bc41243715021 (diff)
regulator: tps51632: Ensure [base|max]_voltage_uV pdata settings are valid
If pdata->base_voltage_uV is missing or the settings of pdata->base_voltage_uV and pdata->max_voltage_uV are out of range, TPS51632_VOLT_VSEL macro returns wrong vsel. Thus add checking [base|max]_voltage_uV pdata settings in probe. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps51632-regulator.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index e88bfe48303a..dc7023ebea87 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -242,6 +242,21 @@ static int __devinit tps51632_probe(struct i2c_client *client,
242 return -EINVAL; 242 return -EINVAL;
243 } 243 }
244 244
245 if (pdata->enable_pwm_dvfs) {
246 if ((pdata->base_voltage_uV < TPS51632_MIN_VOLATGE) ||
247 (pdata->base_voltage_uV > TPS51632_MAX_VOLATGE)) {
248 dev_err(&client->dev, "Invalid base_voltage_uV setting\n");
249 return -EINVAL;
250 }
251
252 if ((pdata->max_voltage_uV) &&
253 ((pdata->max_voltage_uV < TPS51632_MIN_VOLATGE) ||
254 (pdata->max_voltage_uV > TPS51632_MAX_VOLATGE))) {
255 dev_err(&client->dev, "Invalid max_voltage_uV setting\n");
256 return -EINVAL;
257 }
258 }
259
245 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); 260 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
246 if (!tps) { 261 if (!tps) {
247 dev_err(&client->dev, "Memory allocation failed\n"); 262 dev_err(&client->dev, "Memory allocation failed\n");