On Tue, Jun 4, 2019 at 3:05 PM Petr Štetiar <[email protected]> wrote:
>
> Commit afc056d7dc83 ("gpio-button-hotplug: support interrupt
> properties") changed the gpio-keys interrupt handling logic in a way,
> that it always misses first event, which causes issues with rc.button
> scripts, so this patch restores the previous behaviour.
>
> Cc: Christian Lamparter <[email protected]>
> Fixes: afc056d7dc83 ("gpio-button-hotplug: support interrupt properties")
> Reported-by: Kristian Evensen <[email protected]>
> Signed-off-by: Petr Štetiar <[email protected]>
> ---
>
> diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c 
> b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> index f429f8c0271f..81697e9c4cf6 100644
> --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
> @@ -344,10 +344,7 @@ static void gpio_keys_irq_work_func(struct work_struct 
> *work)
>
>         if (state != bdata->last_state) {
>                 unsigned int type = bdata->b->type ?: EV_KEY;
> -
> -               if (bdata->last_state != -1 || type == EV_SW)
> -                       button_hotplug_event(bdata, type, state);
> -
> +               button_hotplug_event(bdata, type, state);
>                 bdata->last_state = state;
>         }
>  }

Thanks. initially I ran into issues with the WNDR4700 and WNDAP630 when
I was testing the interrupt-driven gpio-keys. On boot-up, they would produce
spurious ghost key presses when gpio-keys enabled the interrupt for the first
time. I'll test this again (don't have the HW at the moment... but I will on
Sunday),


Note: If we want to revert to the previous behavior (afc056d7dc83) and closer
to upstream gpio_keys.c. we have to drop even more.
@Kristian Evensen, can you please check if the following patch would also
resolve the issues you have been experiencing?

I had to attach the patch as a file since gmail's webmail interface now seems to
eat all the tabs. I hope this still gets through.
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 11c914d4ef..6de8f56cdf 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -348,16 +348,9 @@ static void gpio_keys_irq_work_func(struct work_struct *work)
 {
 	struct gpio_keys_button_data *bdata = container_of(work,
 		struct gpio_keys_button_data, work.work);
-	int state = gpio_button_get_value(bdata);
 
-	if (state != bdata->last_state) {
-		unsigned int type = bdata->b->type ?: EV_KEY;
-
-		if (bdata->last_state != -1 || type == EV_SW)
-			button_hotplug_event(bdata, type, state);
-
-		bdata->last_state = state;
-	}
+	button_hotplug_event(bdata, bdata->b->type ?: EV_KEY,
+			     gpio_button_get_value(bdata));
 }
 
 static irqreturn_t button_handle_irq(int irq, void *_bdata)
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to