All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-04  7:25 ` Y Vo
  0 siblings, 0 replies; 16+ messages in thread
From: Y Vo @ 2015-06-04  7:25 UTC (permalink / raw)
  To: linux-input, Dmitry Torokhov, linus.walleij, linux-gpio,
	devicetree, linux-arm-kernel
  Cc: Y Vo, Phong Vo, Toan Le, Loc Ho, Feng Kan, patches

GIC is designed to support two of trigger mechanisms - active level
high or edge rising. But in the gpio_keys driver, it tries to use both
edge rising and edge falling trigger. This patch fixes the gpio_keys
driver to request only the edge rising event when failed to configure the
interrupt.

Signed-off-by: Y Vo <yvo@apm.com>
---
 drivers/input/keyboard/gpio_keys.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ddf4045..7c3da2c 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -532,9 +532,23 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
 					     isr, irqflags, desc, bdata);
 	if (error < 0) {
-		dev_err(dev, "Unable to claim irq %d; error %d\n",
-			bdata->irq, error);
-		return error;
+		/*
+		 * Attempt to request again with only rising edge trigger
+		 */
+		if ((irqflags & (IRQ_TYPE_EDGE_RISING | IRQF_TRIGGER_FALLING))) {
+			irqflags = IRQ_TYPE_EDGE_RISING;
+			error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
+							     isr, irqflags, desc, bdata);
+			if (error < 0) {
+				dev_err(dev, "Unable to claim irq %d; error %d\n",
+					bdata->irq, error);
+				return error;
+			}
+		} else {
+			dev_err(dev, "Unable to claim irq %d; error %d\n",
+				bdata->irq, error);
+			return error;
+		}
 	}
 
 	return 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-04  7:25 ` Y Vo
  0 siblings, 0 replies; 16+ messages in thread
From: Y Vo @ 2015-06-04  7:25 UTC (permalink / raw)
  To: linux-arm-kernel

GIC is designed to support two of trigger mechanisms - active level
high or edge rising. But in the gpio_keys driver, it tries to use both
edge rising and edge falling trigger. This patch fixes the gpio_keys
driver to request only the edge rising event when failed to configure the
interrupt.

Signed-off-by: Y Vo <yvo@apm.com>
---
 drivers/input/keyboard/gpio_keys.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index ddf4045..7c3da2c 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -532,9 +532,23 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
 					     isr, irqflags, desc, bdata);
 	if (error < 0) {
-		dev_err(dev, "Unable to claim irq %d; error %d\n",
-			bdata->irq, error);
-		return error;
+		/*
+		 * Attempt to request again with only rising edge trigger
+		 */
+		if ((irqflags & (IRQ_TYPE_EDGE_RISING | IRQF_TRIGGER_FALLING))) {
+			irqflags = IRQ_TYPE_EDGE_RISING;
+			error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
+							     isr, irqflags, desc, bdata);
+			if (error < 0) {
+				dev_err(dev, "Unable to claim irq %d; error %d\n",
+					bdata->irq, error);
+				return error;
+			}
+		} else {
+			dev_err(dev, "Unable to claim irq %d; error %d\n",
+				bdata->irq, error);
+			return error;
+		}
 	}
 
 	return 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-04  7:25 ` Y Vo
@ 2015-06-04 17:23     ` Dmitry Torokhov
  -1 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2015-06-04 17:23 UTC (permalink / raw)
  To: Y Vo
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Phong Vo,
	Toan Le, Loc Ho, Feng Kan, patches-qTEPVZfXA3Y

Hi Y,
On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.

How do we get notified of button release if we only get interrupt on
rising edge?

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-04 17:23     ` Dmitry Torokhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2015-06-04 17:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Y,
On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.

How do we get notified of button release if we only get interrupt on
rising edge?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-04 17:23     ` Dmitry Torokhov
@ 2015-06-05  3:37       ` Feng Kan
  -1 siblings, 0 replies; 16+ messages in thread
From: Feng Kan @ 2015-06-05  3:37 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Y Vo, linux-input, Linus Walleij, linux-gpio, devicetree,
	linux-arm-kernel, Phong Vo, Toan Le, Loc Ho, patches

On Thu, Jun 4, 2015 at 10:23 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Y,
> On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
>> GIC is designed to support two of trigger mechanisms - active level
>> high or edge rising. But in the gpio_keys driver, it tries to use both
>> edge rising and edge falling trigger. This patch fixes the gpio_keys
>> driver to request only the edge rising event when failed to configure the
>> interrupt.
>
> How do we get notified of button release if we only get interrupt on
> rising edge?

On the arm gic, only the rising edge is supported. So key press can
only be defined
as rising edge and no key release.
>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-05  3:37       ` Feng Kan
  0 siblings, 0 replies; 16+ messages in thread
