[PATCH 1/6] Input: matrix_keypad - move gpio-row init to the init part

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
Reviewed-by: Manuel Traut <manuel.traut@xxxxxx>
Tested-by: HeDong Zhao <hedong.zhao@xxxxxx>
---
 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





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux