Re: [PATCH v3 12/14] gpio: regmap: Add optional runtime PM support
From: Michael Walle
Date: Fri Aug 14 2026 - 03:35:52 EST
On Thu Aug 13, 2026 at 3:57 PM CEST, Janani Sunil wrote:
> Some gpio-regmap consumers share their regmap with a parent device that
> may be runtime suspended. GPIO register accesses must resume that device
> first.
>
> Add an optional pm_dev field and acquire it before register translation
> or access. Release it using runtime autosuspend after each operation.
> Keep the device active across the complete direction-output sequence and
> propagate failure when setting the initial output value.
>
> Signed-off-by: Janani Sunil <janani.sunil@xxxxxxxxxx>
With a nitpick below, that if there will be a new version could be
fixed:
Reviewed-by: Michael Walle <mwalle@xxxxxxxxxx>
> diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
> index 06255756710d..aae32a569914 100644
> --- a/include/linux/gpio/regmap.h
> +++ b/include/linux/gpio/regmap.h
> @@ -29,6 +29,7 @@ struct regmap;
> * @reg_clr_base: (Optional) clear register base address
> * @reg_dir_in_base: (Optional) in setting register base address
> * @reg_dir_out_base: (Optional) out setting register base address
> + * @pm_dev: (Optional) Device to use for runtime power management.
> * @reg_stride: (Optional) May be set if the registers (of the
> * same type, dat, set, etc) are not consecutive.
> * @ngpio_per_reg: (Optional) Number of GPIOs per register
> @@ -92,6 +93,7 @@ struct gpio_regmap_config {
> unsigned int reg_clr_base;
> unsigned int reg_dir_in_base;
> unsigned int reg_dir_out_base;
> + struct device *pm_dev;
Why wasn't that added at the end of the config? It (logically)
doesn't make any sense to just put it in between. Just put it below
the irq_domain.
-michael
> int reg_stride;
> int ngpio_per_reg;
> struct irq_domain *irq_domain;
Attachment:
signature.asc
Description: PGP signature