diff options
author | David Rivshin <DRivshin@allworx.com> | 2017-03-29 00:14:16 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-03-29 00:25:01 -0700 |
commit | aa0e26bb786b00eaa897e024769e299470815efe (patch) | |
tree | a95bbc7ed4797ae83db244ac40561cd7a5e31d20 /drivers/input/keyboard/matrix_keypad.c | |
parent | 4896fb1348713344abbd9f692b393b5fdc539bf8 (diff) |
Input: matrix_keypad - add option to drive inactive columns
The gpio-matrix-keypad driver normally sets inactive columns as inputs
while scanning. This does not work for all hardware, which may require
the inactive columns to be actively driven in order to overcome any
pull-ups/downs on the columns.
Signed-off-by: David Rivshin <drivshin@allworx.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard/matrix_keypad.c')
-rw-r--r-- | drivers/input/keyboard/matrix_keypad.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 18839cd5f76e..1f316d66e6f7 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -42,9 +42,10 @@ struct matrix_keypad { }; /* - * NOTE: normally the GPIO has to be put into HiZ when de-activated to cause - * minmal side effect when scanning other columns, here it is configured to - * be input, and it should work on most platforms. + * NOTE: If drive_inactive_cols is false, then the GPIO has to be put into + * HiZ when de-activated to cause minmal side effect when scanning other + * columns. In that case it is configured here to be input, otherwise it is + * driven with the inactive value. */ static void __activate_col(const struct matrix_keypad_platform_data *pdata, int col, bool on) @@ -55,7 +56,8 @@ static void __activate_col(const struct matrix_keypad_platform_data *pdata, gpio_direction_output(pdata->col_gpios[col], level_on); } else { gpio_set_value_cansleep(pdata->col_gpios[col], !level_on); - gpio_direction_input(pdata->col_gpios[col]); + if (!pdata->drive_inactive_cols) + gpio_direction_input(pdata->col_gpios[col]); } } @@ -432,6 +434,9 @@ matrix_keypad_parse_dt(struct device *dev) if (of_get_property(np, "gpio-activelow", NULL)) pdata->active_low = true; + pdata->drive_inactive_cols = + of_property_read_bool(np, "drive-inactive-cols"); + of_property_read_u32(np, "debounce-delay-ms", &pdata->debounce_ms); of_property_read_u32(np, "col-scan-delay-us", &pdata->col_scan_delay_us); |