Linux PWM subsystem development
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: <thierry.reding@gmail.com>, <lee.jones@linaro.org>,
	<kernel@axis.com>, <linux-pwm@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <robh+dt@kernel.org>,
	<oliver@schinagl.nl>
Subject: Re: [PATCH 2/2] pwm: Add GPIO PWM driver
Date: Wed, 2 Sep 2020 14:11:54 +0200	[thread overview]
Message-ID: <20200902121154.6bb5d5sqxwf2tmgt@axis.com> (raw)
In-Reply-To: <20200815075032.k2xyw75l56sbl7nx@pengutronix.de>

On Sat, Aug 15, 2020 at 09:50:32AM +0200, Uwe Kleine-König wrote:
> On Fri, Aug 14, 2020 at 05:55:13PM +0200, Vincent Whitchurch wrote:
> > Add a software PWM which toggles a GPIO from a high-resolution timer.
> > 
> > This will naturally not be as accurate or as efficient as a hardware
> > PWM, but it is useful in some cases.  I have for example used it for
> > evaluating LED brightness handling (via leds-pwm) on a board where the
> > LED was just hooked up to a GPIO, and for a simple verification of the
> > timer frequency on another platform.
> > 
> > Since high-resolution timers are used, sleeping gpio chips are not
> > supported and are rejected in the probe function.
> > 
> > Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> 
> Nice idea. IMHO this can serve as example about what we expect from pwm
> drivers. There is some improvement necessary however to reach that
> state.

Thank you for the comments.  I think I've fixed all of them in v2.  Just
one point about this one:

> > +
> > +	return 0;
> > +}
> > +
> > +static const struct pwm_ops pwm_gpio_ops = {
> > +	.owner = THIS_MODULE,
> > +	.apply = pwm_gpio_apply,
> 
> Usually a .get_state callback is nice. Does it make sense to do
> something like:
> 
> 	if (driver is up)
> 		report current setting
> 	else
> 		val = gpio_get_value()
> 		report(period=1, duty_cycle=val, enabled=val, polarity=NORMAL)
> 
> ?

I implemented get_state() but I didn't do the gpio_get_value() thing
since the driver sets the gpio to a known value in probe().

  reply	other threads:[~2020-09-02 12:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 15:55 [PATCH 1/2] dt-bindings: pwm: Add pwm-gpio Vincent Whitchurch
2020-08-14 15:55 ` [PATCH 2/2] pwm: Add GPIO PWM driver Vincent Whitchurch
2020-08-15  7:50   ` Uwe Kleine-König
2020-09-02 12:11     ` Vincent Whitchurch [this message]
2020-09-02 18:00       ` Uwe Kleine-König
2020-09-03  9:15   ` Olliver Schinagl
2020-09-15 14:02     ` Vincent Whitchurch
2020-09-25 18:14       ` Olliver Schinagl
2020-09-26 13:24         ` Uwe Kleine-König
2020-08-17 19:38 ` [PATCH 1/2] dt-bindings: pwm: Add pwm-gpio Rob Herring
2020-09-02 12:08   ` Vincent Whitchurch

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=20200902121154.6bb5d5sqxwf2tmgt@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@axis.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=oliver@schinagl.nl \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox