lkml.org 
[lkml]   [2019]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] gpiolib: fix incorrect IRQ requesting of an active-low lineevent
pt., 5 lip 2019 o 11:30 Michael Wu <michael.wu@vatics.com> napisał(a):
>
> When a pin is active-low, logical trigger edge should be inverted
> to match the same interrupt opportunity.
>
> For example, a button pushed trigger falling edge in ACTIVE_HIGH
> case; in ACTIVE_LOW case, the button pushed trigger rising edge.
> For user space the IRQ requesting doesn't need to do any
> modification except to configuring GPIOHANDLE_REQUEST_ACTIVE_LOW.
>
> Signed-off-by: Michael Wu <michael.wu@vatics.com>
> ---
> drivers/gpio/gpiolib.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index e013d417a936..b98466a05091 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -956,9 +956,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
> }
>
> if (eflags & GPIOEVENT_REQUEST_RISING_EDGE)
> - irqflags |= IRQF_TRIGGER_RISING;
> + irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
> + IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
> if (eflags & GPIOEVENT_REQUEST_FALLING_EDGE)
> - irqflags |= IRQF_TRIGGER_FALLING;
> + irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
> + IRQ_TRIGGER_RISING : IRQF_TRIGGER_FALLING;
> irqflags |= IRQF_ONESHOT;
>
> INIT_KFIFO(le->events);
> --
> 2.17.1
>

Is this something that causes a bug in user-space? Any scenario to reproduce it?

Bart

\
 
 \ /
  Last update: 2019-07-05 11:34    [W:0.065 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site