Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1352884
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/5] regulator: pwm: Fix calculation of voltage-to-duty cycle |
| Date | 2016-03-08 12:10 +0100 |
| Message-ID | <ranGy-8tF-17@gated-at.bofh.it> (permalink) |
| References | <ranGx-8tF-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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> Cc: Lee Jones <lee.jones@linaro.org> --- drivers/regulator/pwm-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index 3aca067..4d8eb35 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -115,7 +115,7 @@ static int pwm_voltage_to_duty_cycle_percentage(struct regulator_dev *rdev, int int max_uV = rdev->constraints->max_uV; int diff = max_uV - min_uV; - return 100 - (((req_uV * 100) - (min_uV * 100)) / diff); + return ((req_uV * 100) - (min_uV * 100)) / diff; } static int pwm_regulator_get_voltage(struct regulator_dev *rdev) -- 2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] regulator: pwm: Add supports for multiple instance and voltage linear steps Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
[PATCH 2/5] regulator: pwm: Add support to have multiple instance of pwm regulator Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
[PATCH 3/5] regulator: pwm: Prints error number when it fails Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
Re: [PATCH 3/5] regulator: pwm: Prints error number when it fails Mark Brown <broonie@kernel.org> - 2016-03-13 09:40 +0100
Re: [PATCH 3/5] regulator: pwm: Prints error number when it fails Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-13 14:30 +0100
[PATCH 1/5] regulator: pwm: Fix calculation of voltage-to-duty cycle Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
[PATCH 5/5] regulator: pwm: Add DT binding details for Linear Equal Step Mode Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
Re: [PATCH 5/5] regulator: pwm: Add DT binding details for Linear Equal Step Mode Rob Herring <robh@kernel.org> - 2016-03-17 16:30 +0100
[PATCH 4/5] regulator: pwm: Add support for voltage linear equal steps Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-08 12:10 +0100
Re: [PATCH 4/5] regulator: pwm: Add support for voltage linear equal steps Mark Brown <broonie@kernel.org> - 2016-03-13 09:40 +0100
Re: [PATCH 4/5] regulator: pwm: Add support for voltage linear equal steps Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-13 14:20 +0100
Re: [PATCH 4/5] regulator: pwm: Add support for voltage linear equal steps Mark Brown <broonie@kernel.org> - 2016-03-14 17:30 +0100
Re: [PATCH 4/5] regulator: pwm: Add support for voltage linear equal steps Laxman Dewangan <ldewangan@nvidia.com> - 2016-03-15 08:00 +0100
csiph-web