Re: [PATCH v2 3/3] pwm: meson: improve pwm calculation precision.

2017-07-07 Thread Jerome Brunet
On Thu, 2017-07-06 at 23:21 +0200, Thierry Reding wrote: > On Thu, Jun 08, 2017 at 02:24:16PM +0200, Jerome Brunet wrote: > > When using input clocks with high rates, such as clk81 (166MHz), the > > fin_ns = NSEC_PER_SEC / fin_freq can introduce a significant error. > > > > Ex: fin_freq = 1666

Re: [PATCH v2 3/3] pwm: meson: improve pwm calculation precision.

2017-07-06 Thread Thierry Reding
On Thu, Jun 08, 2017 at 02:24:16PM +0200, Jerome Brunet wrote: > When using input clocks with high rates, such as clk81 (166MHz), the > fin_ns = NSEC_PER_SEC / fin_freq can introduce a significant error. > > Ex: fin_freq = 16667, NSEC_PER_SEC = 10 > fin_ns = 5,999 > > which is

Re: [PATCH v2 3/3] pwm: meson: improve pwm calculation precision.

2017-06-08 Thread Neil Armstrong
On 06/08/2017 02:24 PM, Jerome Brunet wrote: > When using input clocks with high rates, such as clk81 (166MHz), the > fin_ns = NSEC_PER_SEC / fin_freq can introduce a significant error. > > Ex: fin_freq = 16667, NSEC_PER_SEC = 10 > fin_ns = 5,999 > > which is, of course, round

[PATCH v2 3/3] pwm: meson: improve pwm calculation precision.

2017-06-08 Thread Jerome Brunet
When using input clocks with high rates, such as clk81 (166MHz), the fin_ns = NSEC_PER_SEC / fin_freq can introduce a significant error. Ex: fin_freq = 16667, NSEC_PER_SEC = 10 fin_ns = 5,999 which is, of course, rounded down to 5. This introduce an error of ~20% on the period