All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Grant Likely <grant.likely@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: 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: Wed, 29 Mar 2017 17:43:49 +0100	[thread overview]
Message-ID: <da0935b8-245a-6920-4749-ade6eb278dba@arm.com> (raw)
In-Reply-To: <CACRpkdYm_wzJWskrkStgjXPM=F93S3K3HO-c5Tt=qSVJOxkGAw@mail.gmail.com>

On 29/03/17 13:58, Linus Walleij wrote:
> On Wed, Mar 29, 2017 at 11:59 AM, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> 
>> However, it seems some CYAN Chromebooks, including Acer Chromebook
>> hardcodes these Linux IRQ numbers in the ACPI tables of the machine.
>> Since the numbering is different now, the IRQ meant for keyboard does
>> not match the Linux virtual IRQ number anymore making the keyboard
>> non-functional.
> 
> Well ain't that great. They made the totally unstable Linux IRQ number
> space into an ABI.

I'm puzzled as to how this could have ever worked. Is that because we
used to have irq == hwirq, and that assertion doesn't hold true anymore?

> 
> I wonder what the irqchip people think about that. I think Grant warned us
> that this could happen.
> 
>> Work this around by adding special quirk just for these machines where
>> we add back all GPIOs to the irqdomain. Rest of the Cherryview/Braswell
>> based machines will not be affected by the change.
> 
> Quirking seems right. But:
> 
>> +/*
>> + * Certain machines seem to hardcode Linux IRQ numbers in their ACPI
>> + * tables. Since we leave GPIOs that are not capable of generating
>> + * interrupts out of the irqdomain the numbering will be different and
>> + * cause devices using the hardcoded IRQ numbers fail. In order not to
>> + * break such machines we will only mask pins from irqdomain if the machine
>> + * is not listed below.
>> + */
>> +static const struct dmi_system_id chv_no_valid_mask[] = {
>> +       {
>> +               /* See https://bugzilla.kernel.org/show_bug.cgi?id=194945 */
>> +               .ident = "Acer Chromebook (CYAN)",
>> +               .matches = {
>> +                       DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
>> +                       DMI_MATCH(DMI_PRODUCT_NAME, "Edgar"),
>> +               },
>> +       }
>> +};
> 
> We match but...
> 
>>         const struct chv_gpio_pinrange *range;
>>         struct gpio_chip *chip = &pctrl->chip;
>> +       bool need_valid_mask = !dmi_check_system(chv_no_valid_mask);
>>         int ret, i, offset;
>>
>>         *chip = chv_gpio_chip;
>> @@ -1536,7 +1557,7 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
>>         chip->label = dev_name(pctrl->dev);
>>         chip->parent = pctrl->dev;
>>         chip->base = -1;
>> -       chip->irq_need_valid_mask = true;
>> +       chip->irq_need_valid_mask = need_valid_mask;
> 
> 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.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  parent reply	other threads:[~2017-03-29 16:43 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 [this message]
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
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=da0935b8-245a-6920-4749-ade6eb278dba@arm.com \
    --to=marc.zyngier@arm.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=mika.westerberg@linux.intel.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.