All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: qiujiang <qiujiang@huawei.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	Alan Tull <delicious.quinoa@gmail.com>,
	Jamie Iles <jamie@jamieiles.com>,
	charles.chenxin@huawei.com,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>
Subject: Re: [PATCH v7 3/3] gpio: dwapb: add gpio-signaled acpi event support
Date: Fri, 8 Apr 2016 11:38:30 +0300	[thread overview]
Message-ID: <20160408083830.GT1727@lahna.fi.intel.com> (raw)
In-Reply-To: <CACRpkdb63AZtEOSJ0R+EqdHfKXcUr7Hs8fh9N5XHNcWjQ1Ba8A@mail.gmail.com>

On Fri, Apr 08, 2016 at 10:26:28AM +0200, Linus Walleij wrote:
> On Wed, Apr 6, 2016 at 9:08 AM, qiujiang <qiujiang@huawei.com> wrote:
> 
> > This patch adds gpio-signaled acpi event support. It is used for
> > power button on hisilicon D02 board, an arm64 platform.
> >
> > The corresponding DSDT file is defined as follows:
> >  Device(GPI0) {
> >         Name(_HID, "HISI0181")
> >         Name(_ADR, 0)
> >         Name(_UID, 0)
> >
> >         Name (_CRS, ResourceTemplate ()  {
> >                 Memory32Fixed (ReadWrite, 0x802e0000, 0x10000)
> >                 Interrupt (ResourceConsumer, Level, ActiveHigh,
> >                 Exclusive,,,)  {344}
> >         })
> >
> >         Device(PRTa) {
> >                 Name (_DSD, Package () {
> >                 Package () {
> >                         Package () {"reg",0},
> >                         Package () {"snps,nr-gpios",32},
> >                         }
> >                 })
> >         }
> >
> >         Name (_AEI, ResourceTemplate () {
> >                 GpioInt(Edge, ActiveLow, ExclusiveAndWake,
> >                 PullUp, , " \\_SB.GPI0") {8}
> >         })
> >
> >         Method (_E08, 0x0, NotSerialized) {
> >                 Notify (\_SB.PWRB, 0x80)
> >         }
> > }
> >
> > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Signed-off-by: qiujiang <qiujiang@huawei.com>
> 
> Admittedly I'm an ACPI novice and need help with deciding
> about ACPI, but I mostly trust Mika to know these things right.
> 
> About this:
> 
> > +       /* Add GPIO-signaled ACPI event support */
> > +       if (pp->irq)
> > +               acpi_gpiochip_request_interrupts(&port->gc);
> 
> It's weird to me that the driver already has a requested IRQ and
> everything, now it has to request it again from ACPI.

This is different thing, though.

Calling acpi_gpiochip_request_interrupts() results _AEI ACPI method
being evaluated that returns a list of GPIOs which are used as event
sources. acpi_gpiochip_request_interrupts() then goes and installs
interrupt handler per each GPIO in that list.

> When I look into the acpi_gpiochip_request_interrupts()
> I find it weird that it is void given how much can go wrong
> inside it. Should it not return an errorcode?

Currently it just complains if something goes wrong. The GPIO driver
itself can still work just fine (including interrupts).

I'm fine to change it to return an error code.

> > +               if (has_acpi_companion(dev) && pp->idx == 0)
> > +                       pp->irq = platform_get_irq(to_platform_device(dev), 0);
> 
> As it was already fetched here and then later requested,
> we still have to call acpi_gpiochip_request_interrupts()
> further down the road? That is confusing to me, can you
> explain what is going on?

See above.

  reply	other threads:[~2016-04-08  8:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06  7:07 [PATCH v7 0/3] gpio: dwapb: add gpio-signaled acpi event support for power button qiujiang
2016-04-06  7:07 ` qiujiang
2016-04-06  7:07 ` [PATCH v7 1/3] gpio: dwapb: remove name from dwapb_port_property qiujiang
2016-04-06  7:07   ` qiujiang
2016-04-06 12:57   ` Andy Shevchenko
2016-04-07 11:45     ` Jiang Qiu
2016-04-07 11:45       ` Jiang Qiu
2016-04-06  7:07 ` [PATCH v7 2/3] gpio: dwapb: convert device node to fwnode qiujiang
2016-04-06  7:07   ` qiujiang
2016-04-06 13:01   ` Andy Shevchenko
2016-04-07 11:14     ` Jiang Qiu
2016-04-07 11:14       ` Jiang Qiu
2016-04-15  2:29   ` Kefeng Wang
2016-04-15  2:29     ` Kefeng Wang
2016-04-06  7:08 ` [PATCH v7 3/3] gpio: dwapb: add gpio-signaled acpi event support qiujiang
2016-04-06  7:08   ` qiujiang
2016-04-08  8:26   ` Linus Walleij
2016-04-08  8:38     ` Mika Westerberg [this message]
2016-04-11 12:43       ` Jiang Qiu
2016-04-11 12:43         ` Jiang Qiu
2016-04-12  6:46         ` Mika Westerberg
2016-04-12  6:55           ` Jiang Qiu
2016-04-12  6:55             ` Jiang Qiu
2016-04-15  7:40           ` Linus Walleij
2016-04-15  7:58             ` Jiang Qiu
2016-04-15  7:58               ` Jiang Qiu
2016-04-11 13:00       ` Linus Walleij
2016-04-11 12:33     ` Jiang Qiu
2016-04-11 12:33       ` Jiang Qiu
2016-04-06 13:03 ` [PATCH v7 0/3] gpio: dwapb: add gpio-signaled acpi event support for power button Andy Shevchenko

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=20160408083830.GT1727@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=charles.chenxin@huawei.com \
    --cc=delicious.quinoa@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=jamie@jamieiles.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=qiujiang@huawei.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.