All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Grant Likely <grant.likely@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Adam S Levy <theadamlevy@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: cherryview: Add a quirk to make Acer Chromebook keyboard work again
Date: Thu, 6 Apr 2017 13:50:59 +0300	[thread overview]
Message-ID: <20170406105059.GV2957@lahna.fi.intel.com> (raw)
In-Reply-To: <6bcf8db2-626c-7934-a334-13b11fb7be68@arm.com>

On Thu, Apr 06, 2017 at 11:32:59AM +0100, Marc Zyngier wrote:
> On 06/04/17 10:59, Mika Westerberg wrote:
> > On Thu, Mar 30, 2017 at 12:00:47PM +0300, Mika Westerberg wrote:
> >>>> Isn't the right solution to translate this back to the offset from the "Linux
> >>>> IRQ" and use that offset? This quirk seems pretty violent.
> >>>
> >>> I'm not sure I understand the quirk here, but my personal approach would
> >>> be to provide an inverse mapping oldIRQ->hwirq, and use the usual
> >>> irqdomain lookup to get back to the real thing.
> >>
> >> OK, thanks for tip. Let me try both approaches and see which one works
> >> better :)
> > 
> > I've now looked at the issue again and I'm actually not sure if we can
> > use either of the proposals here :/
> > 
> > Essentially all the Linux IRQ<->hwirq mappings are created when the
> > gpiochip is initialized in gpiochip_irqchip_add(). Because of that, I
> > don't see how we can change those afterwards when the i8042 keyboard
> > driver asks for IRQ 182. Maybe I'm missing something obvious but to me
> > the only way to go forward is to do what this patch does and add all the
> > GPIOs to the irqdomain (if we don't want to add a custom IRQ domain for
> > cherryview).
> 
> Something is very fishy here: You say that the i8042 asks for IRQ 182.
> But surely that's a hwirq. Or is it directly poking at the ACPI table,
> extracting a number and do a request_irq() on it? If that's the case,
> this is a bug (or at least a severe limitation) in the i8042 driver.

Yes, it gets the number 182 from ACPI tables but that's not hwirq but
instead it is the Linux IRQ number the cherryview-pinctrl driver has
assigned for the GPIO in question (as far as I can tell).

This is already reported as a bug in coreboot for the particular machine
but we need to work it around in Linux anyway, even though it may break
again if Linux IRQ numbering changes.

> If the latter, even adding all the GPIOs to the domain do not guarantee
> that the allocated interrupts will always be in the range you expect
> (depending on the order of things being initialized).
> 
> It all feels extremely fragile to me...

Yes, it is unfortunately.

There is a proper way to use GPIOs as interrupts in ACPI, namely GpioInt
resource but it has not been used in that particular machine for some
reason.

  reply	other threads:[~2017-04-06 10:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  9:59 [PATCH] pinctrl: cherryview: Add a quirk to make Acer Chromebook keyboard work again Mika Westerberg
2017-03-29 12:58 ` Linus Walleij
2017-03-29 13:19   ` Mika Westerberg
2017-03-29 13:24     ` Linus Walleij
2017-03-29 16:43   ` Marc Zyngier
2017-03-30  9:00     ` Mika Westerberg
2017-04-06  9:59       ` Mika Westerberg
2017-04-06 10:32         ` Marc Zyngier
2017-04-06 10:50           ` Mika Westerberg [this message]
2017-04-06 11:05             ` Marc Zyngier
2017-04-06 13:18               ` Mika Westerberg
2017-04-06 15:15                 ` Marc Zyngier
2017-04-07  7:27                 ` Linus Walleij
2017-04-03 18:52 ` Dmitry Torokhov
2017-04-06  8:19   ` Mika Westerberg

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=20170406105059.GV2957@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    --cc=theadamlevy@gmail.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.