Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306590
b: refs/heads/master
c: 71f3d07
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov committed Apr 21, 2012
1 parent 46be923 commit e882795
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bcad87bd92f4331d4422c1afd571e66f7f5c95d6
refs/heads/master: 71f3d070a309504cdfef87b9e98836395b75ae0e
22 changes: 9 additions & 13 deletions trunk/drivers/input/keyboard/tc3589x-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,15 @@ static int tc3589x_keypad_init_key_hardware(struct tc_keypad *keypad)
{
int ret;
struct tc3589x *tc3589x = keypad->tc3589x;
u8 settle_time = keypad->board->settle_time;
u8 dbounce_period = keypad->board->debounce_period;
u8 rows = keypad->board->krow & 0xf; /* mask out the nibble */
u8 column = keypad->board->kcol & 0xf; /* mask out the nibble */

/* validate platform configurations */
if (keypad->board->kcol > TC3589x_MAX_KPCOL ||
keypad->board->krow > TC3589x_MAX_KPROW ||
keypad->board->debounce_period > TC3589x_MAX_DEBOUNCE_SETTLE ||
keypad->board->settle_time > TC3589x_MAX_DEBOUNCE_SETTLE)
const struct tc3589x_keypad_platform_data *board = keypad->board;

/* validate platform configuration */
if (board->kcol > TC3589x_MAX_KPCOL || board->krow > TC3589x_MAX_KPROW)
return -EINVAL;

/* configure KBDSIZE 4 LSbits for cols and 4 MSbits for rows */
ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSIZE,
(rows << KP_ROW_SHIFT) | column);
(board->krow << KP_ROW_SHIFT) | board->kcol);
if (ret < 0)
return ret;

Expand All @@ -124,12 +118,14 @@ static int tc3589x_keypad_init_key_hardware(struct tc_keypad *keypad)
return ret;

/* Configure settle time */
ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG, settle_time);
ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG,
board->settle_time);
if (ret < 0)
return ret;

/* Configure debounce time */
ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE, dbounce_period);
ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE,
board->debounce_period);
if (ret < 0)
return ret;

Expand Down

0 comments on commit e882795

Please sign in to comment.