[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241031063004.69956-2-markus.burri@mt.com>
Date: Thu, 31 Oct 2024 07:29:59 +0100
From: Markus Burri <markus.burri@...com>
To: linux-kernel@...r.kernel.org
Cc: Markus Burri <markus.burri@...com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
linux-input@...r.kernel.org,
devicetree@...r.kernel.org,
Manuel Traut <manuel.traut@...com>,
HeDong Zhao <hedong.zhao@...com>
Subject: [PATCH 1/6] Input: matrix_keypad - move gpio-row init to the init part
If the matrix keypad is wired over a slow interface
(e.g. a gpio-expansion over i2c), the scan can take a longer time.
Move the initialisation of row gpio from scan to the init function will
reduce the scan time and therefore increase scan performance.
Signed-off-by: Markus Burri <markus.burri@...com>
Reviewed-by: Manuel Traut <manuel.traut@...com>
Tested-by: HeDong Zhao <hedong.zhao@...com>
---
drivers/input/keyboard/matrix_keypad.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 3c38bae..a2ec9f6 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -118,9 +118,6 @@ static void matrix_keypad_scan(struct work_struct *work)
memset(new_state, 0, sizeof(new_state));
- for (row = 0; row < keypad->num_row_gpios; row++)
- gpiod_direction_input(keypad->row_gpios[row]);
-
/* assert each column and read the row status out */
for (col = 0; col < keypad->num_col_gpios; col++) {
@@ -326,6 +323,8 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
if (active_low ^ gpiod_is_active_low(keypad->row_gpios[i]))
gpiod_toggle_active_low(keypad->row_gpios[i]);
+
+ gpiod_direction_input(keypad->row_gpios[i]);
}
return 0;
--
2.39.5
Powered by blists - more mailing lists