From: Maxime Ripard <maxime@cerno.tech>
To: 班涛 <fengzheng923@gmail.com>
Cc: thierry.reding@gmail.com,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
wens@csie.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org
Subject: Re: [PATCH v2] pwm: sunxi: Add Allwinner SoC PWM controller driver
Date: Fri, 5 Feb 2021 17:11:58 +0100 [thread overview]
Message-ID: <20210205161158.gqinjayxcihtiofe@gilmour> (raw)
In-Reply-To: <CAE=m61-oXn8CkzUpSxkuS-gLkxjwd8wSeL42Q5T+27_V89xgNw@mail.gmail.com>
Hi,
On Thu, Feb 04, 2021 at 11:47:34AM +0800, 班涛 wrote:
> Maxime Ripard <maxime@cerno.tech> 于2021年2月3日周三 下午11:46写道:
>
> > Hi,
> >
> > On Wed, Feb 03, 2021 at 08:53:17PM +0800, Ban Tao wrote:
> > > From: Ban Tao <fengzheng923@gmail.com>
> > >
> > > The Allwinner R818, A133, R329, V536 and V833 has a new PWM controller
> > > IP compared to the older Allwinner SoCs.
> > >
> > > Signed-off-by: Ban Tao <fengzheng923@gmail.com>
> >
> > Thanks for your patch. There's a bunch of warnings reported by
> > checkpatch --strict, they should be addressed.
> >
> > > ---
> > > v1->v2:
> > > 1.delete unnecessary code.
> > > 2.using a named define for some constants.
> > > 3.Add comment in sun50i_pwm_config function.
> > > 4.using dev_err_probe() for error handling.
> > > 5.disable the clock after pwmchip_remove().
> > > ---
> > > MAINTAINERS | 6 +
> > > drivers/pwm/Kconfig | 11 ++
> > > drivers/pwm/Makefile | 1 +
> > > drivers/pwm/pwm-sun50i.c | 348 +++++++++++++++++++++++++++++++++++++++
> > > 4 files changed, 366 insertions(+)
> > > create mode 100644 drivers/pwm/pwm-sun50i.c
> > >
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index e73636b75f29..d33cf1b69b43 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -737,6 +737,12 @@ L: linux-media@vger.kernel.org
> > > S: Maintained
> > > F: drivers/staging/media/sunxi/cedrus/
> > >
> > > +ALLWINNER PWM DRIVER
> > > +M: Ban Tao <fengzheng923@gmail.com>
> > > +L: linux-pwm@vger.kernel.org
> > > +S: Maintained
> > > +F: drivers/pwm/pwm-sun50i.c
> > > +
> > > ALPHA PORT
> > > M: Richard Henderson <rth@twiddle.net>
> > > M: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> > > diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> > > index 9a4f66ae8070..17635a8f2ed3 100644
> > > --- a/drivers/pwm/Kconfig
> > > +++ b/drivers/pwm/Kconfig
> > > @@ -552,6 +552,17 @@ config PWM_SUN4I
> > > To compile this driver as a module, choose M here: the module
> > > will be called pwm-sun4i.
> > >
> > > +config PWM_SUN50I
> > > + tristate "Allwinner enhanced PWM support"
> > > + depends on ARCH_SUNXI || COMPILE_TEST
> > > + depends on HAS_IOMEM && COMMON_CLK
> > > + help
> > > + Enhanced PWM framework driver for Allwinner R818, A133, R329,
> > > + V536 and V833 SoCs.
> > > +
> > > + To compile this driver as a module, choose M here: the module
> > > + will be called pwm-sun50i.
> > > +
> >
> > Even though it's unfortunate, there's a bunch of other SoCs part of the
> > sun50i family that are supported by the sun4i driver.
> >
> > Which SoC introduced that new design? It's usually the name we pick up
> > then.
> >
>
> In fact, some SoCs has not been supported by the sun4i driver, such as v833,
> v536, r818, a133 and r329.
> v833 and v536 are part of the sun8i family, but r818, a133 and r329 are
> part of the sun50i family.
Indeed, I missed that sorry.
> So,I'm confused, how do choose the name of this driver?
Just go for the earliest SoC that introduced that design. What was the
first SoC to use it?
> > > +static const struct sun50i_pwm_data sun8i_pwm_data_c9 = {
> > > + .npwm = 9,
> > > +};
> > > +
> > > +static const struct sun50i_pwm_data sun50i_pwm_data_c16 = {
> > > + .npwm = 16,
> > > +};
> > > +
> > > +static const struct of_device_id sun50i_pwm_dt_ids[] = {
> > > + {
> > > + .compatible = "allwinner,sun8i-v833-pwm",
> > > + .data = &sun8i_pwm_data_c9,
> > > + }, {
> > > + .compatible = "allwinner,sun8i-v536-pwm",
> > > + .data = &sun8i_pwm_data_c9,
> > > + }, {
> > > + .compatible = "allwinner,sun50i-r818-pwm",
> > > + .data = &sun50i_pwm_data_c16,
> > > + }, {
> > > + .compatible = "allwinner,sun50i-a133-pwm",
> > > + .data = &sun50i_pwm_data_c16,
> > > + }, {
> > > + .compatible = "allwinner,sun50i-r329-pwm",
> > > + .data = &sun8i_pwm_data_c9,
> > > + }, {
> > > + /* sentinel */
> > > + },
> > > +};
> > > +MODULE_DEVICE_TABLE(of, sun50i_pwm_dt_ids);
> >
> > What are the differences between all these SoCs? If there's none between
> > the v833, v536 and R329, and between the r818 and the A133, you should
> > use the same compatible.
>
> Compared with the sun4i driver, this patch is a completely different PWM IP
> controller.
Sure, I didn't mean to compare it to sun4i. What I meant was that as far
as these struct goes, the A133 and the R818 look to have the same PWM
controller. Just like the v833, v536 and R329.
If the PWM controllers are indeed identical across those SoCs, you can
just use two compatibles, one for the PWM with 9 channels (again, the
earliest SoC among the V833, v536 and r329), and one for the PWM with 16
channels.
None of those SoCs are supported at the moment in Linux though, so it
would make more sense to support them first before adding a new driver
for those SoCs, it's gonna be dead code otherwise.
Maxime
next prev parent reply other threads:[~2021-02-05 23:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-03 12:53 Ban Tao
2021-02-03 15:12 ` Uwe Kleine-König
2021-02-03 16:33 ` Thierry Reding
2021-02-03 20:59 ` Uwe Kleine-König
2021-02-04 13:38 ` Thierry Reding
2021-02-04 13:54 ` Uwe Kleine-König
2021-02-04 22:05 ` Thierry Reding
[not found] ` <CAE=m618FY6_Qq1gNmkivswKjCB984WfV_Cr_Cw253ffGQmAS5Q@mail.gmail.com>
2021-02-22 7:22 ` Uwe Kleine-König
2021-02-03 15:46 ` Maxime Ripard
[not found] ` <CAE=m61-oXn8CkzUpSxkuS-gLkxjwd8wSeL42Q5T+27_V89xgNw@mail.gmail.com>
2021-02-05 16:11 ` Maxime Ripard [this message]
[not found] ` <CAE=m6190zD55EL_VOmq=yKw471bxiRwZdjpVTyvNAAvofn9UPQ@mail.gmail.com>
2021-02-10 9:33 ` Maxime Ripard
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=20210205161158.gqinjayxcihtiofe@gilmour \
--to=maxime@cerno.tech \
--cc=fengzheng923@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wens@csie.org \
/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
all inboxes | Powered by JetHome®