From: Mark Brown <broonie@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Florian Lobmaier <florian.lobmaier@ams.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH] added ams AS3722 gpio support
Date: Fri, 16 Aug 2013 19:20:52 +0100 [thread overview]
Message-ID: <20130816182052.GP30073@sirena.org.uk> (raw)
In-Reply-To: <CACRpkdbMUz3ujrb-QP4d_Mrc7SxKUsNLOF9_qsBphfqp5nF76w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]
On Fri, Aug 16, 2013 at 05:38:37PM +0200, Linus Walleij wrote:
> On Wed, Aug 14, 2013 at 4:59 PM, Florian Lobmaier
> > + ret = as3722_reg_read(as3722, AS3722_GPIO_SIGNAL_IN_REG, &val);
> These accessors is looking a lot like regmap being reimplemented.
> Have you considered switching the core driver to use regmap?
> This is definately to be fixed since it's using a new core MFD
> driver.
It's common to have inline wrappers for the regmap ops which take the
device specific struct and fish the regmap pointer out of it.
> > +static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
> > +{
> > + struct as3722_gpio *as3722_gpio = to_as3722_gpio(chip);
> > + struct as3722 *as3722 = as3722_gpio->as3722;
> > +
> > + return regmap_irq_get_virq(as3722->irq_data, AS3722_IRQ_GPIO1 + offset);
> > +}
> And *here* yoy're using regmap, this looks messy.
> Please use an irqdomain with the handling in the MFD core
> instead so the driver get a translated IRQ base per AS3722 IRQ passed,
> and get rid of this clunkiness.
> For example see how we're handling this in ab8500-core.c
> and abx500-pinctrl.c
This is actually doing the same thing as the ab8500 doing there - all
regmap_irq_get_virq() is doing is calling irq_create_mapping() on the
irqdomain to translate a hwirq into a virq. It's an API function mostly
because it was created when regmap-irq didn't always use irqdomains,
plus it means drivers don't need to look at the domain. There's also
regmap_irq_get_domain() which allows the translation to be done directly
in the driver if desired.
The remapping that the MFD core does unfortunately only works
transparently for single IRQs :(
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-08-16 18:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 14:59 [PATCH] added ams AS3722 gpio support Florian Lobmaier
2013-08-16 15:38 ` Linus Walleij
2013-08-16 18:20 ` Mark Brown [this message]
2013-08-16 18:28 ` Linus Walleij
2013-08-16 19:00 ` Mark Brown
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=20130816182052.GP30073@sirena.org.uk \
--to=broonie@kernel.org \
--cc=florian.lobmaier@ams.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=sameo@linux.intel.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