[PATCH 06/10] gpio: rda: Make direction register unreadable

From: Dang Huynh via B4 Relay

Date: Thu Sep 18 2025 - 14:49:58 EST


From: Dang Huynh <dang.huynh@xxxxxxxxxxxxxx>

The register doesn't like to be read and would cause all the input
to be switched to output.

This causes the SD Card Detect GPIO to misbehaves in the OS and/or
may cause hardware to malfunction.

Signed-off-by: Dang Huynh <dang.huynh@xxxxxxxxxxxxxx>
---
drivers/gpio/gpio-rda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rda.c b/drivers/gpio/gpio-rda.c
index 7d20dbbb6ec41149a1dbf4d9ef9ac86449773c35..ae2efa22755986b5445fdb8d4f004d595c189590 100644
--- a/drivers/gpio/gpio-rda.c
+++ b/drivers/gpio/gpio-rda.c
@@ -245,7 +245,7 @@ static int rda_gpio_probe(struct platform_device *pdev)
.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,
- .flags = BGPIOF_READ_OUTPUT_REG_SET,
+ .flags = BGPIOF_READ_OUTPUT_REG_SET | BGPIOF_UNREADABLE_REG_DIR,
};

ret = gpio_generic_chip_init(&rda_gpio->chip, &config);

--
2.51.0