From: Thierry Reding <thierry.reding@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Mathieu Othacehe <m.othacehe@gmail.com>,
robh+dt@kernel.org, mark.rutland@arm.com,
linux-pwm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pwm: hibvt: Add hi3559v100 support
Date: Wed, 13 Feb 2019 13:30:02 +0100 [thread overview]
Message-ID: <20190213123002.GC647@ulmo> (raw)
In-Reply-To: <20190212142850.iwgi4n6v6oep4oin@pengutronix.de>
[-- Attachment #1: Type: text/plain, Size: 2460 bytes --]
On Tue, Feb 12, 2019 at 03:28:50PM +0100, Uwe Kleine-König wrote:
> On Tue, Feb 12, 2019 at 10:49:27AM +0100, Mathieu Othacehe wrote:
> > Add support for hi3559v100-shub-pwm and hisilicon,hi3559v100-pwm
> > platforms. They require a special quirk: pwm has to be enabled again
> > to force duty_cycle refresh.
> >
> > Signed-off-by: Mathieu Othacehe <m.othacehe@gmail.com>
> > ---
> > drivers/pwm/pwm-hibvt.c | 26 +++++++++++++++++++++++---
> > 1 file changed, 23 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c
> > index 27c107e78d59..bf33aa24433c 100644
> > --- a/drivers/pwm/pwm-hibvt.c
> > +++ b/drivers/pwm/pwm-hibvt.c
> > @@ -49,6 +49,7 @@ struct hibvt_pwm_chip {
> > struct clk *clk;
> > void __iomem *base;
> > struct reset_control *rstc;
> > + bool quirk_force_enable;
> > };
> >
> > struct hibvt_pwm_soc {
> > @@ -56,6 +57,7 @@ struct hibvt_pwm_soc {
> > };
> >
> > static const struct hibvt_pwm_soc pwm_soc[2] = {
> > + { .num_pwms = 2 },
> > { .num_pwms = 4 },
> > { .num_pwms = 8 },
>
> The members of this struct are used as of-data (in struct
> of_device_id::data below). When looking at the usage:
>
> { .compatible = "hisilicon,hi3516cv300-pwm", .data = &pwm_soc[1] },
> { .compatible = "hisilicon,hi3519v100-pwm", .data = &pwm_soc[2] },
> { .compatible = "hisilicon,hi3559v100-shub-pwm", .data = &pwm_soc[2] },
> { .compatible = "hisilicon,hi3559v100-pwm", .data = &pwm_soc[0] },
>
> this isn't exactly easy to understand. I would prefer to do it as
> follows:
>
> static const struct hibvt_pwm_soc hi3516cv300_soc_info = {
> .num_pwms = 2,
> };
> ...
>
> static const struct of_device_id hibvt_pwm_of_match[] = {
> { .compatible = "hisilicon,hi3516cv300-pwm", .data = &hi3516cv300_soc_info },
> ...
> };
>
> Then you could also add a member to hibvt_pwm_soc to signal if that
> force_enable quirk is necessary and would not need to use
> of_device_is_compatible() to determine this. The result is that you have
> a description of all relevant differences in a single place.
>
> @Thierry: Also this is yet another driver instance where a num-pwms
> property would simplify the driver because up to before this patch this
> was the only difference between the different variants.
We don't need the num-pwms in device tree if it can be derived from the
compatible string.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-02-13 12:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 9:49 [PATCH 1/2] dt-bindings: pwm: hibvt: Add hi3559v100 support Mathieu Othacehe
2019-02-12 9:49 ` [PATCH 2/2] " Mathieu Othacehe
2019-02-12 14:28 ` Uwe Kleine-König
2019-02-13 12:30 ` Thierry Reding [this message]
2019-02-13 17:23 ` Uwe Kleine-König
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=20190213123002.GC647@ulmo \
--to=thierry.reding@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=m.othacehe@gmail.com \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
--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 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.