[PATCH v3 3/3] gpio: rda: Use bidirectional GPIO register for direction input

Dang Huynh dang.huynh at mainlining.org
Fri Sep 26 21:59:08 PDT 2025


The current implementation uses both DIRIN and DIROUT registers, but
the bgpio library expects 1 to be output direction, which on this IP
is reversed (0 = output, 1 = input).

To fix this, use GPIO_OEN_VAL for input direction register which
expects 1 = input, 0 = output.

This change should not affect any mainline users as none of them have
any peripherals hooked up to a GPIO.

Signed-off-by: Dang Huynh <dang.huynh at mainlining.org>
---
 drivers/gpio/gpio-rda.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-rda.c b/drivers/gpio/gpio-rda.c
index 7d20dbbb6ec41149a1dbf4d9ef9ac86449773c35..145b61fc83fb6eee2415e979a144616d81595736 100644
--- a/drivers/gpio/gpio-rda.c
+++ b/drivers/gpio/gpio-rda.c
@@ -243,8 +243,7 @@ static int rda_gpio_probe(struct platform_device *pdev)
 		.dat = rda_gpio->base + RDA_GPIO_VAL,
 		.set = rda_gpio->base + RDA_GPIO_SET,
 		.clr = rda_gpio->base + RDA_GPIO_CLR,
-		.dirout = rda_gpio->base + RDA_GPIO_OEN_SET_OUT,
-		.dirin = rda_gpio->base + RDA_GPIO_OEN_SET_IN,
+		.dirin = rda_gpio->base + RDA_GPIO_OEN_VAL,
 		.flags = BGPIOF_READ_OUTPUT_REG_SET,
 	};
 

-- 
2.51.0



More information about the linux-arm-kernel mailing list