From: Feng Kan @ 2015-06-05  3:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 4, 2015 at 10:23 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Y,
> On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
>> GIC is designed to support two of trigger mechanisms - active level
>> high or edge rising. But in the gpio_keys driver, it tries to use both
>> edge rising and edge falling trigger. This patch fixes the gpio_keys
>> driver to request only the edge rising event when failed to configure the
>> interrupt.
>
> How do we get notified of button release if we only get interrupt on
> rising edge?

On the arm gic, only the rising edge is supported. So key press can
only be defined
as rising edge and no key release.
>
> Thanks.
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-05  3:37       ` Feng Kan
@ 2015-06-05  4:36         ` Dmitry Torokhov
  -1 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2015-06-05  4:36 UTC (permalink / raw)
  To: Feng Kan
  Cc: Y Vo, linux-input, Linus Walleij, linux-gpio, devicetree,
	linux-arm-kernel, Phong Vo, Toan Le, Loc Ho, patches

On Thu, Jun 04, 2015 at 08:37:50PM -0700, Feng Kan wrote:
> On Thu, Jun 4, 2015 at 10:23 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > Hi Y,
> > On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> >> GIC is designed to support two of trigger mechanisms - active level
> >> high or edge rising. But in the gpio_keys driver, it tries to use both
> >> edge rising and edge falling trigger. This patch fixes the gpio_keys
> >> driver to request only the edge rising event when failed to configure the
> >> interrupt.
> >
> > How do we get notified of button release if we only get interrupt on
> > rising edge?
> 
> On the arm gic, only the rising edge is supported. So key press can
> only be defined
> as rising edge and no key release.

Then it is not much of a key if we can't signal release.

gpio_keys
driver supports what it calls "interrupt only" mode where there is no
GPIO and we go just by the fact that we received interrupt. In this mode
the trigger type is expected to be set by the platform code (or OF), the
driver does not force need of both edges.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-05  4:36         ` Dmitry Torokhov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Torokhov @ 2015-06-05  4:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 04, 2015 at 08:37:50PM -0700, Feng Kan wrote:
> On Thu, Jun 4, 2015 at 10:23 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > Hi Y,
> > On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> >> GIC is designed to support two of trigger mechanisms - active level
> >> high or edge rising. But in the gpio_keys driver, it tries to use both
> >> edge rising and edge falling trigger. This patch fixes the gpio_keys
> >> driver to request only the edge rising event when failed to configure the
> >> interrupt.
> >
> > How do we get notified of button release if we only get interrupt on
> > rising edge?
> 
> On the arm gic, only the rising edge is supported. So key press can
> only be defined
> as rising edge and no key release.

Then it is not much of a key if we can't signal release.

gpio_keys
driver supports what it calls "interrupt only" mode where there is no
GPIO and we go just by the fact that we received interrupt. In this mode
the trigger type is expected to be set by the platform code (or OF), the
driver does not force need of both edges.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-04  7:25 ` Y Vo
@ 2015-06-05 12:50   ` Arnd Bergmann
  -1 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2015-06-05 12:50 UTC (permalink / raw)
  To: Y Vo
  Cc: linux-input, Dmitry Torokhov, linus.walleij, linux-gpio,
	devicetree, linux-arm-kernel, Phong Vo, Toan Le, Loc Ho,
	Feng Kan, patches

On Thursday 04 June 2015 14:25:12 Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.
> 
> Signed-off-by: Y Vo <yvo@apm.com>

I think you want to use an 'interrupts' property instead of a 'gpios'
property (or possibly both), so you can pass the right polarity.

	Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-05 12:50   ` Arnd Bergmann
  0 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2015-06-05 12:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 04 June 2015 14:25:12 Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.
> 
> Signed-off-by: Y Vo <yvo@apm.com>

I think you want to use an 'interrupts' property instead of a 'gpios'
property (or possibly both), so you can pass the right polarity.

	Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-05 12:50   ` Arnd Bergmann
@ 2015-06-08  2:48     ` Y Vo
  -1 siblings, 0 replies; 16+ messages in thread
From: Y Vo @ 2015-06-08  2:48 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-input, Dmitry Torokhov, Linus Walleij, linux-gpio,
	devicetree, linux-arm-kernel, Phong Vo, Toan Le, Loc Ho,
	Feng Kan, patches

