[PATCH 2/2] pinctrl: sirf: put gpio interrupt pin into input status automatically

Barry Song 21cnbao at gmail.com
Wed Jan 15 03:20:31 EST 2014


2014/1/15 Linus Walleij <linus.walleij at linaro.org>:
> On Sat, Jan 11, 2014 at 9:48 AM, Barry Song <21cnbao at gmail.com> wrote:
>
>> From: Barry Song <Baohua.Song at csr.com>
>>
>> busses like i2c, spi and so on can parse the virq of their subnode automatically by
>> irq_of_parse_and_map(). for example, i2c will do that in of_i2c_register_devices().
>> people can put hwirq number attached to a gpio controller in dts, and drivers can
>> directly request the parsed virq.
>>
>> for example, for an i2c client as below,
>> tangoc-ts at 5c{
>>         compatible = "pixcir,tangoc-ts";
>>         interrupt-parent = <&gpio>;
>>         interrupts = <3 0>;
>>         reg = <0x5c>;
>> };
>> in i2c client probe(), it will request_irq(client->irq, ...) without
>> calling gpio_direction_input().
>> so here when we set irq type, we also put the pin to input direction.
>>
>> Signed-off-by: Barry Song <Baohua.Song at csr.com>
>
> OK this makes perfect sense, and is not really related to DT: we recently
> concluded that it should always be possible to request an IRQ from an
> irqchip without having to interact with the GPIO interface first. So this is
> doing the right thing.
>
> However to keep things strict we need to add calls to mark the GPIO
> lines used for IRQ, I'll see if I can fix a quick patch for this so you can
> test.

yes, Linus. i did have the same concern. people can request irq
without involving gpio. so we have to mark the pin not available to
pinctrl subsystem as well.
if people did gpio_request + gpio_to_irq + request_gpio, the pin will
be marked by pinmux as not-free, but what if people request_irq
directly, i think pinmux will not know this.
this is also buggy.

>
> Yours,
> Linus Walleij

-barry



More information about the linux-arm-kernel mailing list