From: Thierry Reding <thierry.reding@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Yash Shah <yash.shah@sifive.com>,
palmer@sifive.com, linux-pwm@vger.kernel.org,
linux-riscv@lists.infradead.org, robh+dt@kernel.org,
mark.rutland@arm.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, sachin.ghadi@sifive.com,
paul.walmsley@sifive.com
Subject: Re: [PATCH v9 2/2] pwm: sifive: Add a driver for SiFive SoC PWM
Date: Mon, 18 Mar 2019 10:51:11 +0100 [thread overview]
Message-ID: <20190318095111.GA17565@ulmo> (raw)
In-Reply-To: <20190312131712.rxiarnthcfrsgdqn@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 2293 bytes --]
On Tue, Mar 12, 2019 at 02:17:12PM +0100, Uwe Kleine-König wrote:
> On Tue, Mar 12, 2019 at 01:12:18PM +0100, Thierry Reding wrote:
> > On Tue, Mar 12, 2019 at 10:17:39AM +0100, Uwe Kleine-König wrote:
[...]
> > > There are a few other things that could be improved, but I think they
> > > could be addressed later. For some of these I don't even know what to
> > > suggest, for some Thierry might not agree it is worth fixing:
> > >
> > > - rounding
> > > how to round? When should a request declined, when is rounding ok?
> > > There is still "if (state->period != pwm->approx_period) return -EBUSY"
> > > in this driver. This is better than before, but if state-period ==
> > > pwm->approx_period + 1 the result (if accepted) might be the same as
> > > without the +1 and so returning -EBUSY for one case and accepting the
> > > other is strange.
> >
> > Perhaps a good idea would be to reject a configuration only after we've
> > determined that it is incompatible? If we're really going to end up with
> > the same configuration within a given margin of period or duty cycle and
> > we can't do much about it, there's little point in rejecting such
> > configurations.
>
> It seems we agree here. Is this important enough to delay taking this
> driver further? Currently the driver rejects too broad so if it annoys
> someone this can still be fixed later and there is only little harm
> (assuming correct error handling in the consumers).
I don't think it has to be a blocker. As you said, we'd be giving users
more flexibility, not restricting them, so it should be fine to do later
on.
> > > - don't call PWM API functions designed for consumers (here: pwm_get_state)
> >
> > Agreed. The driver can just access pwm_device.state directly.
>
> I wouldn't do this either. IMHO the driver should only look into its
> hardware registers instead of using framework interna (or consumer API
> calls).
The current hardware state is already the software representation of
what the hardware has programmed. I think it's fair for drivers to make
use of that in order to avoid having to read back from hardware.
Especially if reading back from hardware might require switching on the
module to access registers.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-03-18 9:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 8:11 [PATCH v9 0/2] PWM support for HiFive Unleashed Yash Shah
2019-03-12 8:11 ` [PATCH v9 1/2] pwm: sifive: Add DT documentation for SiFive PWM Controller Yash Shah
2019-03-12 8:11 ` [PATCH v9 2/2] pwm: sifive: Add a driver for SiFive SoC PWM Yash Shah
2019-03-12 9:17 ` Uwe Kleine-König
2019-03-12 12:12 ` Thierry Reding
2019-03-12 13:17 ` Uwe Kleine-König
2019-03-18 9:51 ` Thierry Reding [this message]
2019-03-12 10:14 ` [PATCH v9 0/2] PWM support for HiFive Unleashed Andreas Schwab
2019-03-15 11:49 ` Yash Shah
2019-03-18 9:24 ` Andreas Schwab
2019-03-18 17:26 ` Andreas Schwab
2019-03-18 23:15 ` Paul Walmsley
2019-03-19 6:26 ` Yash Shah
2019-03-25 11:43 ` Yash Shah
2019-03-25 11:58 ` Andreas Schwab
2019-03-25 12:09 ` Yash Shah
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=20190318095111.GA17565@ulmo \
--to=thierry.reding@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
--cc=robh+dt@kernel.org \
--cc=sachin.ghadi@sifive.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yash.shah@sifive.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 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).