Thread (7 messages) flat view 7 messages, 3 authors, 1d ago

Re: [PATCH v8 2/3] gpio: regmap: Add optional runtime PM support

From: Andy Shevchenko <hidden>
Date: 2026-09-11 05:41:57
Also in: lkml

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, &reg, &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,
+				   &reg, &mask);
 	if (ret)
 		return ret;
Otherwise runtime PM may be handled after that call.

...

Ditto for the rest.

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help