Axel Lin 7a4beda0c6 regulator: as3711: Fix the logic in as3711_sel_check
Below equation means the "voltage" is the "smallest" voltage within specific
range.

ret = DIV_ROUND_UP(min - bottom) / step;
voltage = ret * step + bottom;

If we do try 1 down when (voltage > max), new voltage is then less than min
voltage. Which means the new voltage is not in the requested voltage range.

This patch also includes below cleanups:
- Use DIV_ROUND_UP
- rename variable 'ret' to 'sel' for better readability because as3711_sel_check
  returns the selector.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:25:18 +00:00
..
2012-10-15 14:45:51 -04:00
2012-10-07 20:55:16 +09:00
2012-11-13 22:27:19 +01:00
2012-09-26 22:28:21 -04:00
2012-10-24 16:58:53 +02:00
2012-10-07 17:29:24 +09:00
2012-10-10 20:15:24 +09:00
2012-10-17 15:53:03 -05:00
2012-10-09 16:11:46 +09:00
2012-10-10 20:15:24 +09:00
2012-11-16 14:33:04 -08:00
2012-10-28 11:13:54 -07:00
2012-11-16 07:47:18 -08:00
2012-11-02 13:26:11 -07:00
2012-10-01 12:09:59 -07:00
2012-11-10 06:56:21 +01:00
2012-10-01 18:46:13 -07:00
2012-10-16 18:07:12 -07:00