]> git.karo-electronics.de Git - karo-tx-linux.git/commit
regulator: pfuze100: Fix n_voltages setting for SW2~SW4 with high bit set
authorAxel Lin <axel.lin@ingics.com>
Tue, 30 Jul 2013 02:46:28 +0000 (10:46 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:54:17 +0000 (09:54 +0800)
commit9167981760ad9c42d4db4b1ec64c9a4b207a6126
tree08dc53f7693029522822762815d4dc8b8622c046
parent80b1d35c0cd10cb6e5a93afe02fd5667eb410c84
regulator: pfuze100: Fix n_voltages setting for SW2~SW4 with high bit set

Current code adjust min_uV and uV_step but missed adjusting the n_voltages
setting.

When BIT6 is clear:
        n_voltages = (1975000 - 400000) / 25000 + 1 = 64
When BIT6 is set:
        n_voltages = (3300000 - 800000) / 50000 + 1 = 51

The n_voltages needs update because when BIT6 is set 0x73 ~ 0x7f are reserved.
When using regulator_list_voltage_linear, the n_voltages does matter here
because wrong n_voltages setting make the equation return wrong result.
e.g. if selector is 63, regulator_list_voltage_linear returns
     800000 + (50000 * 63) = 4000000
     It should return -EINVAL if the selector is in the range of 51 ~ 63.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/pfuze100-regulator.c