[PATCH 02/13] qi-gta02-add-ui-debounce.patch
Andy Green
andy at openmoko.com
Mon Dec 1 02:15:50 CET 2008
Signed-off-by: Andy Green <andy at openmoko.com>
---
src/cpu/s3c2442/gta02.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/cpu/s3c2442/gta02.c b/src/cpu/s3c2442/gta02.c
index f7405e6..2ea520a 100644
--- a/src/cpu/s3c2442/gta02.c
+++ b/src/cpu/s3c2442/gta02.c
@@ -368,6 +368,30 @@ static void close_gta02(void)
(bb_s3c24xx.close)();
}
+static u8 get_ui_keys_gta02(void)
+{
+ u8 keys;
+ u8 ret;
+ static u8 old_keys = 0; /* previous state for debounce */
+ static u8 old_ret = 0; /* previous debounced output for edge detect */
+
+ /* GPF6 is AUX on GTA02, map to UI_ACTION_ADD_DEBUG, down = 1 */
+ keys = !!(rGPFDAT & (1 << 6));
+
+ if (keys == old_keys)
+ ret = keys;
+ else
+ ret = old_keys;
+
+ /* edge action */
+ if ((ret & 1) && !(old_ret & 1))
+ ret |= UI_ACTION_SKIPKERNEL;
+
+ old_keys = keys;
+ old_ret = ret;
+
+ return ret;
+}
/*
* our API for bootloader on this machine
*/
@@ -383,6 +407,7 @@ const struct board_api board_api_gta02 = {
.port_init = port_init_gta02,
.putc = putc_gta02,
.close = close_gta02,
+ .get_ui_keys = get_ui_keys_gta02,
.commandline_board = "mtdparts=physmap-flash:-(nor);" \
"neo1973-nand:" \
"0x00040000(qi)," \
More information about the openmoko-kernel
mailing list