All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Octavian Purdila <octavian.purdila@intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Robert Dolca <robert.dolca@gmail.com>,
	Robert Dolca <robert.dolca@intel.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Denis CIOCCA <denis.ciocca@st.com>
Subject: Re: [PATCH] IIO: Adds ACPI support for ST gyroscopes
Date: Tue, 7 Apr 2015 11:35:13 +0200	[thread overview]
Message-ID: <CACRpkdZBheNLLH_9ep4dHViNdsgNbZFRoFo3gMg3RYQhbj2_+g@mail.gmail.com> (raw)
In-Reply-To: <CAE1zot+CTmWaszPjuUj69WNgBgqJMccF48to-9txVPNfYu-GGg@mail.gmail.com>

On Mon, Mar 30, 2015 at 3:52 PM, Octavian Purdila
<octavian.purdila@intel.com> wrote:
> On Mon, Mar 30, 2015 at 4:33 PM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
>> On Mon, Mar 30, 2015 at 03:55:14PM +0300, Octavian Purdila wrote:
>>> On Mon, Mar 30, 2015 at 12:52 PM, Mika Westerberg
>>> <mika.westerberg@linux.intel.com> wrote:
>>> > On Fri, Mar 27, 2015 at 11:36:25AM +0100, Linus Walleij wrote:
>>> >> On Fri, Mar 27, 2015 at 11:06 AM, Mika Westerberg
>>> >> <mika.westerberg@linux.intel.com> wrote:
>>> >> > On Thu, Mar 26, 2015 at 06:28:19PM +0200, Octavian Purdila wrote:
>>> >>
>>> >> >> For the sleep case I think the GPIO controller needs to do the pin
>>> >> >> enable and set input direction operation in it's irq_bus_sync_unlock.
>>> >> >
>>> >> > I wonder how DT handles all this? Is it the boot firmware that sets up
>>> >> > the pins accordingly or is there something we are missing?
>>> >>
>>> >> DT systems mostly do not have firmware for power usecases, they
>>> >> handle it all using pin control. I would more say that is a feature of
>>> >> all-SW systems without power-firmware ideas, without ACPI and
>>> >> without PSCI (well PSCI systems do not care about much more
>>> >> than CPU power down in firmware anyway...)
>>> >
>>> > OK, thanks.
>>> >
>>> > In case of ACPI (where firmware does lot more) it is supposed to
>>> > configure pins based on what is connected, if the firmware knows that.
>>> > Due to bugs in the boot firmware that obviously does not happen in all
>>> > cases (like this one).
>>> >
>>>
>>> Ah, interesting, I was not aware that the firmware was supposed to do
>>> the pin configuration. In this case I think your patch can be merged
>>> as it is Mika, mine doesn't make sense anymore.
>>
>> Unfortunately because of bugs we can't rely that the firmware (BIOS)
>> gets those always right :-(
>>
>>> This particular case is special since we did not performed the tests
>>> on a full system that has the component integrated. We instead used
>>> and I2C to USB bridge to which we connected the component and we
>>> loaded the ACPI table dynamically.
>>
>> Regardless of how did the device appear this always works:
>>
>>   1) request the GPIO (with GPIOD_IN)
>>   2) convert it to IRQ using gpiod_to_irq()
>>
>> Since we cannot be sure that the firmware has configured the pin
>> properly, rather than adding automatic IRQ <-> GPIO translation for ACPI
>> GpioInt I think we are better off if drivers explictly request their
>> GPIOs and configure them as needed.
>
>
> Yes, this is what we are doing now and it works well.
>
> But I am not yet ready to give-up on the automatic IRQ <-> GPIO translation :)
>
> What if we can do the pin configuration in gpiolib right after the
> GPIO controller is initialized. I am thinking of searching the ACPI
> namespace and looking for resources that have GpioInt entries for that
> particular GPIO controller and use them to set the pins to input (and
> ideally also set the other properties like pullups, pulldowns, etc.)

