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

Linus Walleij <[email protected]>
Newsgroups gmane.linux.drivers.devicetree,gmane.linux.kernel.iio,gmane.linux.kernel,gmane.linux.kernel.gpio,gmane.linux.documentation
Message-ID <CAD++jLkM26M1CwzQgR+xA1vgLzGsqm1x=1WAjOgJvF8+08ipQw@mail.gmail.com>
Hi Janani,

thanks for your patch!

On Thu, Aug 6, 2026 at 5:42 PM Janani Sunil <[email protected]> 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 <[email protected]>

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.