Re: [PATCH v2 5/7] gpio: regmap: Add runtime PM and read_output_reg_set support

From: Linus Walleij

Date: Thu Aug 06 2026 - 17:32:47 EST


Hi Janani,

thanks for your patch!

On Thu, Aug 6, 2026 at 5:42 PM Janani Sunil <janani.sunil@xxxxxxxxxx> wrote:

> The new pm_dev field in gpio_regmap_config allows a driver to supply a
> device for runtime PM. All operations call pm_runtime_resume_and_get()
> before accessing the regmap and pm_runtime_put_autosuspend() on return.
>
> The new read_output_reg_set flag when set, gpio_regmap_get() checks the
> pin direction first and reads from reg_set_base instead of reg_dat_base
> for output pins. Requires both reg_dat_base and reg_set_base to be
> configured.
>
> Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>

Do you have to do this in one big patch?

To me it seems like two unrelated changes that should be
two patches?

> +static int gpio_regmap_get_direction(struct gpio_chip *chip,
> + unsigned int offset);

Can't you just move this function up in the file to
avoid the forward declaration?

> - ret = gpio->reg_mask_xlate(gpio, base, offset, &reg, &mask);
> + if (gpio->read_output_reg_set) {
> + ret = gpio_regmap_get_direction(chip, offset);
> + if (ret < 0)
> + return ret;
> +
> + if (ret == GPIO_LINE_DIRECTION_OUT)
> + base = gpio_regmap_addr(gpio->reg_set_base);
> + }

Add a comment above this new code explaining what is going on
otherwise this gets really hard to read and understand.

Other than that it looks good to me.

Yours,
Linus Walleij