On Fri, Feb 14, 2025 at 12:28 PM Bough Chen <haibo.chen@xxxxxxx> wrote: > I check the code, seems vf610 has another limitation, refer to the original > code logic in vf610_gpio_get(): > If the gpio is config as input, need to read GPIO_PDIR to get the input data, > if gpio is config at output, need to read GPIO_PDOR. > > But for bgpio_init, we fix GPIO_PDOR to void __iomem *dat The logic is that if the line is set as output, we read the output register instead of the input register to get the value, and that is fairly standard. And gpio-mmio is using gbpio_get_set() which looks like this: static int bgpio_get_set(struct gpio_chip *gc, unsigned int gpio) { unsigned long pinmask = bgpio_line2mask(gc, gpio); bool dir = !!(gc->bgpio_dir & pinmask); if (dir) return !!(gc->read_reg(gc->reg_set) & pinmask); else return !!(gc->read_reg(gc->reg_dat) & pinmask); } I think my mistake is in that I didn't see the dual PSOR (set output register) and PCOR (clear output register) in the driver, as the old one does, I'll send a new patch. Yours, Linus Walleij