summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2013-11-20 14:01:26 -0600
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-11-21 04:31:08 +0000
commit8db204073ac55ee1f5ba6a450983dbad0c9d0a36 (patch)
tree70fc271fc1ff3156518ad9b32265e8636a3ce279
parent14c7191b53607e46187cea6e95ebf869f3b85e2a (diff)
downloadchrome-ec-8db204073ac55ee1f5ba6a450983dbad0c9d0a36.tar.gz
lm4: add option for using gpio as kebyoard interrupt
On certain boards it's no feasible to use the SERIRQ method for generating the kebyboard interrupt. To that end provide CONFIG_KEYBOARD_IRQ_GPIO option which specifies the negative edge-triggered gpio for the keyaboard interrupt. BUG=chrome-os-partner:23965 BRANCH=None TEST=Built and booted rambi using this option. Keyboard works in kernel with interrupts for i8042 device. Change-Id: I64f7e9530841c184d2a33821126ec446c96bb0f0 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/177188 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/lm4/lpc.c20
-rw-r--r--include/config.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 610517571c..afbe31f717 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -87,6 +87,15 @@ static void wait_irq_sent(void)
udelay(4);
}
+#ifdef CONFIG_KEYBOARD_IRQ_GPIO
+static void keyboard_irq_assert(void)
+{
+ /* Negative edge-triggered keyboard interrupt. */
+ gpio_set_level(CONFIG_KEYBOARD_IRQ_GPIO, 0);
+ wait_irq_sent();
+ gpio_set_level(CONFIG_KEYBOARD_IRQ_GPIO, 1);
+}
+#else
static void wait_send_serirq(uint32_t lpcirqctl)
{
LM4_LPC_LPCIRQCTL = lpcirqctl;
@@ -117,6 +126,13 @@ static void lpc_manual_irq(int irq_num)
wait_send_serirq(common_bits);
}
+static inline void keyboard_irq_assert(void)
+{
+ /* Use serirq method. */
+ lpc_manual_irq(1); /* IRQ#1 */
+}
+#endif
+
/**
* Generate SMI pulse to the host chipset via GPIO.
*
@@ -253,7 +269,7 @@ void lpc_keyboard_put_char(uint8_t chr, int send_irq)
{
LPC_POOL_KEYBOARD[1] = chr;
if (send_irq) {
- lpc_manual_irq(1); /* IRQ#1 */
+ keyboard_irq_assert();
}
}
@@ -271,7 +287,7 @@ void lpc_keyboard_clear_buffer(void)
void lpc_keyboard_resume_irq(void)
{
if (lpc_keyboard_has_char())
- lpc_manual_irq(1);
+ keyboard_irq_assert();
}
#ifdef CONFIG_UART_HOST
diff --git a/include/config.h b/include/config.h
index 3167e00d8c..0893f604c4 100644
--- a/include/config.h
+++ b/include/config.h
@@ -442,6 +442,9 @@
/* Enable extra debugging output from keyboard modules */
#undef CONFIG_KEYBOARD_DEBUG
+/* The board uses a negative edge-triggered GPIO for keyboard interrupts. */
+#undef CONFIG_KEYBOARD_IRQ_GPIO
+
/* Compile code for 8042 keyboard protocol */
#undef CONFIG_KEYBOARD_PROTOCOL_8042