On Fri, Jun 5, 2015 at 7:50 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday 04 June 2015 14:25:12 Y Vo wrote:
>> GIC is designed to support two of trigger mechanisms - active level
>> high or edge rising. But in the gpio_keys driver, it tries to use both
>> edge rising and edge falling trigger. This patch fixes the gpio_keys
>> driver to request only the edge rising event when failed to configure the
>> interrupt.
>>
>> Signed-off-by: Y Vo <yvo@apm.com>
>
> I think you want to use an 'interrupts' property instead of a 'gpios'
> property (or possibly both), so you can pass the right polarity.

        gpio-keys {
                compatible = "gpio-keys";
                apm_ctrl_name = "Power Button";
                btn2 {
                        label = "EXT_INT2";
                        gpios = <&sbgpio 13 0x0>;
                        linux,code = <116>;
                        linux,input-type = <0x1>;     /* EV_KEY */
                };
        };

         sbgpio: sbgpio@17001000{
                        compatible = "apm,xgene-gpio-sb";
                        reg = <0x0 0x17001000 0x0 0x400>;
                        #gpio-cells = <2>;
                        gpio-controller;
                        interrupts =    <0x0 0x28 0x1>,
                                        <0x0 0x29 0x1>,
                                        <0x0 0x2a 0x1>,
                                        <0x0 0x2b 0x1>,
                                        <0x0 0x2c 0x1>,
                                        <0x0 0x2d 0x1>;
                };
I can change the polarity of interrupt in the sbgpio node, but the
issue here is the gpio_key driver always set interrupt type to
(irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING). And the GIC
driver only support edge rising or level high. So that's our issue.

>
>         Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-08  2:48     ` Y Vo
  0 siblings, 0 replies; 16+ messages in thread
From: Y Vo @ 2015-06-08  2:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 5, 2015 at 7:50 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thursday 04 June 2015 14:25:12 Y Vo wrote:
>> GIC is designed to support two of trigger mechanisms - active level
>> high or edge rising. But in the gpio_keys driver, it tries to use both
>> edge rising and edge falling trigger. This patch fixes the gpio_keys
>> driver to request only the edge rising event when failed to configure the
>> interrupt.
>>
>> Signed-off-by: Y Vo <yvo@apm.com>
>
> I think you want to use an 'interrupts' property instead of a 'gpios'
> property (or possibly both), so you can pass the right polarity.

        gpio-keys {
                compatible = "gpio-keys";
                apm_ctrl_name = "Power Button";
                btn2 {
                        label = "EXT_INT2";
                        gpios = <&sbgpio 13 0x0>;
                        linux,code = <116>;
                        linux,input-type = <0x1>;     /* EV_KEY */
                };
        };

         sbgpio: sbgpio at 17001000{
                        compatible = "apm,xgene-gpio-sb";
                        reg = <0x0 0x17001000 0x0 0x400>;
                        #gpio-cells = <2>;
                        gpio-controller;
                        interrupts =    <0x0 0x28 0x1>,
                                        <0x0 0x29 0x1>,
                                        <0x0 0x2a 0x1>,
                                        <0x0 0x2b 0x1>,
                                        <0x0 0x2c 0x1>,
                                        <0x0 0x2d 0x1>;
                };
I can change the polarity of interrupt in the sbgpio node, but the
issue here is the gpio_key driver always set interrupt type to
(irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING). And the GIC
driver only support edge rising or level high. So that's our issue.

>
>         Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-04  7:25 ` Y Vo
@ 2015-06-08  6:30     ` Uwe Kleine-König
  -1 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2015-06-08  6:30 UTC (permalink / raw)
  To: Y Vo
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA, Dmitry Torokhov,
	linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Feng Kan,
	Phong Vo, patches-qTEPVZfXA3Y, Loc Ho, Toan Le

Hello,

On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.
Is it possible to fix that in the GIC driver? I.e. let it switch the
trigger direction to falling when it fired for raising?

This would require to read out the current level, not sure this is
possible?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-08  6:30     ` Uwe Kleine-König
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Kleine-König @ 2015-06-08  6:30 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Thu, Jun 04, 2015 at 02:25:12PM +0700, Y Vo wrote:
> GIC is designed to support two of trigger mechanisms - active level
> high or edge rising. But in the gpio_keys driver, it tries to use both
> edge rising and edge falling trigger. This patch fixes the gpio_keys
> driver to request only the edge rising event when failed to configure the
> interrupt.
Is it possible to fix that in the GIC driver? I.e. let it switch the
trigger direction to falling when it fired for raising?

This would require to read out the current level, not sure this is
possible?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
  2015-06-08  2:48     ` Y Vo
@ 2015-06-10 23:08       ` Arnd Bergmann
  -1 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2015-06-10 23:08 UTC (permalink / raw)
  To: Y Vo
  Cc: linux-input, Dmitry Torokhov, Linus Walleij, linux-gpio,
	devicetree, linux-arm-kernel, Phong Vo, Toan Le, Loc Ho,
	Feng Kan, patches

