From: Urja Rannikko Date: Tue, 25 Jun 2013 03:59:02 +0000 (+0100) Subject: pandora: kbd: add some pandora game GPIO inputs as modifiers (ctrl,shift) X-Git-Tag: sz_175~8 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fad5b671e899f0ebc73ae34347a7db31e7548671;p=pandora-u-boot.git pandora: kbd: add some pandora game GPIO inputs as modifiers (ctrl,shift) Signed-off-by: Urja Rannikko --- diff --git a/board/pandora/kbd.c b/board/pandora/kbd.c index 6cc69dfcc55..5bfef4f0b7b 100644 --- a/board/pandora/kbd.c +++ b/board/pandora/kbd.c @@ -40,6 +40,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -96,6 +103,10 @@ static void twl4030_kp_fill(u8 k, u8 mods) k = keymap[k+128]; } else { k = keymap[k]; + if (mods & 1) { /* ctrl key was pressed */ + if (k >= 'a' && k <= 'z') + k -= 'a' - 1; + } } if (k) { keybuf[keybuf_tail++] = k; @@ -134,8 +145,12 @@ int twl4030_kbd_init (void) return 0; } + + + int twl4030_kbd_tstc(void) { + struct gpio *gpio4_base = (struct gpio *)OMAP34XX_GPIO4_BASE; u8 c, r, dk, i; u8 intr; u8 mods; @@ -163,6 +178,16 @@ int twl4030_kbd_tstc(void) mods = keys[2]&0x20?2:0; /* Fn */ if (keys[7]&0x08) mods |= 4; /* Shift */ + /* Add L from GPIOs as shift also */ + if (!(readl(&gpio4_base->datain) & GPIO6)) /* R */ + mods |= 4; + + /* Add ctrl state from the GPIOs (R or select) */ + if (!(readl(&gpio4_base->datain) & GPIO9)) /* R */ + mods |= 1; + if (!(readl(&gpio4_base->datain) & GPIO8)) /* Select */ + mods |= 1; + for (c = 0; c < 8; c++) { /* get newly pressed keys only */