From: Patrice CHOTARD <patrice.chotard@st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Peter Griffin <peter.griffin@linaro.org>,
Lee Jones <lee.jones@linaro.org>
Subject: Re: [PATCH 1/1] pinctrl: st: add irq_request_resources callback
Date: Thu, 16 Mar 2017 15:39:19 +0000 [thread overview]
Message-ID: <e80366b0-a044-0908-13bd-49856827a407@st.com> (raw)
In-Reply-To: <CACRpkdb1WYRYifUp=C9QpEXN4ntxNfFx_H1+mA1-0UJw=dUFPQ@mail.gmail.com>
On 03/14/2017 03:05 PM, Linus Walleij wrote:
> On Mon, Feb 27, 2017 at 2:49 PM, <patrice.chotard@st.com> wrote:
>
>> From: Patrice Chotard <patrice.chotard@st.com>
>>
>> When using GPIO as IRQ source, the GPIO must be configured
>> in INPUT. The callback dedicated for this was missing in
>> pinctrl-st driver.
>>
>> This fix the following kernel error when trying to lock a gpio
>> as IRQ:
>>
>> [ 7.521095] gpio gpiochip7: (PIO11): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
>> [ 7.526018] gpio gpiochip7: (PIO11): unable to lock HW IRQ 6 for IRQ
>> [ 7.529405] genirq: Failed to request resources for 0-0053 (irq 81) on irqchip GPIO
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>
> I see what problem you are trying to solve.
>
>> +static int st_gpio_irq_request_resources(struct irq_data *d)
>> +{
>> + struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
>> + int pin = d->hwirq;
>> +
>> + return st_gpio_direction_input(gc, pin);
>> +}
> (...)
>> + .irq_request_resources = st_gpio_irq_request_resources,
>
> But this is just hiding the problem I'm afraid.
>
Hi Linus
> Now thay you override .irq_request_resources()
> gpiochip_irq_reqres() will not be called, so then you have
> to lock the irq in the driver, with something like:
>
> ret = gpiochip_lock_as_irq(&chip->gc, d->hwirq);
> if (ret)
> goto out;
>
Ah yes, i didn't noticed that point, thanks for the tips.
> You also have to implement the .irq_release_resources()
> callback and unlock the IRQ there.
In this case, yes the release becomes mandatory.
I will send a v2.
Thanks
Patrice
>
> Yours,
> Linus Walleij
>
prev parent reply other threads:[~2017-03-16 15:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-27 13:49 patrice.chotard
2017-03-14 14:05 ` Linus Walleij
2017-03-16 15:39 ` Patrice CHOTARD [this message]
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=e80366b0-a044-0908-13bd-49856827a407@st.com \
--to=patrice.chotard@st.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.griffin@linaro.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®