From: Andrew Lunn <andrew@lunn.ch>
To: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
linux-gpio@vger.kernel.org, Imre Kaloz <kaloz@openwrt.org>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"David S. Miller" <davem@davemloft.net>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Guenter Roeck <linux@roeck-us.net>,
"open list:PWM SUBSYSTEM" <linux-pwm@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] gpio: mvebu: Add limited PWM support
Date: Tue, 21 Mar 2017 15:50:56 +0100 [thread overview]
Message-ID: <20170321145056.GA30655@lunn.ch> (raw)
In-Reply-To: <20170321073618.2e4d41cc@gmail.com>
> > > *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip) return
> > > mvchip->membase + GPIO_BLINK_EN_OFF; }
> > >
> > > +static void __iomem *mvebu_gpioreg_blink_select(struct
> > > mvebu_gpio_chip *mvchip) +{
> > > + return mvchip->membase + GPIO_BLINK_CNT_SELECT_OFF;
> > > +}
> >
> > That's a really weird thing to do. Why not just use this expression in
> > your calls to readl() and writel() directly? Seems a lot of additional
> > code for no gain.
This driver is made more complex by the Armada XP SMP handling. Some
GPIO registers are per-cpu, others are global. Registers for
interrupts in particular are per CPU. So there is a general trend in
this driver to have a function which returns the address of a
register, for a given SOC variant. In this case, it is fixed, so could
be collapsed into the actual read/write. But then it would be
different to all others in this driver...
> > > + pwm->chip.dev = dev;
> > > + pwm->chip.ops = &mvebu_pwm_ops;
> > > + pwm->chip.base = mvchip->chip.base;
> > > + pwm->chip.npwm = mvchip->chip.ngpio;
> >
> > Isn't that a lie? The code above suggests you can only ever have a
> > single GPIO turn into a PWM, so I'd expect ".npwm = 1" here.
Well, any of the 32 GPIOs can be a PWM. But only one can be enabled at
a time. What exactly does pwm->chip.npwm mean? If we say 1 here, how
at run time do we say which of the 32 GPIOs is used as a PWM output?
By saying 32, it is simpler, which ever is enabled first is the one to
use.
Andrew
next prev parent reply other threads:[~2017-03-21 14:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170316064218.9169-1-ralph.sennhauser@gmail.com>
[not found] ` <20170316064218.9169-1-ralph.sennhauser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-16 6:42 ` [PATCH 1/4] gpio: mvebu: Add limited PWM support Ralph Sennhauser
[not found] ` <20170316064218.9169-2-ralph.sennhauser-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-03-16 16:03 ` Linus Walleij
2017-03-17 9:17 ` Ralph Sennhauser
2017-03-20 13:51 ` Thierry Reding
2017-03-21 6:31 ` Ralph Sennhauser
2017-03-23 10:11 ` Linus Walleij
2017-03-23 10:35 ` Ralph Sennhauser
2017-03-18 15:37 ` Andrew Lunn
2017-03-20 13:49 ` Thierry Reding
2017-03-20 13:44 ` Thierry Reding
2017-03-20 13:42 ` Thierry Reding
2017-03-21 6:36 ` Ralph Sennhauser
2017-03-21 14:50 ` Andrew Lunn [this message]
2017-03-16 6:42 ` [PATCH 2/4] mvebu: xp: Add pwm properties to .dtsi files Ralph Sennhauser
2017-03-16 6:42 ` [PATCH 4/4] mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan Ralph Sennhauser
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=20170321145056.GA30655@lunn.ch \
--to=andrew@lunn.ch \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kaloz@openwrt.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mark.rutland@arm.com \
--cc=mchehab@kernel.org \
--cc=ralph.sennhauser@gmail.com \
--cc=robh+dt@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 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).