summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Burri <markus.burri@mt.com>2025-02-25 20:59:07 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2025-02-25 22:22:00 +0300
commit90a0a63451e42e3638039dde2e511e95a8486880 (patch)
tree09e9abf5e17805837642530057644f071e396dbf
parent2eeac6d4bb5ea1063dd634c490c89bb04cb79265 (diff)
downloadlinux-90a0a63451e42e3638039dde2e511e95a8486880.tar.xz
Input: matrix_keypad - add settle time after enabling all columns
Matrix keypads with high capacity need a longer settle time after enabling all columns before re-enabling interrupts. The delay gives the system time to settle and avoids spurious interrupts. Add a new optional device property to configure the delay after enabling all columns. The default is no delay. Signed-off-by: Markus Burri <markus.burri@mt.com> Reviewed-by: Manuel Traut <manuel.traut@mt.com> Link: https://lore.kernel.org/r/20250110054906.354296-7-markus.burri@mt.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/keyboard/matrix_keypad.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 2a3b3bfc2878..889505e59f85 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -26,6 +26,7 @@ struct matrix_keypad {
unsigned int row_shift;
unsigned int col_scan_delay_us;
+ unsigned int all_cols_on_delay_us;
/* key debounce interval in milli-second */
unsigned int debounce_ms;
bool drive_inactive_cols;
@@ -77,6 +78,9 @@ static void activate_all_cols(struct matrix_keypad *keypad, bool on)
for (col = 0; col < keypad->num_col_gpios; col++)
__activate_col(keypad, col, on);
+
+ if (on && keypad->all_cols_on_delay_us)
+ fsleep(keypad->all_cols_on_delay_us);
}
static bool row_asserted(struct matrix_keypad *keypad, int row)
@@ -392,6 +396,8 @@ static int matrix_keypad_probe(struct platform_device *pdev)
&keypad->debounce_ms);
device_property_read_u32(&pdev->dev, "col-scan-delay-us",
&keypad->col_scan_delay_us);
+ device_property_read_u32(&pdev->dev, "all-cols-on-delay-us",
+ &keypad->all_cols_on_delay_us);
err = matrix_keypad_init_gpio(pdev, keypad);
if (err)