diff options
author | Simon Glass <sjg@chromium.org> | 2012-09-27 15:18:42 (GMT) |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-10-15 18:54:04 (GMT) |
commit | 71dc6bca4ef61d10f1327114ac1d53b6865a6030 (patch) | |
tree | 287f0de81f8b4008c11a07296ec272d7ed76d843 /drivers/input/key_matrix.c | |
parent | 1b1d3e6461e9195f825d6d8aa6a2a0e1e3188f62 (diff) | |
download | u-boot-71dc6bca4ef61d10f1327114ac1d53b6865a6030.tar.xz |
input: Allow key ghosting filter to be disabled
Some keyboards will not need a key ghosting filter, so make this feature
optional.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/input/key_matrix.c')
-rw-r--r-- | drivers/input/key_matrix.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index c08caa6..287bf0d 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -46,6 +46,9 @@ static int has_ghosting(struct key_matrix *config, struct key_matrix_key *keys, int key_in_same_col = 0, key_in_same_row = 0; int i, j; + if (!config->ghost_filter || valid < 3) + return 0; + for (i = 0; i < valid; i++) { /* * Find 2 keys such that one key is in the same row @@ -92,7 +95,7 @@ int key_matrix_decode(struct key_matrix *config, struct key_matrix_key keys[], } /* For a ghost key config, ignore the keypresses for this iteration. */ - if (valid >= 3 && has_ghosting(config, keys, valid)) { + if (has_ghosting(config, keys, valid)) { valid = 0; debug(" ghosting detected!\n"); } @@ -200,12 +203,14 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, return 0; } -int key_matrix_init(struct key_matrix *config, int rows, int cols) +int key_matrix_init(struct key_matrix *config, int rows, int cols, + int ghost_filter) { memset(config, '\0', sizeof(*config)); config->num_rows = rows; config->num_cols = cols; config->key_count = rows * cols; + config->ghost_filter = ghost_filter; assert(config->key_count > 0); return 0; |