[PATCH v2] pinctrl: sunxi: fix gpiochip_lock_as_irq() failure when pinmux is unknown

Michal Piekos michal.piekos at mmpsystems.pl
Sun Mar 8 06:42:07 PDT 2026


Fixes kernel hang during boot due to inability to set up IRQ on AXP313a.

The issue is caused by gpiochip::get_direction() which was returning
-ENODEV when gpio is in unitialized state.

Instead of failing when the current muxval is at default value, report
the line as input.

Tested on Orange Pi Zero 3.

Signed-off-by: Michal Piekos <michal.piekos at mmpsystems.pl>
Suggested-by: Andrey Skvortsov <andrej.skvortzov at gmail.com>
---
This fixes a kernel hang during boot on the Orange Pi Zero 3 caused by
inability to set up interrupt for the AXP313A PMIC.

The issue is caused by gpiochip::get_direction() which was returning
-ENODEV when gpio is in unitialized state and its muxval is at default
value.

Instead of failing, report the line as input.

To: Rob Herring <robh at kernel.org>
To: Krzysztof Kozlowski <krzk+dt at kernel.org>
To: Conor Dooley <conor+dt at kernel.org>
To: Chen-Yu Tsai <wens at kernel.org>
To: Jernej Skrabec <jernej.skrabec at gmail.com>
To: Samuel Holland <samuel at sholland.org>
To: Andre Przywara <andre.przywara at arm.com>
To: Linus Walleij <linusw at kernel.org>
Cc: devicetree at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-sunxi at lists.linux.dev
Cc: linux-kernel at vger.kernel.org
Cc: linux-gpio at vger.kernel.org

Changes in v2:
- Dropped the previous faulty solution which was forcing the axp313 to
  use r_pio as interrupt controller as pointed out by Jernej Škrabec.
- Implemented suggestion from Andrey Skvortsov to return default
  direction as input
- Link to v1: https://lore.kernel.org/r/20260308-rc2-boot-hang-v1-0-d792d1a78dfd@mmpsystems.pl
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index c990b6118172..e438cf35ff28 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -971,7 +971,7 @@ static int sunxi_pinctrl_gpio_get_direction(struct gpio_chip *chip,
 
 	func = sunxi_pinctrl_desc_find_function_by_pin_and_mux(pctl, pin, muxval);
 	if (!func)
-		return -ENODEV;
+		return GPIO_LINE_DIRECTION_IN;
 
 	if (!strcmp(func->name, "gpio_out"))
 		return GPIO_LINE_DIRECTION_OUT;

---
base-commit: 4ae12d8bd9a830799db335ee661d6cbc6597f838
change-id: 20260308-rc2-boot-hang-269e8546635b

Best regards,
-- 
Michal Piekos <michal.piekos at mmpsystems.pl>




More information about the linux-arm-kernel mailing list