Message ID | 20250110054906.354296-7-markus.burri@mt.com |
---|---|
State | Accepted |
Commit | 90a0a63451e42e3638039dde2e511e95a8486880 |
Headers | show |
Series | Input: matrix-keypad: Various performance improvements | expand |
On Fri, Jan 10, 2025 at 06:49:05AM +0100, Markus Burri wrote: > Matrix_keypad with high capacity need a longer settle time after enable matrix keypads with a high capacity need a longer settle time after enable > all columns and re-enabling interrupts. > This to give time stable the system and not generate interrupts. It avoids spurios interrupts by giving the system time to stable. > Add a new optional device-tree property to configure the time before > enabling interrupts after disable all columns. > The default is no delay. The delay for re-enabling the interrupts can be configured by a device-tree property. The default is no delay. > Signed-off-by: Markus Burri <markus.burri@mt.com> Reviewed-by: Manuel Traut <manuel.traut@mt.com> > --- > drivers/input/keyboard/matrix_keypad.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c > index 90148d3..fdb3499 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) > @@ -400,6 +404,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) > -- > 2.39.5 >
On Fri, Jan 10, 2025 at 06:49:05AM +0100, Markus Burri wrote: > Matrix_keypad with high capacity need a longer settle time after enable > all columns and re-enabling interrupts. > This to give time stable the system and not generate interrupts. > > Add a new optional device-tree property to configure the time before > enabling interrupts after disable all columns. > The default is no delay. > > Signed-off-by: Markus Burri <markus.burri@mt.com> > Applied, thank you.
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 90148d3..fdb3499 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) @@ -400,6 +404,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)
Matrix_keypad with high capacity need a longer settle time after enable all columns and re-enabling interrupts. This to give time stable the system and not generate interrupts. Add a new optional device-tree property to configure the time before enabling interrupts after disable all columns. The default is no delay. Signed-off-by: Markus Burri <markus.burri@mt.com> --- drivers/input/keyboard/matrix_keypad.c | 6 ++++++ 1 file changed, 6 insertions(+)