[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1354265569.3859.1.camel@phoenix>
Date: Fri, 30 Nov 2012 16:52:49 +0800
From: Axel Lin <axel.lin@...ics.com>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Laxman Dewangan <ldewangan@...dia.com>, Liam Girdwood <lrg@...com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...ics.com>
---
drivers/regulator/tps51632-regulator.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index 523b1e5..ab21133 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -236,6 +236,21 @@ static int tps51632_probe(struct i2c_client *client,
return -EINVAL;
}
+ if (pdata->enable_pwm_dvfs) {
+ if ((pdata->base_voltage_uV < TPS51632_MIN_VOLATGE) ||
+ (pdata->base_voltage_uV > TPS51632_MAX_VOLATGE)) {
+ dev_err(&client->dev, "Invalid base_voltage_uV setting\n");
+ return -EINVAL;
+ }
+
+ if ((pdata->max_voltage_uV) &&
+ ((pdata->max_voltage_uV < TPS51632_MIN_VOLATGE) ||
+ (pdata->max_voltage_uV > TPS51632_MAX_VOLATGE))) {
+ dev_err(&client->dev, "Invalid max_voltage_uV setting\n");
+ return -EINVAL;
+ }
+ }
+
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
if (!tps) {
dev_err(&client->dev, "Memory allocation failed\n");
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists