Re: [PATCH v3 12/14] gpio: regmap: Add optional runtime PM support

"Michael Walle" <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-doc,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>

With a nitpick below, that if there will be a new version could be
fixed:

Reviewed-by: Michael Walle <[email protected]>


> 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;
signature.asc (application/pgp-signature, 297 B)
-----BEGIN PGP SIGNATURE-----

iKgEABMJADAWIQTIVZIcOo5wfU/AngkSJzzuPgIf+AUCan7EABIcbXdhbGxlQGtl
cm5lbC5vcmcACgkQEic87j4CH/gpkQGAuMtOcBpig/wiKXRZxo5dnZWZytuizi81
9gdKnnLs2SwWDhVWeMI3KqyskL9c8npyAYDxudngtFW003ppqWmitRqZajlOE5Yc
aqIa4ieGjeGa6vIw8n3kW7J3+ulzY76wN80=
=UzzR
-----END PGP SIGNATURE-----
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.