diff options
author | Xinyu Chen <xinyu.chen@freescale.com> | 2010-09-10 17:17:12 +0800 |
---|---|---|
committer | Xinyu Chen <xinyu.chen@freescale.com> | 2010-09-10 17:23:18 +0800 |
commit | daae245a544d8b23dfa74c6108c35cebef81b8e7 (patch) | |
tree | a35f6e1eb2b46e6a7431d4f071ebe5299917d093 /drivers | |
parent | 7bbe5d7a5203a07496ec372ab55563a2e230d03e (diff) | |
download | u-boot-imx-daae245a544d8b23dfa74c6108c35cebef81b8e7.zip u-boot-imx-daae245a544d8b23dfa74c6108c35cebef81b8e7.tar.gz u-boot-imx-daae245a544d8b23dfa74c6108c35cebef81b8e7.tar.bz2 |
ENGR00127368 UBOOT: Make the android recovery code common for platformsrel_imx_2.6.31_10.09.00
Move the android recovery codes into common/recovery.c.
Cut the keypad detecting time. Now we only need detect
there's POWER and HOME key pressing at the time scanning
keyboard matrix. So user must hold these two keys when bootup to
enter recovery mode. This can reduce the uboot boot time with
recovery mode configured.
Later /cache file checking for recovery command should be merged
into the common/recovery.c
Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/mxc_keyb.c | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/input/mxc_keyb.c b/drivers/input/mxc_keyb.c index ec65ab5..fae3b69 100644 --- a/drivers/input/mxc_keyb.c +++ b/drivers/input/mxc_keyb.c @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved. */ /* @@ -326,33 +326,40 @@ static int mxc_kpp_reset(void) return 0; } -int mxc_kpp_getc(struct kpp_key_info *key_info) +int mxc_kpp_getc(struct kpp_key_info **key_info) { int col, row; - static int key_cnt; + int key_cnt; unsigned short reg_val; short scancode = 0; + int index = 0; + struct kpp_key_info *keyi; reg_val = __raw_readw(KPSR); - if (!key_cnt) { - if (reg_val & KBD_STAT_KPKD) { - /* - * Disable key press(KDIE status bit) interrupt - */ - reg_val &= ~KBD_STAT_KDIE; - __raw_writew(reg_val, KPSR); + if (reg_val & KBD_STAT_KPKD) { + /* + * Disable key press(KDIE status bit) interrupt + */ + reg_val &= ~KBD_STAT_KDIE; + __raw_writew(reg_val, KPSR); #ifdef KPP_DEBUG - mxc_kpp_dump_regs(); + mxc_kpp_dump_regs(); #endif - key_cnt = mxc_kpp_scan_matrix(); - } else { - return 0; - } + key_cnt = mxc_kpp_scan_matrix(); + } else { + return 0; } + if (key_cnt <= 0) + return 0; + + *key_info = keyi = + (struct kpp_key_info *)malloc + (sizeof(struct kpp_key_info) * key_cnt); + /* * This switch case statement is the * implementation of state machine of debounc @@ -399,15 +406,16 @@ int mxc_kpp_getc(struct kpp_key_info *key_info) scancode = press_scancode[row][col]; - key_info->val = mxckpd_keycodes[scancode]; - key_info->evt = KDepress; + keyi[index].val = mxckpd_keycodes[scancode]; + keyi[index++].evt = KDepress; KPP_PRINTF("KStateFirstDown: scan=%d val=%d\n", scancode, mxckpd_keycodes[scancode]); + if (index >= key_cnt) + goto key_detect; + kpp_dev.iKeyState = KStateDown; press_scancode[row][col] = -1; - - goto key_detect; } } } @@ -420,29 +428,23 @@ int mxc_kpp_getc(struct kpp_key_info *key_info) scancode = scancode - MXC_KEYRELEASE; - key_info->val = mxckpd_keycodes[scancode]; - key_info->evt = KRelease; + keyi[index].val = mxckpd_keycodes[scancode]; + keyi[index++].evt = KRelease; KPP_PRINTF("KStateFirstUp: scan=%d val=%d\n", scancode, mxckpd_keycodes[scancode]); + if (index >= key_cnt) + goto key_detect; kpp_dev.iKeyState = KStateUp; release_scancode[row][col] = -1; - - goto key_detect; } } } - return 0; - key_detect: - /* udelay(KScanRate); */ - key_cnt = mxc_kpp_scan_matrix(); - - if (0 == key_cnt) - mxc_kpp_reset(); - return 1; + mxc_kpp_reset(); + return key_cnt; } /*! |