* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
[not found] <20181114115025.GC2620@ulmo>
@ 2018-11-16 6:52 ` Uwe Kleine-König
2018-11-16 7:02 ` Uwe Kleine-König
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2018-11-16 6:52 UTC (permalink / raw)
To: linux-arm-kernel
Regarding the .request case: The consumer might be interested in taking
over the configured state from the boot loader. So the initially
configured state should be retained.
For the free case the PWM consumer is responsible to disable the PWM
before calling pwm_release and there are three subcases to consider:
a) The pwm is already off. Then there is no gain in disabling the PWM
once more.
b) The pwm is still running and there is a good reason for that. (Not
sure this is a valid case, I cannot imagine such a good reason.)
Then it is contra productive to disable the pwm.
c) The pwm is still running because the consumer failed to disable the
PWM. Then the consumer needs fixing and there is little incentive to
paper over the problem in the backend driver.
This aligns the lpc18xx-sct driver to the other PWM drivers that also
don't reconfigure the hardware in .request and .free.
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/pwm-lpc18xx-sct.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index d7f5f7de030d..475918d9f543 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -296,7 +296,6 @@ static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
set_bit(event, &lpc18xx_pwm->event_map);
lpc18xx_data->duty_event = event;
- lpc18xx_pwm_config_duty(chip, pwm, pwm_get_duty_cycle(pwm));
return 0;
}
@@ -306,8 +305,6 @@ static void lpc18xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
struct lpc18xx_pwm_chip *lpc18xx_pwm = to_lpc18xx_pwm_chip(chip);
struct lpc18xx_pwm_data *lpc18xx_data = pwm_get_chip_data(pwm);
- pwm_disable(pwm);
- pwm_set_duty_cycle(pwm, 0);
clear_bit(lpc18xx_data->duty_event, &lpc18xx_pwm->event_map);
}
--
2.19.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 6:52 ` [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Uwe Kleine-König
@ 2018-11-16 7:02 ` Uwe Kleine-König
2018-11-16 9:22 ` Vladimir Zapolskiy
2018-11-16 10:05 ` Thierry Reding
2 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2018-11-16 7:02 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
FTR: The e-mail address of Joachim Eastwood doesn't work. I got a bounce
back saying "The email account that you tried to reach is over quota.
Please direct the recipient to
https://support.google.com/mail/?p=OverQuotaPerm."
If you remember this when replying to this thread I think the right
thing is to drop him from the recipents.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 6:52 ` [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Uwe Kleine-König
2018-11-16 7:02 ` Uwe Kleine-König
@ 2018-11-16 9:22 ` Vladimir Zapolskiy
2018-11-16 9:48 ` Uwe Kleine-König
2018-11-16 10:01 ` Thierry Reding
2018-11-16 10:05 ` Thierry Reding
2 siblings, 2 replies; 9+ messages in thread
From: Vladimir Zapolskiy @ 2018-11-16 9:22 UTC (permalink / raw)
To: linux-arm-kernel
Hello Uwe,
On 11/16/2018 08:52 AM, Uwe Kleine-K?nig wrote:
> Regarding the .request case: The consumer might be interested in taking
> over the configured state from the boot loader. So the initially
> configured state should be retained.
>
> For the free case the PWM consumer is responsible to disable the PWM
> before calling pwm_release and there are three subcases to consider:
>
the changes are fine per se, but please split them into two.
Probably pwm_disable() misusage began spreading from commit 54b2a999a1675.
--
Best wishes,
Vladimir
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 9:22 ` Vladimir Zapolskiy
@ 2018-11-16 9:48 ` Uwe Kleine-König
2018-11-16 10:01 ` Thierry Reding
1 sibling, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2018-11-16 9:48 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 11:22:49AM +0200, Vladimir Zapolskiy wrote:
> Hello Uwe,
>
> On 11/16/2018 08:52 AM, Uwe Kleine-K?nig wrote:
> > Regarding the .request case: The consumer might be interested in taking
> > over the configured state from the boot loader. So the initially
> > configured state should be retained.
> >
> > For the free case the PWM consumer is responsible to disable the PWM
> > before calling pwm_release and there are three subcases to consider:
> >
>
> the changes are fine per se, but please split them into two.
>
> Probably pwm_disable() misusage began spreading from commit 54b2a999a1675.
I see little benefit, but if that's the only problem I can split.
Note that the behaviours of .request and .free are not unrelated.
Currently because .free sets a duty cycle of 0 we have
pwm_get_duty_cycle always return 0 in .request.
Waiting on what Thierry thinks.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 9:22 ` Vladimir Zapolskiy
2018-11-16 9:48 ` Uwe Kleine-König
@ 2018-11-16 10:01 ` Thierry Reding
2018-11-16 10:45 ` Uwe Kleine-König
1 sibling, 1 reply; 9+ messages in thread
From: Thierry Reding @ 2018-11-16 10:01 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 11:22:49AM +0200, Vladimir Zapolskiy wrote:
> Hello Uwe,
>
> On 11/16/2018 08:52 AM, Uwe Kleine-K?nig wrote:
> > Regarding the .request case: The consumer might be interested in taking
> > over the configured state from the boot loader. So the initially
> > configured state should be retained.
> >
> > For the free case the PWM consumer is responsible to disable the PWM
> > before calling pwm_release and there are three subcases to consider:
> >
>
> the changes are fine per se, but please split them into two.
>
> Probably pwm_disable() misusage began spreading from commit 54b2a999a1675.
It's not really misusage to call pwm_disable(). It's basically just a
shortcut for ->disable() or the atomic equivalent for it. So I think the
commit that you point to is doing exactly the right thing. Also note
that that commit was made 6 years ago, and a lot of things have changed
since then.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181116/94ce7e09/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 6:52 ` [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Uwe Kleine-König
2018-11-16 7:02 ` Uwe Kleine-König
2018-11-16 9:22 ` Vladimir Zapolskiy
@ 2018-11-16 10:05 ` Thierry Reding
2018-11-19 19:55 ` Uwe Kleine-König
2 siblings, 1 reply; 9+ messages in thread
From: Thierry Reding @ 2018-11-16 10:05 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Nov 16, 2018 at 07:52:08AM +0100, Uwe Kleine-K?nig wrote:
> Regarding the .request case: The consumer might be interested in taking
> over the configured state from the boot loader. So the initially
> configured state should be retained.
>
> For the free case the PWM consumer is responsible to disable the PWM
> before calling pwm_release and there are three subcases to consider:
>
> a) The pwm is already off. Then there is no gain in disabling the PWM
> once more.
> b) The pwm is still running and there is a good reason for that. (Not
> sure this is a valid case, I cannot imagine such a good reason.)
> Then it is contra productive to disable the pwm.
> c) The pwm is still running because the consumer failed to disable the
> PWM. Then the consumer needs fixing and there is little incentive to
> paper over the problem in the backend driver.
>
> This aligns the lpc18xx-sct driver to the other PWM drivers that also
> don't reconfigure the hardware in .request and .free.
>
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> drivers/pwm/pwm-lpc18xx-sct.c | 3 ---
> 1 file changed, 3 deletions(-)
Applied, with some minor fixes to the commit message (pwm -> PWM,
pwm_release -> pwm_put(), ...).
Thanks,
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181116/3730d634/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 10:01 ` Thierry Reding
@ 2018-11-16 10:45 ` Uwe Kleine-König
0 siblings, 0 replies; 9+ messages in thread
From: Uwe Kleine-König @ 2018-11-16 10:45 UTC (permalink / raw)
To: linux-arm-kernel
Hello Thierry,
On Fri, Nov 16, 2018 at 11:01:14AM +0100, Thierry Reding wrote:
> On Fri, Nov 16, 2018 at 11:22:49AM +0200, Vladimir Zapolskiy wrote:
> > On 11/16/2018 08:52 AM, Uwe Kleine-K?nig wrote:
> > > Regarding the .request case: The consumer might be interested in taking
> > > over the configured state from the boot loader. So the initially
> > > configured state should be retained.
> > >
> > > For the free case the PWM consumer is responsible to disable the PWM
> > > before calling pwm_release and there are three subcases to consider:
> > >
> >
> > the changes are fine per se, but please split them into two.
> >
> > Probably pwm_disable() misusage began spreading from commit 54b2a999a1675.
>
> It's not really misusage to call pwm_disable(). It's basically just a
> shortcut for ->disable() or the atomic equivalent for it.
I'd say that pwm_disable() is not a shortcut but the long way round to
.disable() at best.
And that calling pwm_disable() from the low level driver doesn't result
in problems is just luck because the pwm framework is such a thin
wrapper. If it would do locking, .free might already hold the lock and
pwm_disable might try to grab it again. If it would do more checking
that only a caller of pwm_get calls pwm_disable, the check would trigger
because the consumer already called pwm_put and the lowlevel driver
didn't use pwm_get.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-16 10:05 ` Thierry Reding
@ 2018-11-19 19:55 ` Uwe Kleine-König
2018-11-20 15:42 ` Thierry Reding
0 siblings, 1 reply; 9+ messages in thread
From: Uwe Kleine-König @ 2018-11-19 19:55 UTC (permalink / raw)
To: linux-arm-kernel
Hello Thierry,
On Fri, Nov 16, 2018 at 11:05:00AM +0100, Thierry Reding wrote:
> Applied, with some minor fixes to the commit message (pwm -> PWM,
> pwm_release -> pwm_put(), ...).
Thanks. I wonder though why the commit didn't make it into next yet.
Your for-next branch doesn't contain anything that's not already in
Linus Torvalds' tree. I assume this isn't on purpose and you just didn't
push your changes out?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free
2018-11-19 19:55 ` Uwe Kleine-König
@ 2018-11-20 15:42 ` Thierry Reding
0 siblings, 0 replies; 9+ messages in thread
From: Thierry Reding @ 2018-11-20 15:42 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2018 at 08:55:28PM +0100, Uwe Kleine-K?nig wrote:
> Hello Thierry,
>
> On Fri, Nov 16, 2018 at 11:05:00AM +0100, Thierry Reding wrote:
> > Applied, with some minor fixes to the commit message (pwm -> PWM,
> > pwm_release -> pwm_put(), ...).
>
> Thanks. I wonder though why the commit didn't make it into next yet.
> Your for-next branch doesn't contain anything that's not already in
> Linus Torvalds' tree. I assume this isn't on purpose and you just didn't
> push your changes out?
Pushed now.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181120/68f35216/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-11-20 15:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20181114115025.GC2620@ulmo>
2018-11-16 6:52 ` [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Uwe Kleine-König
2018-11-16 7:02 ` Uwe Kleine-König
2018-11-16 9:22 ` Vladimir Zapolskiy
2018-11-16 9:48 ` Uwe Kleine-König
2018-11-16 10:01 ` Thierry Reding
2018-11-16 10:45 ` Uwe Kleine-König
2018-11-16 10:05 ` Thierry Reding
2018-11-19 19:55 ` Uwe Kleine-König
2018-11-20 15:42 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).