]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Input: matrix_keypad - add settle time after enabling all columns
authorMarkus Burri <markus.burri@mt.com>
Tue, 25 Feb 2025 17:59:07 +0000 (09:59 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 25 Feb 2025 19:22:00 +0000 (11:22 -0800)
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>
drivers/input/keyboard/matrix_keypad.c

index 2a3b3bfc2878baeecde484a2546a7693ccfe26cc..889505e59f851b3feca09ec40737341cdb7bf611 100644 (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)