Skip to content

Commit 90a0a63

Browse files
Markus Burridtor
authored andcommitted
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>
1 parent 2eeac6d commit 90a0a63

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/input/keyboard/matrix_keypad.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct matrix_keypad {
2626
unsigned int row_shift;
2727

2828
unsigned int col_scan_delay_us;
29+
unsigned int all_cols_on_delay_us;
2930
/* key debounce interval in milli-second */
3031
unsigned int debounce_ms;
3132
bool drive_inactive_cols;
@@ -77,6 +78,9 @@ static void activate_all_cols(struct matrix_keypad *keypad, bool on)
7778

7879
for (col = 0; col < keypad->num_col_gpios; col++)
7980
__activate_col(keypad, col, on);
81+
82+
if (on && keypad->all_cols_on_delay_us)
83+
fsleep(keypad->all_cols_on_delay_us);
8084
}
8185

8286
static bool row_asserted(struct matrix_keypad *keypad, int row)
@@ -392,6 +396,8 @@ static int matrix_keypad_probe(struct platform_device *pdev)
392396
&keypad->debounce_ms);
393397
device_property_read_u32(&pdev->dev, "col-scan-delay-us",
394398
&keypad->col_scan_delay_us);
399+
device_property_read_u32(&pdev->dev, "all-cols-on-delay-us",
400+
&keypad->all_cols_on_delay_us);
395401

396402
err = matrix_keypad_init_gpio(pdev, keypad);
397403
if (err)

0 commit comments

Comments
 (0)