Skip to content

Commit

Permalink
Input: pxa27x_keypad direct key may be low active
Browse files Browse the repository at this point in the history
KPDK_DK only indicates the pin level of direct key.
So it is related to board, and low level may be active which
indicates that a key is pressed.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
  • Loading branch information
Chao Xie authored and Haojian Zhuang committed Apr 27, 2012
1 parent 5545fa8 commit ee1d804
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions arch/arm/plat-pxa/include/plat/pxa27x_keypad.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct pxa27x_keypad_platform_data {
/* direct keys */
int direct_key_num;
unsigned int direct_key_map[MAX_DIRECT_KEY_NUM];
/* the key output may be low active */
int direct_key_low_active;

/* rotary encoders 0 */
int enable_rotary0;
Expand Down
10 changes: 9 additions & 1 deletion drivers/input/keyboard/pxa27x_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,15 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad)
if (pdata->enable_rotary0 || pdata->enable_rotary1)
pxa27x_keypad_scan_rotary(keypad);

new_state = KPDK_DK(kpdk) & keypad->direct_key_mask;
/*
* The KPDR_DK only output the key pin level, so it relates to board,
* and low level may be active.
*/
if (pdata->direct_key_low_active)
new_state = ~KPDK_DK(kpdk) & keypad->direct_key_mask;
else
new_state = KPDK_DK(kpdk) & keypad->direct_key_mask;

bits_changed = keypad->direct_key_state ^ new_state;

if (bits_changed == 0)
Expand Down

0 comments on commit ee1d804

Please sign in to comment.