]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: pwm: Fix calculation of voltage-to-duty cycle
authorLaxman Dewangan <ldewangan@nvidia.com>
Tue, 8 Mar 2016 10:53:21 +0000 (16:23 +0530)
committerMark Brown <broonie@kernel.org>
Sat, 12 Mar 2016 06:07:09 +0000 (13:07 +0700)
commita241cd953ae3ea0948eb994fe91b7d08bca6606e
tree3bfb7728506b912b19b84c5d5c4d4bfa5445dd3f
parentd7e15052ecc9ac4f938d1d7432c1d120a2711a7e
regulator: pwm: Fix calculation of voltage-to-duty cycle

With following equation for calculating
voltage_to_duty_cycle_percentage
100 - (((req_uV * 100) - (min_uV * 100)) / diff);

we get 0% for max_uV and 100% for min_uV.

Correcting this to
((req_uV * 100) - (min_uV * 100)) / diff;
 to get proper duty cycle.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/pwm-regulator.c