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>
This commit is contained in:
Markus Burri
2025-02-25 09:59:07 -08:00
committed by Dmitry Torokhov
parent 2eeac6d4bb
commit 90a0a63451

View File

@@ -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)