Re: [PATCH v8 2/3] gpio: regmap: Add optional runtime PM support
From: Andy Shevchenko
Date: Fri Sep 11 2026 - 01:46:25 EST
On Thu, Sep 10, 2026 at 07:29:11PM +0200, 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.
...
> - ret = gpio->reg_mask_xlate(gpio, GPIO_REGMAP_GET_OP, base, offset, ®, &mask);
Hmm... As far as I understand the xlate function should not touch the hardware.
Is it not the case?
> + GPIO_REGMAP_RUNTIME_ACQUIRE(gpio, pm);
> + ret = GPIO_REGMAP_RUNTIME_ACQUIRE_ERR(&pm);
> + if (ret)
> + return ret;
> +
> + ret = gpio->reg_mask_xlate(gpio, GPIO_REGMAP_GET_OP, base, offset,
> + ®, &mask);
> if (ret)
> return ret;
Otherwise runtime PM may be handled after that call.
...
Ditto for the rest.
--
With Best Regards,
Andy Shevchenko