mbox series

[v2,0/7] Input: matrix-keypad: Various performance improvements

Message ID 20241105130322.213623-1-markus.burri@mt.com
Headers show
Series Input: matrix-keypad: Various performance improvements | expand

Message

Markus Burri Nov. 5, 2024, 1:03 p.m. UTC
This series is needed to avoid key-loss if the GPIOs are connected via a I2C GPIO Mux
that introduces additonal latencies between key change and matrix scan.

This series applies on 6.12-rc6

Changes in V2:
* added patch to convert dt-bindings to YAML
* added missing dt-bindings properties description
* removed [PATCH 1/6] Input: matrix_keypad - move gpio-row init to the init
  it would revert 01c84b03d80aab9f04c4e3e1f9085f4202ff7c29
* removed internally given Tested-by and Reviewed-by tags

V1: https://lore.kernel.org/lkml/20241031063004.69956-1-markus.burri@mt.com/ 

Markus Burri (7):
  Input: matrix_keypad - use fsleep for variable delay duration
  Input: matrix_keypad - add function for reading row state
  dt-bindings: input: matrix_keypad - convert to YAML
  dt-bindings: input: matrix_keypad - add missing property
  dt-bindings: input: matrix_keypad - add settle time after enable all
    columns
  Input: matrix_keypad - add settle time after enable all columns
  Input: matrix_keypad - detect change during scan

 .../bindings/input/gpio-matrix-keypad.txt     |  49 --------
 .../bindings/input/gpio-matrix-keypad.yaml    | 110 ++++++++++++++++++
 drivers/input/keyboard/matrix_keypad.c        |  39 ++++++-
 3 files changed, 145 insertions(+), 53 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
 create mode 100644 Documentation/devicetree/bindings/input/gpio-matrix-keypad.yaml

Comments

Dmitry Torokhov Nov. 5, 2024, 7:16 p.m. UTC | #1
On Tue, Nov 05, 2024 at 02:03:16PM +0100, Markus Burri wrote:
> The delay is retrieved from a device-tree property, so the duration is
> variable. fsleep guesses the best delay function based on duration.

activate_col() may be called in atomic context, and if fsleep() turns
into usleep_range() or msleep() we are going to have a bad time.

We should either stop using request_any_context_irq() or figure out if
interrupt handler can sleep or not and adjust behavior properly.

> 
> Link: https://www.kernel.org/doc/html/latest/timers/timers-howto.html
> 
> Signed-off-by: Markus Burri <markus.burri@mt.com>
> ---
>  drivers/input/keyboard/matrix_keypad.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
> index 3c38bae..9eb6808 100644
> --- a/drivers/input/keyboard/matrix_keypad.c
> +++ b/drivers/input/keyboard/matrix_keypad.c
> @@ -69,7 +69,7 @@ static void activate_col(struct matrix_keypad *keypad, int col, bool on)
>  	__activate_col(keypad, col, on);
>  
>  	if (on && keypad->col_scan_delay_us)
> -		udelay(keypad->col_scan_delay_us);
> +		fsleep(keypad->col_scan_delay_us);
>  }
>  
>  static void activate_all_cols(struct matrix_keypad *keypad, bool on)
> -- 
> 2.39.5
> 

Thanks.