Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-25 Thread Clemens Gruber
On Fri, Jan 20, 2017 at 07:39:07AM +0100, Thierry Reding wrote: > On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > > Let's go with this one. I'll spin up a v2 where I calculate the > > period_ns value from the current prescaler value in the probe function. > > This effectively

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-25 Thread Clemens Gruber
On Fri, Jan 20, 2017 at 07:39:07AM +0100, Thierry Reding wrote: > On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > > Let's go with this one. I'll spin up a v2 where I calculate the > > period_ns value from the current prescaler value in the probe function. > > This effectively

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-20 Thread Andy Shevchenko
On Fri, 2017-01-20 at 07:39 +0100, Thierry Reding wrote: > On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > > > Combining with your proposal I would see the best approach is to > > > set > > > pca->period_ns

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-20 Thread Andy Shevchenko
On Fri, 2017-01-20 at 07:39 +0100, Thierry Reding wrote: > On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > > > Combining with your proposal I would see the best approach is to > > > set > > > pca->period_ns

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Thierry Reding
On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > > Combining with your proposal I would see the best approach is to set > > pca->period_ns accordingly to current prescaler value if you want to. > > Yes, I agree. >

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Thierry Reding
On Thu, Jan 19, 2017 at 05:52:10PM +0100, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > > Combining with your proposal I would see the best approach is to set > > pca->period_ns accordingly to current prescaler value if you want to. > > Yes, I agree. >

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Thu, Jan 19, 2017 at 6:52 PM, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: >> So, summarize, I prefer (in order of preference from high to low): >> - enforce default prescaler value based on default period (it's just one

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Thu, Jan 19, 2017 at 6:52 PM, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: >> So, summarize, I prefer (in order of preference from high to low): >> - enforce default prescaler value based on default period (it's just one >> line to write a register)

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Clemens Gruber
On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > Combining with your proposal I would see the best approach is to set > pca->period_ns accordingly to current prescaler value if you want to. Yes, I agree. > In your patch I see no benefit, since it's quite unlikely user will want

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Clemens Gruber
On Thu, Jan 19, 2017 at 06:10:08PM +0200, Andy Shevchenko wrote: > Combining with your proposal I would see the best approach is to set > pca->period_ns accordingly to current prescaler value if you want to. Yes, I agree. > In your patch I see no benefit, since it's quite unlikely user will want

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Thu, 2017-01-19 at 15:49 +0100, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 02:34:39PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > > > Yes, that's what this patch tries to solve by verifying that the > > > external setting (the prescale

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Thu, 2017-01-19 at 15:49 +0100, Clemens Gruber wrote: > On Thu, Jan 19, 2017 at 02:34:39PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > > > Yes, that's what this patch tries to solve by verifying that the > > > external setting (the prescale

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Clemens Gruber
On Thu, Jan 19, 2017 at 02:34:39PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > > Yes, that's what this patch tries to solve by verifying that the > > external setting (the prescale register) is set to its hardware > > default > > value of 0x1E

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Clemens Gruber
On Thu, Jan 19, 2017 at 02:34:39PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > > Yes, that's what this patch tries to solve by verifying that the > > external setting (the prescale register) is set to its hardware > > default > > value of 0x1E

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > On Wed, Jan 18, 2017 at 04:01:58PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > > > Yes, but the period could be different, maybe modified in the > > > bootloader > > > or at a previous boot

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-19 Thread Andy Shevchenko
On Wed, 2017-01-18 at 15:25 +0100, Clemens Gruber wrote: > On Wed, Jan 18, 2017 at 04:01:58PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > > > Yes, but the period could be different, maybe modified in the > > > bootloader > > > or at a previous boot

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Clemens Gruber
On Wed, Jan 18, 2017 at 04:01:58PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > > Yes, but the period could be different, maybe modified in the > > bootloader > > or at a previous boot without hardware reset in between. (We do not > > send > > a SWRST

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Clemens Gruber
On Wed, Jan 18, 2017 at 04:01:58PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > > Yes, but the period could be different, maybe modified in the > > bootloader > > or at a previous boot without hardware reset in between. (We do not > > send > > a SWRST

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Andy Shevchenko
On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > On Wed, Jan 18, 2017 at 01:09:24PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > > > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > > > Until now, we assumed that the

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Andy Shevchenko
On Wed, 2017-01-18 at 14:53 +0100, Clemens Gruber wrote: > On Wed, Jan 18, 2017 at 01:09:24PM +0200, Andy Shevchenko wrote: > > On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > > > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > > > Until now, we assumed that the

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Clemens Gruber
On Wed, Jan 18, 2017 at 01:09:24PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > > Until now, we assumed that the period is the hardware default of > > > 1/200Hz > > > at probe time,

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Clemens Gruber
On Wed, Jan 18, 2017 at 01:09:24PM +0200, Andy Shevchenko wrote: > On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > > Until now, we assumed that the period is the hardware default of > > > 1/200Hz > > > at probe time,

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Andy Shevchenko
On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > Until now, we assumed that the period is the hardware default of > > 1/200Hz > > at probe time, but if the period was changed and the user reboots, > > this > > assumption

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Andy Shevchenko
On Wed, 2017-01-18 at 11:57 +0100, Thierry Reding wrote: > On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > > Until now, we assumed that the period is the hardware default of > > 1/200Hz > > at probe time, but if the period was changed and the user reboots, > > this > > assumption

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Thierry Reding
On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > Until now, we assumed that the period is the hardware default of 1/200Hz > at probe time, but if the period was changed and the user reboots, this > assumption is wrong. > > Solution: Check if the prescaler is set to the hardware

Re: [PATCH 2/2] pwm: pca9685: fix prescaler initialization

2017-01-18 Thread Thierry Reding
On Tue, Dec 13, 2016 at 04:52:51PM +0100, Clemens Gruber wrote: > Until now, we assumed that the period is the hardware default of 1/200Hz > at probe time, but if the period was changed and the user reboots, this > assumption is wrong. > > Solution: Check if the prescaler is set to the hardware

[PATCH 2/2] pwm: pca9685: fix prescaler initialization

2016-12-13 Thread Clemens Gruber
Until now, we assumed that the period is the hardware default of 1/200Hz at probe time, but if the period was changed and the user reboots, this assumption is wrong. Solution: Check if the prescaler is set to the hardware default. If not, reprogram the prescaler at first configuration. Cc:

[PATCH 2/2] pwm: pca9685: fix prescaler initialization

2016-12-13 Thread Clemens Gruber
Until now, we assumed that the period is the hardware default of 1/200Hz at probe time, but if the period was changed and the user reboots, this assumption is wrong. Solution: Check if the prescaler is set to the hardware default. If not, reprogram the prescaler at first configuration. Cc: #