diff mbox

pwm: atmel-hlcdc: Fix default PWM polarity

Message ID 1463476352-7485-1-git-send-email-boris.brezillon@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris BREZILLON May 17, 2016, 9:12 a.m. UTC
The PWM device exposed by the HLCDC IP is configured with an inverted
polarity by default. Registering the PWM chip with the normal polarity
was not a problem before commit 42e8992c58d4 ("pwm: Add core
infrastructure to allow atomic updates") because the ->set_polarity()
hook was called no matter the current polarity state, but this is no longer
the case.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 42e8992c58d4 ("pwm: Add core infrastructure to allow atomic updates")
---
 drivers/pwm/pwm-atmel-hlcdc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thierry Reding May 17, 2016, 11 a.m. UTC | #1
On Tue, May 17, 2016 at 11:12:32AM +0200, Boris Brezillon wrote:
> The PWM device exposed by the HLCDC IP is configured with an inverted
> polarity by default. Registering the PWM chip with the normal polarity
> was not a problem before commit 42e8992c58d4 ("pwm: Add core
> infrastructure to allow atomic updates") because the ->set_polarity()
> hook was called no matter the current polarity state, but this is no longer
> the case.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes: 42e8992c58d4 ("pwm: Add core infrastructure to allow atomic updates")

That's not technically correct, because it's the driver that has the
bug. The core change merely exposes it. How about if I sort this into
the pwm-atomic branch and reword the commit message accordingly? That
way things should all stay bisectible.

Then again, given the breakage caused by the pwm_args patch I suppose
it doesn't matter much because that's part of a stable branch that I
can't rebase.

Thierry
Boris BREZILLON May 17, 2016, 11:04 a.m. UTC | #2
On Tue, 17 May 2016 13:00:05 +0200
Thierry Reding <thierry.reding@gmail.com> wrote:

> On Tue, May 17, 2016 at 11:12:32AM +0200, Boris Brezillon wrote:
> > The PWM device exposed by the HLCDC IP is configured with an inverted
> > polarity by default. Registering the PWM chip with the normal polarity
> > was not a problem before commit 42e8992c58d4 ("pwm: Add core
> > infrastructure to allow atomic updates") because the ->set_polarity()
> > hook was called no matter the current polarity state, but this is no longer
> > the case.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Fixes: 42e8992c58d4 ("pwm: Add core infrastructure to allow atomic updates")  
> 
> That's not technically correct, because it's the driver that has the
> bug. The core change merely exposes it.

Agree.

> How about if I sort this into
> the pwm-atomic branch and reword the commit message accordingly? That
> way things should all stay bisectible.

As you wish.

> 
> Then again, given the breakage caused by the pwm_args patch I suppose
> it doesn't matter much because that's part of a stable branch that I
> can't rebase.

Yep, I know :-(.
Boris BREZILLON June 14, 2016, 7:58 a.m. UTC | #3
Hi Thierry,

On Tue, 17 May 2016 13:00:05 +0200
Thierry Reding <thierry.reding@gmail.com> wrote:

> On Tue, May 17, 2016 at 11:12:32AM +0200, Boris Brezillon wrote:
> > The PWM device exposed by the HLCDC IP is configured with an inverted
> > polarity by default. Registering the PWM chip with the normal polarity
> > was not a problem before commit 42e8992c58d4 ("pwm: Add core
> > infrastructure to allow atomic updates") because the ->set_polarity()
> > hook was called no matter the current polarity state, but this is no longer
> > the case.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Fixes: 42e8992c58d4 ("pwm: Add core infrastructure to allow atomic updates")  
> 
> That's not technically correct, because it's the driver that has the
> bug. The core change merely exposes it. How about if I sort this into
> the pwm-atomic branch and reword the commit message accordingly? That
> way things should all stay bisectible.

I don't see this change in your branch. Do you want me to resend this
fix after reworking the commit message?

Regards,

Boris
Thierry Reding June 14, 2016, 8:55 a.m. UTC | #4
On Tue, Jun 14, 2016 at 09:58:26AM +0200, Boris Brezillon wrote:
> Hi Thierry,
> 
> On Tue, 17 May 2016 13:00:05 +0200
> Thierry Reding <thierry.reding@gmail.com> wrote:
> 
> > On Tue, May 17, 2016 at 11:12:32AM +0200, Boris Brezillon wrote:
> > > The PWM device exposed by the HLCDC IP is configured with an inverted
> > > polarity by default. Registering the PWM chip with the normal polarity
> > > was not a problem before commit 42e8992c58d4 ("pwm: Add core
> > > infrastructure to allow atomic updates") because the ->set_polarity()
> > > hook was called no matter the current polarity state, but this is no longer
> > > the case.
> > > 
> > > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > > Fixes: 42e8992c58d4 ("pwm: Add core infrastructure to allow atomic updates")  
> > 
> > That's not technically correct, because it's the driver that has the
> > bug. The core change merely exposes it. How about if I sort this into
> > the pwm-atomic branch and reword the commit message accordingly? That
> > way things should all stay bisectible.
> 
> I don't see this change in your branch. Do you want me to resend this
> fix after reworking the commit message?

I must have forgotten about it. I've applied it to my fixes branch now,
for which I plan on sending a pull request tomorrow.

Thierry
diff mbox

Patch

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index f994c7e..14fc011 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -272,7 +272,7 @@  static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
 	chip->chip.of_pwm_n_cells = 3;
 	chip->chip.can_sleep = 1;
 
-	ret = pwmchip_add(&chip->chip);
+	ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED);
 	if (ret) {
 		clk_disable_unprepare(hlcdc->periph_clk);
 		return ret;