regulator: da9055: Properly handle voltage range that doesn't start with 0 offset
authorAxel Lin <axel.lin@ingics.com>
Tue, 20 Nov 2012 07:36:46 +0000 (15:36 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 21 Nov 2012 09:50:52 +0000 (18:50 +0900)
commit369cf602f364a60c72b8258c21eca8793939328f
tree73e3c2fea5a99ac844e82e70ad214bb084db1fa1
parent26cbd3073394b966654294c8cb9cb2fec870c567
regulator: da9055: Properly handle voltage range that doesn't start with 0 offset

This patch implements map_voltage and list_voltage callbacks to properly handle
the case voltage range that doesn't start with 0 offset.

Now we adjust the selector in map_voltage() before calling set_voltage_sel().
And return 0 in list_voltage() for invalid selectors.

With above change, we can remove da9055_regulator_set_voltage_bits function.

One tricky part is that we need adding voffset to n_voltages.
Although for the cases "selector < voffset" are invalid, we need add voffset to
n_voltage so regulator_list_voltage() won't fail while checking the boundary for
selector before calling list_voltage callback.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Ashish Jangam <ashish.jangam@kpitcummins.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/da9055-regulator.c
This page took 0.024204 seconds and 5 git commands to generate.