summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Lavnikevich <d.lavnikevich@sam-solutions.net>2012-12-28 14:40:57 +0300
committerJustin Waters <justin.waters@timesys.com>2013-11-07 12:19:19 -0500
commitb08d4a249fdef0e4b336297b820255a8c6acf77f (patch)
tree3c8eeacacc43189d506257ffd049142ec1f13210 /drivers
parent4f97a0ea5acfefb7e02e770821f69c8bdef09621 (diff)
Integrate Dialog DA9063 PMIC support for phyFLEX modules with revision later than 1362.1
Conflicts: arch/arm/mach-mx6/Makefile Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c9
-rw-r--r--drivers/regulator/da9063-regulator.c3
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 54473547b233..c52051af5db2 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1763,9 +1763,16 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
*/
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
{
- struct regulator_dev *rdev = regulator->rdev;
+ struct regulator_dev *rdev = NULL;
int ret = 0;
+ if (NULL == regulator) {
+ printk(KERN_ERR "%s: regulator is NULL\n", __func__);
+ return 0;
+ }
+
+ rdev = regulator->rdev;
+
mutex_lock(&rdev->mutex);
/* If we're setting the same range as last time the change
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 84befe01ece9..3eba4488c4fd 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -584,7 +584,8 @@ static int da9063_set_voltage(struct regulator_dev *rdev,
unsigned sel = da9063_min_val_to_sel(min_uV, regl->info->min_uV,
regl->info->step_uV);
- if (da9063_sel_to_vol(regl, sel) > max_uV)
+ // ToDo: Fix voltage correction range, now enlarge to 1 step to be shure, that we in corretc range
+ if (da9063_sel_to_vol(regl, sel) > (max_uV + regl->info->step_uV))
return -EINVAL;
val = (sel + fvol->offset) << fvol->shift & fvol->mask;