regulator: twl: Fix checking voltage range in twl6030smps_set_voltage()
authorAxel Lin <axel.lin@gmail.com>
Sat, 14 Jul 2012 05:37:13 +0000 (13:37 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 28 Aug 2012 18:00:15 +0000 (11:00 -0700)
commit78292f4ed2aa9f92eb7bef1e0e1cea14b705e378
tree418e2cf9d1656f8fa2116ae60e68ecc18d94fe66
parent13407ea802ad8ca4e830cee344e2d38dbce730f5
regulator: twl: Fix checking voltage range in twl6030smps_set_voltage()

The voltage selection logic is supposed to find the samllest voltage falls
within specified range. When using equation to calculate vsel, we need to
ensure the requested min_uV meet the range of using the equation.
Otherwise we may select a voltage that is out of specified range.

For example, in the case vsel = 62 means select voltage of 2100000uV.
What we want is to ensure the requested min_uV <= 2100000 rather than checking
max_uV >= 2100000. And this also means in the case min_uV > 2100000, vsel = 62
does not meet the request.

Also calling twl6030smps_list_voltage() for all cases to ensure the selected
voltage still in bounds.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/twl-regulator.c