On Monday 08 June 2015 09:48:29 Y Vo wrote:
> On Fri, Jun 5, 2015 at 7:50 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Thursday 04 June 2015 14:25:12 Y Vo wrote:
> >> GIC is designed to support two of trigger mechanisms - active level
> >> high or edge rising. But in the gpio_keys driver, it tries to use both
> >> edge rising and edge falling trigger. This patch fixes the gpio_keys
> >> driver to request only the edge rising event when failed to configure the
> >> interrupt.
> >>
> >> Signed-off-by: Y Vo <yvo@apm.com>
> >
> > I think you want to use an 'interrupts' property instead of a 'gpios'
> > property (or possibly both), so you can pass the right polarity.
> 
>         gpio-keys {
>                 compatible = "gpio-keys";
>                 apm_ctrl_name = "Power Button";
>                 btn2 {
>                         label = "EXT_INT2";
>                         gpios = <&sbgpio 13 0x0>;
>                         linux,code = <116>;
>                         linux,input-type = <0x1>;     /* EV_KEY */
>                 };
>         };
> 
>          sbgpio: sbgpio@17001000{
>                         compatible = "apm,xgene-gpio-sb";
>                         reg = <0x0 0x17001000 0x0 0x400>;
>                         #gpio-cells = <2>;
>                         gpio-controller;
>                         interrupts =    <0x0 0x28 0x1>,
>                                         <0x0 0x29 0x1>,
>                                         <0x0 0x2a 0x1>,
>                                         <0x0 0x2b 0x1>,
>                                         <0x0 0x2c 0x1>,
>                                         <0x0 0x2d 0x1>;
>                 };
> I can change the polarity of interrupt in the sbgpio node, but the
> issue here is the gpio_key driver always set interrupt type to
> (irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING). And the GIC
> driver only support edge rising or level high. So that's our issue.

No, please do as I wrote, and use an interrupts property in the gpio-keys
node.

	Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt
@ 2015-06-10 23:08       ` Arnd Bergmann
  0 siblings, 0 replies; 16+ messages in thread
From: Arnd Bergmann @ 2015-06-10 23:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 08 June 2015 09:48:29 Y Vo wrote:
> On Fri, Jun 5, 2015 at 7:50 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Thursday 04 June 2015 14:25:12 Y Vo wrote:
> >> GIC is designed to support two of trigger mechanisms - active level
> >> high or edge rising. But in the gpio_keys driver, it tries to use both
> >> edge rising and edge falling trigger. This patch fixes the gpio_keys
> >> driver to request only the edge rising event when failed to configure the
> >> interrupt.
> >>
> >> Signed-off-by: Y Vo <yvo@apm.com>
> >
> > I think you want to use an 'interrupts' property instead of a 'gpios'
> > property (or possibly both), so you can pass the right polarity.
> 
>         gpio-keys {
>                 compatible = "gpio-keys";
>                 apm_ctrl_name = "Power Button";
>                 btn2 {
>                         label = "EXT_INT2";
>                         gpios = <&sbgpio 13 0x0>;
>                         linux,code = <116>;
>                         linux,input-type = <0x1>;     /* EV_KEY */
>                 };
>         };
> 
>          sbgpio: sbgpio at 17001000{
>                         compatible = "apm,xgene-gpio-sb";
>                         reg = <0x0 0x17001000 0x0 0x400>;
>                         #gpio-cells = <2>;
>                         gpio-controller;
>                         interrupts =    <0x0 0x28 0x1>,
>                                         <0x0 0x29 0x1>,
>                                         <0x0 0x2a 0x1>,
>                                         <0x0 0x2b 0x1>,
>                                         <0x0 0x2c 0x1>,
>                                         <0x0 0x2d 0x1>;
>                 };
> I can change the polarity of interrupt in the sbgpio node, but the
> issue here is the gpio_key driver always set interrupt type to
> (irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING). And the GIC
> driver only support edge rising or level high. So that's our issue.

No, please do as I wrote, and use an interrupts property in the gpio-keys
node.

	Arnd

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-06-10 23:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04  7:25 [PATCH v0] gpio_keys: fix gpio key driver to proper support GIC interrupt Y Vo
2015-06-04  7:25 ` Y Vo
2015-06-05 12:50 ` Arnd Bergmann
2015-06-05 12:50   ` Arnd Bergmann
2015-06-08  2:48   ` Y Vo
2015-06-08  2:48     ` Y Vo
2015-06-10 23:08     ` Arnd Bergmann
2015-06-10 23:08       ` Arnd Bergmann
     [not found] ` <1433402712-21399-1-git-send-email-yvo-qTEPVZfXA3Y@public.gmane.org>
2015-06-04 17:23   ` Dmitry Torokhov
2015-06-04 17:23     ` Dmitry Torokhov
2015-06-05  3:37     ` Feng Kan
2015-06-05  3:37       ` Feng Kan
2015-06-05  4:36       ` Dmitry Torokhov
2015-06-05  4:36         ` Dmitry Torokhov
2015-06-08  6:30   ` Uwe Kleine-König
2015-06-08  6:30     ` Uwe Kleine-König

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.