Skip to contentSkip to conversation

Input: matrix_keypad - force switch rows to input mode

PATCH Applied Siarhei Volkau 2 participants 2 messages Nov 2, 2022 – Nov 3, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: matrix_keypad - force switch rows to input mode

Some Pin/GPIO controllers can't get current GPIO status when interrupt mode is set. Specifically Ingenic's JZ4755 always returns status at the moment of interrupt.

The patch tries to fix that by forcibly setting pin mode to GPIO input prior to reading actual row status. enable_row_irqs seems to set interrupt mode back as it should be.

---
 drivers/input/keyboard/matrix_keypad.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/input/keyboard/matrix_keypad.c +3 -0
index 7dd3f3eda..b4c0325bb 100644
@@ -127,6 +127,9 @@ static void matrix_keypad_scan(struct work_struct *work)
 
 	memset(new_state, 0, sizeof(new_state));
 
+	for (row = 0; row < pdata->num_row_gpios; row++)
+		gpio_direction_input(pdata->row_gpios[row]);
+
 	/* assert each column and read the row status out */
 	for (col = 0; col < pdata->num_col_gpios; col++) {
 
Signature · 1 line
2.36.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Siarhei Volkau

Some Pin/GPIO controllers can't get current GPIO status when interrupt mode is set. Specifically Ingenic's JZ4755 always returns status at the moment of interrupt.

The patch tries to fix that by forcibly setting pin mode to GPIO input prior to reading actual row status. enable_row_irqs seems to set interrupt mode back as it should be.

Applied, thank you.

Signature · 1 line
Dmitry