linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK
@ 2013-11-28 15:00 Rafał Miłecki
  2013-11-28 15:26 ` Rafał Miłecki
  2013-11-29 14:57 ` Rafał Miłecki
  0 siblings, 2 replies; 3+ messages in thread
From: Rafał Miłecki @ 2013-11-28 15:00 UTC (permalink / raw)
  To: linux-input, Jiri Kosina; +Cc: Hauke Mehrtens, Rafał Miłecki

On bcm47xx arch we have GPIO keys with interrupts, but after every IRQ
we have to change GPIO interrupt polarity. This is necessary to stop
hardware from generating IRQs all the time and set it into state that
will generate another IRQ on button release.
This is not exactly an ACK, but I think it makes sense to use this more
generic name.
With this patch we can easily implement GPIO keys support for bcm47xx
just using gpio_keys.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
This change to gpio_keys was proposed as an alternative to
re-implementing most of the gpio_keys code in arch tree, see patch:
MIPS: BCM47XX: Prepare support for GPIO buttons
http://www.linux-mips.org/archives/linux-mips/2013-11/msg00160.html

Please let me know if this is acceptable change for you.
---
 drivers/input/keyboard/gpio_keys.c |    2 ++
 include/linux/gpio_keys.h          |    1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index b29ca65..c6e41be 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -362,6 +362,8 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
 
 	BUG_ON(irq != bdata->irq);
 
+	if (bdata->button->ack_irq)
+		bdata->button->ack_irq(bdata->button);
 	if (bdata->button->wakeup)
 		pm_stay_awake(bdata->input->dev.parent);
 	if (bdata->timer_debounce)
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index a7e977f..3c4244e 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -15,6 +15,7 @@ struct gpio_keys_button {
 	bool can_disable;
 	int value;		/* axis value for EV_ABS */
 	unsigned int irq;	/* Irq number in case of interrupt keys */
+	void (*ack_irq)(const struct gpio_keys_button *button);
 };
 
 struct gpio_keys_platform_data {
-- 
1.7.10.4

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

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

* Re: [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK
  2013-11-28 15:00 [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK Rafał Miłecki
@ 2013-11-28 15:26 ` Rafał Miłecki
  2013-11-29 14:57 ` Rafał Miłecki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2013-11-28 15:26 UTC (permalink / raw)
  To: linux-input, Jiri Kosina; +Cc: Hauke Mehrtens

2013/11/28 Rafał Miłecki <zajec5@gmail.com>:
> On bcm47xx arch we have GPIO keys with interrupts, but after every IRQ
> we have to change GPIO interrupt polarity. This is necessary to stop
> hardware from generating IRQs all the time and set it into state that
> will generate another IRQ on button release.
> This is not exactly an ACK, but I think it makes sense to use this more
> generic name.
> With this patch we can easily implement GPIO keys support for bcm47xx
> just using gpio_keys.

Example usage:
http://www.linux-mips.org/archives/linux-mips/2013-11/msg00163.html
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK
  2013-11-28 15:00 [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK Rafał Miłecki
  2013-11-28 15:26 ` Rafał Miłecki
@ 2013-11-29 14:57 ` Rafał Miłecki
  1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2013-11-29 14:57 UTC (permalink / raw)
  To: linux-input, Jiri Kosina; +Cc: Hauke Mehrtens

2013/11/28 Rafał Miłecki <zajec5@gmail.com>:
> On bcm47xx arch we have GPIO keys with interrupts, but after every IRQ
> we have to change GPIO interrupt polarity. This is necessary to stop
> hardware from generating IRQs all the time and set it into state that
> will generate another IRQ on button release.
> This is not exactly an ACK, but I think it makes sense to use this more
> generic name.
> With this patch we can easily implement GPIO keys support for bcm47xx
> just using gpio_keys.

I think I missed quite important kernel feature: irq_domain... I'll
just try to use it.

Please ignore this patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2013-11-29 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-28 15:00 [PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK Rafał Miłecki
2013-11-28 15:26 ` Rafał Miłecki
2013-11-29 14:57 ` Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).