From: Tony Lindgren <tony@atomide.com>
To: "Grygorii.Strashko@linaro.org" <grygorii.strashko@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, Felipe Balbi <balbi@ti.com>,
Javier Martinez Canillas <jmartinez@softcrates.net>,
Nishanth Menon <nm@ti.com>
Subject: Re: [PATCH 1/1] gpio: omap: Fix PM runtime issue and remove most BANK_USED macros
Date: Thu, 23 Apr 2015 07:39:53 -0700 [thread overview]
Message-ID: <20150423143952.GR18048@atomide.com> (raw)
In-Reply-To: <5538D3B6.7060305@linaro.org>
* Grygorii.Strashko@linaro.org <grygorii.strashko@linaro.org> [150423 04:13]:
> On 04/21/2015 07:08 PM, Tony Lindgren wrote:
> > @@ -438,11 +447,30 @@ static void omap_enable_gpio_module(struct gpio_bank *bank, unsigned offset)
> > writel_relaxed(ctrl, reg);
> > bank->context.ctrl = ctrl;
> > }
> > +
> > + if (is_irq) {
> > + omap_set_gpio_direction(bank, offset, 1);
> > + bank->irq_usage |= BIT(offset);
> > + } else {
> > + omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE);
> > + bank->mod_usage |= BIT(offset);
> > + }
>
> The OMAP GPIO driver implements two Core interfaces IRQ-chip and GPIO-chip which, in general,
> more or less independent.
>
> So, I don't think, that it's good to mix GPIO-IRQ-chip specific code with GPIO-chip code.
> And this even don't really correspond the purpose of omap_enable_gpio_module() :( and might
> introduce misunderstanding of code. The worst thing is that future fixes in IRQ-chip may
> affect on on GPIO-chip and vise versa :(
Hmm I'm thinking omap_enable/disable_gpio_module() eventually becomes
our runtime_resume/suspend(). Currently the enabling and disabling is
buggy for GPIO for some corner cases.. AFAIK the only difference between
enabling GPIO vs GPIO-IRQ is the calling of omap_set_gpio_direction
vs omap_set_gpio_triggering. Or at least that's the way it should be
unless I'm missing something?
> Could we keep omap_xxx_gpio_module() functions responsible only for GPIO bank PM and
> enabling/disabling?
If you're thinking about just thinking about having separate wrappers around
it like this::
static void omap_enable_gpio_module(struct gpio_bank *bank, unsigned offset,
bool is_irq)
{
...
}
static void omap_enable_gpio((struct gpio_bank *bank, unsigned offset)
{
omap_enable_gpio_module(bpio_bank, offset, 0);
}
static void omap_enable_gpio_irq((struct gpio_bank *bank, unsigned offset)
{
omap_enable_gpio_module(bpio_bank, offset, 1);
}
Then yes makes sense to me. Or do you have something else in mind?
Regards,
Tony
WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] gpio: omap: Fix PM runtime issue and remove most BANK_USED macros
Date: Thu, 23 Apr 2015 07:39:53 -0700 [thread overview]
Message-ID: <20150423143952.GR18048@atomide.com> (raw)
In-Reply-To: <5538D3B6.7060305@linaro.org>
* Grygorii.Strashko at linaro.org <grygorii.strashko@linaro.org> [150423 04:13]:
> On 04/21/2015 07:08 PM, Tony Lindgren wrote:
> > @@ -438,11 +447,30 @@ static void omap_enable_gpio_module(struct gpio_bank *bank, unsigned offset)
> > writel_relaxed(ctrl, reg);
> > bank->context.ctrl = ctrl;
> > }
> > +
> > + if (is_irq) {
> > + omap_set_gpio_direction(bank, offset, 1);
> > + bank->irq_usage |= BIT(offset);
> > + } else {
> > + omap_set_gpio_triggering(bank, offset, IRQ_TYPE_NONE);
> > + bank->mod_usage |= BIT(offset);
> > + }
>
> The OMAP GPIO driver implements two Core interfaces IRQ-chip and GPIO-chip which, in general,
> more or less independent.
>
> So, I don't think, that it's good to mix GPIO-IRQ-chip specific code with GPIO-chip code.
> And this even don't really correspond the purpose of omap_enable_gpio_module() :( and might
> introduce misunderstanding of code. The worst thing is that future fixes in IRQ-chip may
> affect on on GPIO-chip and vise versa :(
Hmm I'm thinking omap_enable/disable_gpio_module() eventually becomes
our runtime_resume/suspend(). Currently the enabling and disabling is
buggy for GPIO for some corner cases.. AFAIK the only difference between
enabling GPIO vs GPIO-IRQ is the calling of omap_set_gpio_direction
vs omap_set_gpio_triggering. Or at least that's the way it should be
unless I'm missing something?
> Could we keep omap_xxx_gpio_module() functions responsible only for GPIO bank PM and
> enabling/disabling?
If you're thinking about just thinking about having separate wrappers around
it like this::
static void omap_enable_gpio_module(struct gpio_bank *bank, unsigned offset,
bool is_irq)
{
...
}
static void omap_enable_gpio((struct gpio_bank *bank, unsigned offset)
{
omap_enable_gpio_module(bpio_bank, offset, 0);
}
static void omap_enable_gpio_irq((struct gpio_bank *bank, unsigned offset)
{
omap_enable_gpio_module(bpio_bank, offset, 1);
}
Then yes makes sense to me. Or do you have something else in mind?
Regards,
Tony
next prev parent reply other threads:[~2015-04-23 14:42 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 16:08 [PATCH 1/1] gpio: omap: Fix PM runtime issue and remove most BANK_USED macros Tony Lindgren
2015-04-21 16:08 ` Tony Lindgren
2015-04-22 14:20 ` Felipe Balbi
2015-04-22 14:20 ` Felipe Balbi
2015-04-23 11:12 ` Grygorii.Strashko@linaro.org
2015-04-23 11:12 ` Grygorii.Strashko@linaro.org
2015-04-23 14:39 ` Tony Lindgren [this message]
2015-04-23 14:39 ` Tony Lindgren
2015-04-28 21:57 ` Grygorii.Strashko@linaro.org
2015-04-28 21:57 ` Grygorii.Strashko@linaro.org
2015-04-29 14:26 ` Tony Lindgren
2015-04-29 14:26 ` Tony Lindgren
2015-04-30 19:10 ` Grygorii.Strashko@linaro.org
2015-04-30 19:10 ` Grygorii.Strashko@linaro.org
2015-04-30 21:12 ` Tony Lindgren
2015-04-30 21:12 ` Tony Lindgren
2015-05-02 16:27 ` Grygorii.Strashko@linaro.org
2015-05-02 16:27 ` Grygorii.Strashko@linaro.org
2015-05-04 15:38 ` Tony Lindgren
2015-05-04 15:38 ` Tony Lindgren
2015-05-12 9:00 ` Linus Walleij
2015-05-12 9:00 ` Linus Walleij
2015-05-12 14:13 ` Tony Lindgren
2015-05-12 14:13 ` Tony Lindgren
2015-05-12 15:31 ` Grygorii.Strashko@linaro.org
2015-05-12 15:31 ` Grygorii.Strashko@linaro.org
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=20150423143952.GR18048@atomide.com \
--to=tony@atomide.com \
--cc=balbi@ti.com \
--cc=gnurou@gmail.com \
--cc=grygorii.strashko@linaro.org \
--cc=jmartinez@softcrates.net \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.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 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.