[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150326103605.GH1878@lahna.fi.intel.com>
Date: Thu, 26 Mar 2015 12:36:05 +0200
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Robert Dolca <robert.dolca@...il.com>
Cc: Octavian Purdila <octavian.purdila@...el.com>,
Linus Walleij <linus.walleij@...aro.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Robert Dolca <robert.dolca@...el.com>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
Jonathan Cameron <jic23@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Hartmut Knaack <knaack.h@....de>,
Peter Meerwald <pmeerw@...erw.net>,
Denis CIOCCA <denis.ciocca@...com>
Subject: Re: [PATCH] IIO: Adds ACPI support for ST gyroscopes
On Thu, Mar 26, 2015 at 12:06:45PM +0200, Robert Dolca wrote:
> On Wed, Mar 25, 2015 at 11:12 PM, Octavian Purdila
> <octavian.purdila@...el.com> wrote:
> > On Wed, Mar 25, 2015 at 3:21 PM, Mika Westerberg
> > <mika.westerberg@...ux.intel.com> wrote:
> >> On Wed, Mar 25, 2015 at 02:25:05PM +0200, Mika Westerberg wrote:
> >>> I think we can do the same for ACPI GpioInts so that we introduce
> >>> acpi_gpio_irq_get() that translates from GpioInt to Linux IRQ
> >>> numberspace. Then we can do something like below in I2C core:
> >>>
> >>> if (client->irq <= 0) {
> >>> int irq = -ENOENT;
> >>>
> >>> if (dev->of_node)
> >>> irq = of_irq_get(dev->of_node, 0);
> >>> else if (ACPI_COMPANION(dev))
> >>> irq = acpi_gpio_irq_get(ACPI_COMPANION(dev), 0);
> >>>
> >>> if (irq == -EPROBE_DEFER)
> >>> return irq;
> >>> if (irq < 0)
> >>> irq = 0;
> >>>
> >>> client->irq = irq;
> >>> }
> >>>
> >>> Now it has the drawback that the first GpioInt will not be available to
> >>> the driver anymore (as a GPIO since it is locked) but if DT already does
> >>> the same we should be fine.
> >>
> >> Below patch should take care of this.
> >>
> >
> > One issue we noticed is that now the gpio request and set input
> > directions operations are not called anymore. Some gpio controller
> > drivers (dln2, adnp, lynx_point from quickly browsing the code) do not
> > explicitly enable the GPIO pin nor set direction to input when the
> > interrupt is enabled. Depending on hardware this may be an issue - it
> > is on dln2 for example.
> >
> > Should the gpio controllers enable and set to input in irq_enable,
> > irq_bus_sync_unlock, etc.? Or should this be done in gpiolib?
>
> I've tested the patch and it works if the GPIO pin is enabled in the
> controller (which isn't as Octavian said). I believe that the patch
> should enable the pin and set the direction before it is used as IRQ.
Thanks for testing. I noticed that acpi_gpio_irq_get() has few bugs and
I'll fix them before submitting upstream.
What comes to enabling GPIO and turning it to input mode, sure we can do
that but we need to figure out where we are supposed to do that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists