[PATCH] Input: gpio_keys - add ack_irq callback for HW that needs ACK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux