regulator: max8997: Use uV in voltage_map_desc
authorAxel Lin <axel.lin@ingics.com>
Fri, 28 Dec 2012 09:09:03 +0000 (17:09 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 6 Feb 2013 04:33:26 +0000 (04:33 +0000)
commit31980f8fa9e57f23b301e91dfa79f7f5c517233d
treeffba695b8088f16a51c134220822f30f67982d45
parent41e52c46717b0120d247d04d330f16d1501d357d
regulator: max8997: Use uV in voltage_map_desc

commit bc3b7756b5ff66828acf7bc24f148d28b8d61108 upstream.

Current code does integer division (min_vol = min_uV / 1000) before pass
min_vol to max8997_get_voltage_proper_val().
So it is possible min_vol is truncated to a smaller value.

For example, if the request min_uV is 800900 for ldo.
min_vol = 800900 / 1000 = 800 (mV)
Then max8997_get_voltage_proper_val returns 800 mV for this case which is lower
than the requested voltage.

Use uV rather than mV in voltage_map_desc to prevent truncation by integer
division.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
[bwh: Backported to 3.2:
 - Adjust context
 - voltage_map_desc also has an n_bits field]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/regulator/max8997.c