Re: regmap: mmio: lack of runtime_pm support for debugfs

From: Mark Brown
Date: Fri Feb 04 2022 - 14:03:28 EST


On Mon, Jan 24, 2022 at 03:50:23PM -0800, Brian Norris wrote:

> The only 'runtime_pm' flag I'm finding for regmap is for regmap_irq_chip
> -- there isn't anything useful for other kinds of regmaps (like MMIO).

> If this seems like an expected/useful feature, I'll look at adding it to
> the generic 'struct regmap_config' / drivers/base/regmap/regmap.c.

> This could be tricky in theory given the atomic context requirements,
> but in reality, I think it would still be OK: this feature would really
> be useful _only_ for otherwise-unregulated contexts, like debugfs
> access (where we can sleep). For all non-debugfs accesses, we expect to
> already be RPM_ACTIVE, because the driver should already be managing
> runtime PM.

Are you sure you wouldn't be better off with a cache here, or marking
the registers as precious so they don't get read (perhaps conditionally
to allow reading while the device is live)? The general idea
expectation with the debugfs is that it shouldn't materially affect the
device, this would mean that it could cause the power to get bounced on
which feels like it might lead to surprises. If you are sending a patch
adding support for this it should be debugfs specific, not a general
flag so it's clear that it's not going to do power management outside of
debugfs, as you say in the normal case it seems better for the driver to
do power management.

Attachment: signature.asc
Description: PGP signature