I would rather say that since the gpiolib and irqchip APIs are
supposed to be orthogonal, the irqchip request/unmask or
whatever functions are enabling IRQs should just go and poke
the necessary bits in the GPIO registers to turn the pin into
an input.

spinlocks to avoid collision with gpiolib usecases if necessary,
make GPIO side of the driver not assume it has sole control
over the registers or their contents, use gpiolib_irqchip or other
mechanism that will mark the line as used for IRQs.

Yours,
Linus Walleij

  parent reply	other threads:[~2015-04-07  9:35 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23 13:40 [PATCH] IIO: Adds ACPI support for ST gyroscopes Robert Dolca
2015-03-23 13:40 ` [PATCH] IIO: Add support for L3GD20H gyroscope Robert Dolca
2015-03-24 10:29   ` Linus Walleij
2015-03-28 11:14     ` Jonathan Cameron
2015-03-23 15:18 ` [PATCH] IIO: Adds ACPI support for ST gyroscopes Mika Westerberg
2015-03-24 11:51   ` Daniel Baluta
2015-03-24 11:51     ` Daniel Baluta
2015-03-24 10:22 ` Linus Walleij
2015-03-24 10:37 ` Linus Walleij
2015-03-24 10:44 ` Linus Walleij
2015-03-24 12:17 ` Lars-Peter Clausen
2015-03-24 13:26   ` Robert Dolca
2015-03-24 13:38     ` Lars-Peter Clausen
2015-03-24 13:57       ` Linus Walleij
2015-03-24 15:06         ` Mika Westerberg
     [not found]           ` <20150324150630.GP1878-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2015-03-24 15:22             ` Lars-Peter Clausen
2015-03-24 15:22               ` Lars-Peter Clausen
2015-03-24 15:28               ` Daniel Baluta
2015-03-24 15:55               ` Mika Westerberg
2015-03-24 16:43                 ` Lars-Peter Clausen
     [not found]                   ` <55119429.6070806-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2015-03-24 16:55                     ` Mika Westerberg
2015-03-24 16:55                       ` Mika Westerberg
2015-03-25  8:44           ` Linus Walleij
2015-03-25  9:43             ` Mika Westerberg
2015-03-25 12:25               ` Mika Westerberg
2015-03-25 13:21                 ` Mika Westerberg
2015-03-25 13:42                   ` Robert Dolca
2015-03-25 18:05                   ` sathyanarayanan kuppuswamy
2015-03-25 18:05                     ` sathyanarayanan kuppuswamy
2015-03-25 18:08                     ` Lars-Peter Clausen
2015-03-25 21:12                   ` Octavian Purdila
2015-03-26 10:06                     ` Robert Dolca
2015-03-26 10:36                       ` Mika Westerberg
2015-03-26 10:16                     ` Mika Westerberg
2015-03-26 12:04                       ` Octavian Purdila
2015-03-26 14:04                         ` Mika Westerberg
2015-03-26 14:37                           ` Octavian Purdila
2015-03-26 14:47                             ` Mika Westerberg
2015-03-26 15:00                               ` Octavian Purdila
2015-03-26 16:28                                 ` Octavian Purdila
2015-03-27 10:06                                   ` Mika Westerberg
2015-03-27 10:36                                     ` Linus Walleij
2015-03-30  9:52                                       ` Mika Westerberg
2015-03-30 12:55                                         ` Octavian Purdila
2015-03-30 13:33                                           ` Mika Westerberg
2015-03-30 13:52                                             ` Octavian Purdila
2015-03-30 14:18                                               ` Mika Westerberg
2015-04-07  9:35                                               ` Linus Walleij [this message]
2015-04-07  9:39                                                 ` Lars-Peter Clausen
2015-03-26 18:32                                 ` Jonathan Cameron
2015-03-26 18:32                                   ` Jonathan Cameron

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=CACRpkdZBheNLLH_9ep4dHViNdsgNbZFRoFo3gMg3RYQhbj2_+g@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=denis.ciocca@st.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=octavian.purdila@intel.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robert.dolca@gmail.com \
    --cc=robert.dolca@intel.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.