All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>,
	Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de,
	Boris Brezillon <boris.brezillon@bootlin.com>
Subject: is pwm_put supposed to stop a PWM?
Date: Thu, 25 Oct 2018 21:45:24 +0200	[thread overview]
Message-ID: <20181025194524.2xdhqni666zfgfzp@pengutronix.de> (raw)

Hello,

while digging around in the pwm drivers I found
drivers/pwm/pwm-lpc18xx-sct.c which in its .free callback calls
pwm_disable() and pwm_set_duty_cycle(pwm, 0).

I think calling pwm_disable is wrong for two reasons:

 a) pwm_disable is for PWM users, not for drivers
 b) .free isn't supposed to stop the pwm.

Also I'm surprised that .request calls pwm_get_duty_cycle() and writes
the result into hardware. Still more as I think pwm_get_duty_cycle()
always returns 0 in .request.

BTW, this is the only caller of pwm_set_duty_cycle(), so if the driver
is simplified/fixed to not care about the duty cycle in .free and
.request, this function can go away.

What do you think?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

             reply	other threads:[~2018-10-25 19:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25 19:45 Uwe Kleine-König [this message]
2018-10-29 11:48 ` is pwm_put supposed to stop a PWM? Thierry Reding
2018-11-03 14:49   ` Uwe Kleine-König
2018-11-14  9:30     ` Uwe Kleine-König
2018-11-14 11:50       ` Thierry Reding
2018-11-15  8:42         ` Uwe Kleine-König
2018-11-15 15:43           ` Thierry Reding
2018-11-15 20:46             ` Uwe Kleine-König
2018-11-16  6:52         ` [PATCH] pwm: lpc18xx-sct: don't reconfigure PWM in .request and .free Uwe Kleine-König
2018-11-16  6:52           ` Uwe Kleine-König
2018-11-16  7:02           ` Uwe Kleine-König
2018-11-16  7:02             ` Uwe Kleine-König
2018-11-16  9:22           ` Vladimir Zapolskiy
2018-11-16  9:22             ` Vladimir Zapolskiy
2018-11-16  9:48             ` Uwe Kleine-König
2018-11-16  9:48               ` Uwe Kleine-König
2018-11-16 10:01             ` Thierry Reding
2018-11-16 10:01               ` Thierry Reding
2018-11-16 10:45               ` Uwe Kleine-König
2018-11-16 10:45                 ` Uwe Kleine-König
2018-11-16 10:05           ` Thierry Reding
2018-11-16 10:05             ` Thierry Reding
2018-11-19 19:55             ` Uwe Kleine-König
2018-11-19 19:55               ` Uwe Kleine-König
2018-11-20 15:42               ` Thierry Reding
2018-11-20 15:42                 ` Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181025194524.2xdhqni666zfgfzp@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=ariel@vanguardiasur.com.ar \
    --cc=boris.brezillon@bootlin.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.