From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Michal Simek <michal.simek@xilinx.com>,
<linux-kernel@vger.kernel.org>, <monstr@monstr.eu>
Cc: Borsodi Petr <Petr.Borsodi@i.cz>,
Linus Walleij <linus.walleij@linaro.org>,
<linux-gpio@vger.kernel.org>, Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH] gpio: Wakeup gpio controller when it is used as IRQ controller
Date: Wed, 20 Sep 2017 15:07:17 -0500 [thread overview]
Message-ID: <2cf9c866-5ace-b056-c80b-a7354fb951fc@ti.com> (raw)
In-Reply-To: <09258550e475aa7135db7b91bb96deeaf900f8c2.1505891674.git.michal.simek@xilinx.com>
On 09/20/2017 02:14 AM, Michal Simek wrote:
> From: Borsodi Petr <Petr.Borsodi@i.cz>
>
> There is a problem with GPIO driver when used as IRQ controller.
> It is not working because the module is sleeping (clock is disabled).
> The patch enables clocks when IP is used as IRQ controller.
I think, it should be solved already in genirq core.
commit be45beb "genirq: Add runtime power management support for IRQ chips"
>
> Signed-off-by: Borsodi Petr <Petr.Borsodi@i.cz>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Based on discussion with Linus here https://lkml.org/lkml/2017/8/22/400
> ---
> drivers/gpio/gpiolib.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index eb80dac4e26a..17258ad1fadb 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1676,14 +1676,22 @@ static void gpiochip_irq_unmap(struct irq_domain *d, unsigned int irq)
> static int gpiochip_irq_reqres(struct irq_data *d)
> {
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
> + int ret;
>
> if (!try_module_get(chip->gpiodev->owner))
> return -ENODEV;
>
> + ret = pm_runtime_get_sync(chip->parent);
> + if (ret < 0) {
> + module_put(chip->gpiodev->owner);
> + return ret;
> + }
> +
> if (gpiochip_lock_as_irq(chip, d->hwirq)) {
> chip_err(chip,
> "unable to lock HW IRQ %lu for IRQ\n",
> d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> return -EINVAL;
> }
> @@ -1695,6 +1703,7 @@ static void gpiochip_irq_relres(struct irq_data *d)
> struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
>
> gpiochip_unlock_as_irq(chip, d->hwirq);
> + pm_runtime_put(chip->parent);
> module_put(chip->gpiodev->owner);
> }
>
>
--
regards,
-grygorii
next prev parent reply other threads:[~2017-09-20 20:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 7:14 Michal Simek
2017-09-20 20:07 ` Grygorii Strashko [this message]
2017-09-21 12:19 ` Linus Walleij
2017-10-16 13:40 ` Michal Simek
2017-09-22 0:08 ` kbuild test robot
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=2cf9c866-5ace-b056-c80b-a7354fb951fc@ti.com \
--to=grygorii.strashko@ti.com \
--cc=Petr.Borsodi@i.cz \
--cc=jonathanh@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=monstr@monstr.eu \
/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®