Re: [PATCH V3 2/4] pwm: tegra: Increase precision in pwm rate calculation

2017-04-12 Thread Thierry Reding
On Fri, Apr 07, 2017 at 03:04:00PM +0530, Laxman Dewangan wrote: > The rate of the PWM calculated as follows: > hz = NSEC_PER_SEC / period_ns; > rate = (rate + (hz / 2)) / hz; > > This has the precision loss in lower PWM rate. > > Change this to have more precision as: > hz =

Re: [PATCH V3 2/4] pwm: tegra: Increase precision in pwm rate calculation

2017-04-12 Thread Thierry Reding
On Fri, Apr 07, 2017 at 03:04:00PM +0530, Laxman Dewangan wrote: > The rate of the PWM calculated as follows: > hz = NSEC_PER_SEC / period_ns; > rate = (rate + (hz / 2)) / hz; > > This has the precision loss in lower PWM rate. > > Change this to have more precision as: > hz =

[PATCH V3 2/4] pwm: tegra: Increase precision in pwm rate calculation

2017-04-07 Thread Laxman Dewangan
The rate of the PWM calculated as follows: hz = NSEC_PER_SEC / period_ns; rate = (rate + (hz / 2)) / hz; This has the precision loss in lower PWM rate. Change this to have more precision as: hz = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC * 100, period_ns); rate =

[PATCH V3 2/4] pwm: tegra: Increase precision in pwm rate calculation

2017-04-07 Thread Laxman Dewangan
The rate of the PWM calculated as follows: hz = NSEC_PER_SEC / period_ns; rate = (rate + (hz / 2)) / hz; This has the precision loss in lower PWM rate. Change this to have more precision as: hz = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC * 100, period_ns); rate =