Skip to contentSkip to conversation

Revert "Input: matrix_keypad - force switch rows to input mode"

PATCH In review Alexander Kochetkov 3 participants 4 messages Oct 2 – Oct 19

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

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

This reverts commit 01c84b03d80aab9f04c4e3e1f9085f4202ff7c29.

The commit makes every scan call gpiod_direction_input() on the row GPIOs. On pin controllers where GPIO input and interrupt are separate pinmux functions this switches the row pins out of interrupt mode, and enable_row_irqs() does not switch them back: it only unmasks the interrupts. Row interrupts then never arrive and the keypad stops working. Seen with a matrix keypad on an Allwinner A64 board (PINE A64-LTS); it works again with the commit reverted.

The workaround is not needed on Ingenic either: the author of the reverted commit re-tested all available JZ47xx SoCs and they all report the live pin state in interrupt mode, see the thread in Link.

Fixes 01c84b03d80a ("Input: matrix_keypad - force switch rows to input mode")

---
The same three-line removal has been in use on Allwinner A64 hardware on top of v6.12.33; this version is rebased onto v7.3-rc5 and build-tested (arm64, CONFIG_KEYBOARD_MATRIX=m).

Siarhei, Paul: you both agreed to the revert in the thread above, please reply with your Acked-by/Tested-by if you would like it recorded.

 drivers/input/keyboard/matrix_keypad.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/input/keyboard/matrix_keypad.c +0 -3
index 8863b741d1a3..cda2888b2e56 100644
@@ -134,9 +134,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++) {
 

base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e

Signature · 1 line
2.43.0
Acked-by on v1 1/1
#2 lore raw
In reply to Alexander Kochetkov

Hi Alexander,

Le vendredi 02 octobre 2026 à 13:09 +0300, Alexander Kochetkov a écrit :

Quoted 14 lines

This reverts commit 01c84b03d80aab9f04c4e3e1f9085f4202ff7c29.

The commit makes every scan call gpiod_direction_input() on the row GPIOs. On pin controllers where GPIO input and interrupt are separate pinmux functions this switches the row pins out of interrupt mode, and enable_row_irqs() does not switch them back: it only unmasks the interrupts. Row interrupts then never arrive and the keypad stops working. Seen with a matrix keypad on an Allwinner A64 board (PINE A64-LTS); it works again with the commit reverted.

The workaround is not needed on Ingenic either: the author of the reverted commit re-tested all available JZ47xx SoCs and they all report the live pin state in interrupt mode, see the thread in Link.

Quoted 5 lines
Fixes 01c84b03d80a ("Input: matrix_keypad - force switch rows to input mode")

Link:
https://lore.kernel.org/all/[email protected]/

Cheers,
-Paul

Quoted 28 lines

---
The same three-line removal has been in use on Allwinner A64 hardware on top of v6.12.33; this version is rebased onto v7.3-rc5 and build-tested (arm64, CONFIG_KEYBOARD_MATRIX=m).

Siarhei, Paul: you both agreed to the revert in the thread above, please reply with your Acked-by/Tested-by if you would like it recorded.

 drivers/input/keyboard/matrix_keypad.c | 3 ---

 1 file changed, 3 deletions(-)
drivers/input/keyboard/matrix_keypad.c +0 -0
index 8863b741d1a3..cda2888b2e56 100644
@@ -134,9 +134,6 @@ static void matrix_keypad_scan(struct work_struct *work)


  memset(new_state, 0, sizeof(new_state));

drivers/input/keyboard/matrix_keypad.c +0 -3
-	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++) {

base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e

#3 lore raw
In reply to Alexander Kochetkov

Hi Dmitry,

Gentle ping. This is a regression fix for matrix_keypad with Acked-by from Siarhei (author of the reverted commit) and Paul (Ingenic maintainer); it still applies to your next branch. Is there anything else you need from me?

Thanks,
Alexander

Quoted 50 lines

2 окт. 2026 г., в 13:09, Alexander Kochetkov <[email protected]> написал(а):

This reverts commit 01c84b03d80aab9f04c4e3e1f9085f4202ff7c29.

The commit makes every scan call gpiod_direction_input() on the row GPIOs. On pin controllers where GPIO input and interrupt are separate pinmux functions this switches the row pins out of interrupt mode, and enable_row_irqs() does not switch them back: it only unmasks the interrupts. Row interrupts then never arrive and the keypad stops working. Seen with a matrix keypad on an Allwinner A64 board (PINE A64-LTS); it works again with the commit reverted.

The workaround is not needed on Ingenic either: the author of the reverted commit re-tested all available JZ47xx SoCs and they all report the live pin state in interrupt mode, see the thread in Link.

Fixes 01c84b03d80a ("Input: matrix_keypad - force switch rows to input mode")

---
The same three-line removal has been in use on Allwinner A64 hardware on top of v6.12.33; this version is rebased onto v7.3-rc5 and build-tested (arm64, CONFIG_KEYBOARD_MATRIX=m).

Siarhei, Paul: you both agreed to the revert in the thread above, please reply with your Acked-by/Tested-by if you would like it recorded.

drivers/input/keyboard/matrix_keypad.c | 3 ---

1 file changed, 3 deletions(-)
drivers/input/keyboard/matrix_keypad.c +0 -3
index 8863b741d1a3..cda2888b2e56 100644
@@ -134,9 +134,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++) {
 

base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e

Signature · 1 line
2.43.0