Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370542

Re: [LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS from devicetree

From Linus Walleij <linus.walleij@linaro.org>
Newsgroups linux.kernel
Subject Re: [LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS from devicetree
Date 2016-04-04 13:10 +0200
Message-ID <rkaym-289-9@gated-at.bofh.it> (permalink)
References <rk9LX-1vR-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Apr 4, 2016 at 11:56 AM, Nava kishore Manne
<nava.manne@xilinx.com> wrote:

> This patch adds the support to read the IRQ_FLAGS from the device
> instead of hard code the flags in gpio_keys_setup_key().

NACK

>                 sw14 {
>                         label = "sw14";
>                         gpios = <&gpio0 12 1>;
>                         /*
>                          * Triggering Type:
>                          *
>                          * 1 - edge rising
>                          * 2 - edge falling
>                          * 4 - level active high
>                          * 8 - level active low
>                          *
>                          */

You are completely violating the existing GPIO flags from
include/dt-bindings/gpio/gpio.h

As you will see, for a twocell GPIO flags are already
clearly defined for 0,1,2 and 3. (Bit 0 & 1).

Further, these IRQ edge/level flags already exist in
include/dt-bindings/interrupt-controller/irq.h
but you should not be using those either, because they
do not mix with a GPIO specifier, it's a bit like oil and water.

The standard GPIO bindings already has
GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW
which makes it pretty clear that a GPIO line marked
as GPIO_ACTIVE_HIGH should trigger either on
rising edge or level active high and vice versa.

The only information you could *possibly* lack is
whether the IRQ should be edge or level triggered.

But level triggered GPIO buttons *does* *not* *make*
*sense* *at* *all*.

Think about it:

The IRQ line goes level high or low because a user
pressed a button with his/her thumb. Then that is wired
in as a level IRQ. So what are we going to do? Wait in
the interrupt handler until the user removes his/her
thumb?

Level IRQs on GPIOs only makes sense for devices
off-chip where you can talk to the device and ACK the
interrupt, and in this case "talk" does not mean wire
up a speaker telling the user to remove the thumb from
the button because we have recieved the interrupt, albeit
that would be the real-world analogy.

Please tell us what you are actually trying to solve.

Yours,
Linus Walleij

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS from devicetree Nava kishore Manne <nava.manne@xilinx.com> - 2016-04-04 12:20 +0200
  Re: [LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS  from devicetree Linus Walleij <linus.walleij@linaro.org> - 2016-04-04 13:10 +0200
    RE: [LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS  from devicetree Nava kishore Manne <nava.manne@xilinx.com> - 2016-04-06 14:10 +0200
      Re: [LINUX PATCH v2] gpio_keys: Added support to read the IRQ_FLAGS  from devicetree Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-04-06 19:50 +0200

csiph-web