devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Fong <gregory.0xf0@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: linux-gpio@vger.kernel.org, Alexandre Courbot <gnurou@gmail.com>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Pawel Moll <pawel.moll@arm.com>, Rob Herring <robh+dt@kernel.org>,
	Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH v2 4/6] gpio: brcmstb: Allow GPIOs to be wakeup sources
Date: Tue, 2 Jun 2015 10:27:16 -0700	[thread overview]
Message-ID: <CADtm3G6fd3=xPL-LSMCahoR2X+R60ryPrnVVy589MO3vyfj9VA@mail.gmail.com> (raw)
In-Reply-To: <20150530004343.GX27753@ld-irv-0074>

On Fri, May 29, 2015 at 5:43 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Thu, May 28, 2015 at 07:14:08PM -0700, Gregory Fong wrote:
>> Several drivers (e.g. gpio-keys) allow for GPIOs to be configured as
>> wakeup sources, and this GPIO controller supports that through a
>> separate interrupt path.
>>
>> The de-facto standard DT property "wakeup-source" is checked, since
>> that indicates whether the GPIO controller hardware can wake.  Uses
>> the IRQCHIP_MASK_ON_SUSPEND irq_chip flag because UPG GIO doesn't have
>> any of its own wakeup source configuration.
>>
>> Signed-off-by: Gregory Fong <gregory.0xf0@gmail.com>
>> ---
>> New in v2.
>>
>>  drivers/gpio/gpio-brcmstb.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 53 insertions(+)
>>
>> diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
>> index b9962ff..2598c1e 100644
>> --- a/drivers/gpio/gpio-brcmstb.c
>> +++ b/drivers/gpio/gpio-brcmstb.c
>> [...]
>> @@ -369,6 +396,32 @@ static int brcmstb_gpio_irq_setup(struct platform_device *pdev,
>>       priv->irq_chip.irq_mask = brcmstb_gpio_irq_mask;
>>       priv->irq_chip.irq_unmask = brcmstb_gpio_irq_unmask;
>>       priv->irq_chip.irq_set_type = brcmstb_gpio_irq_set_type;
>> +
>> +     /* Ensures that all non-wakeup IRQs are disabled at suspend */
>> +     priv->irq_chip.flags = IRQCHIP_MASK_ON_SUSPEND;
>> +
>> +     if (IS_ENABLED(CONFIG_PM_SLEEP) &&
>> +                     of_get_property(np, "wakeup-source", NULL)) {
>
> of_property_read_bool()?

Will change.

>
>> +             priv->parent_wake_irq = platform_get_irq(pdev, 1);
>> +             if (priv->parent_wake_irq < 0)  {
>> +                     dev_warn(dev,
>> +                             "Couldn't get wake IRQ - GPIOs will not be able to wake from sleep");
>> +             } else {
>> +                     int err = devm_request_irq(dev, priv->parent_wake_irq,
>> +                                     brcmstb_gpio_wake_irq_handler, 0,
>> +                                     "brcmstb-gpio-wake", priv);
>> +
>> +                     if (err < 0) {
>> +                             dev_err(dev, "Couldn't request wake IRQ");
>> +                             return err;
>> +                     }
>> +
>> +                     device_set_wakeup_capable(dev, true);
>> +                     device_wakeup_enable(dev);
>
> Might want to move these two lines above the devm_request_irq(), so that
> you're ready to record PM events immediately at probe time. This is
> important when waking from S5 states, where we sometimes want to be able
> to check the /sys/devices/.../wakeup_count stats to see what woke us up.

Makes sense.  We'll also need a reboot notifier for S5 to work.

>
>> +                     priv->irq_chip.irq_set_wake = brcmstb_gpio_irq_set_wake;
>> +             }
>> +     }
>> +
>>       priv->irq_domain =
>>               irq_domain_add_linear(np, priv->num_gpios,
>>                                     &brcmstb_gpio_irq_domain_ops,
>
> With that:
>
> Reviewed-by: Brian Norris <computersforpeace@gmail.com>

Thanks,
Gregory

  reply	other threads:[~2015-06-02 17:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  2:14 [PATCH v2 0/6] GPIO support for BRCMSTB Gregory Fong
2015-05-29  2:14 ` [PATCH v2 1/6] gpio: Add GPIO support for Broadcom STB SoCs Gregory Fong
     [not found]   ` <1432865650-4062-2-git-send-email-gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-02 13:40     ` Linus Walleij
     [not found] ` <1432865650-4062-1-git-send-email-gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-29  2:14   ` [PATCH v2 2/6] gpio: brcmstb: Add interrupt support Gregory Fong
2015-05-30  0:10     ` Brian Norris
2015-05-30  1:30       ` Gregory Fong
2015-06-02 13:33     ` Linus Walleij
2015-05-29  2:14 ` [PATCH v2 3/6] dt-bindings: brcmstb-gpio: document properties for wakeup Gregory Fong
2015-05-30  0:36   ` Brian Norris
2015-05-30  0:57     ` Gregory Fong
2015-05-30  1:37       ` Brian Norris
2015-05-30  1:51         ` Gregory Fong
2015-05-29  2:14 ` [PATCH v2 4/6] gpio: brcmstb: Allow GPIOs to be wakeup sources Gregory Fong
     [not found]   ` <1432865650-4062-5-git-send-email-gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-30  0:43     ` Brian Norris
2015-06-02 17:27       ` Gregory Fong [this message]
2015-06-02 13:45     ` Linus Walleij
     [not found]       ` <CACRpkdYnZ9nYHPoUsmgLUtKhB2Us0c_scAYsZVJJQK2orKcpVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-02 17:27         ` Gregory Fong
2015-05-29  2:14 ` [PATCH v2 5/6] ARM: brcmstb: Select ARCH_WANT_OPTIONAL_GPIOLIB Gregory Fong
2015-05-29 21:53   ` Florian Fainelli
2015-06-02 13:42   ` Linus Walleij
2015-05-29  2:14 ` [PATCH v2 6/6] ARM: brcmstb: Add default gpio number Gregory Fong
     [not found]   ` <1432865650-4062-7-git-send-email-gregory.0xf0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-29 21:54     ` Florian Fainelli
2015-06-02 13:41   ` Linus Walleij
2015-05-29 16:26 ` [PATCH v2 0/6] GPIO support for BRCMSTB Florian Fainelli

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='CADtm3G6fd3=xPL-LSMCahoR2X+R60ryPrnVVy589MO3vyfj9VA@mail.gmail.com' \
    --to=gregory.0xf0@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=gnurou@gmail.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).