[PATCH v3 11/12] gpio: rockchip: Set input direction when request irq

Ye Zhang ye.zhang at rock-chips.com
Tue Sep 3 00:36:48 PDT 2024


Since the GPIO can only generate interrupts when its direction is set to
input, it is set to input before requesting the interrupt resources.

Signed-off-by: Ye Zhang <ye.zhang at rock-chips.com>
---
 drivers/gpio/gpio-rockchip.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index 6deebf1dd9dd..73e57efb46fc 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -476,10 +476,14 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
 
 static int rockchip_irq_reqres(struct irq_data *d)
 {
+	irq_hw_number_t hwirq;
 	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 	struct rockchip_pin_bank *bank = gc->private;
 
-	return gpiochip_reqres_irq(&bank->gpio_chip, d->hwirq);
+	hwirq = irqd_to_hwirq(d);
+	rockchip_gpio_direction_input(&bank->gpio_chip, hwirq);
+
+	return gpiochip_reqres_irq(&bank->gpio_chip, hwirq);
 }
 
 static void rockchip_irq_relres(struct irq_data *d)
-- 
2.34.1




More information about the Linux-rockchip mailing list