Re: [PATCH] regmap: mmio: prepare/unprepare clk only when read/write

From: Mark Brown
Date: Fri Apr 24 2020 - 06:30:10 EST


On Fri, Apr 24, 2020 at 01:27:29AM +0000, Peng Fan wrote:

> If we not pass clk to regmap, accessing regmap registers will hang system with
> Debugfs enabled.

If you're not using a cache then that'll be a problem, however there is
a flag runtime_pm in the regmap config which when set should cause the
device to be runtime PM enabled when it's accessed so if you do your
clock management in runtime PM it should still get enabled. I *think*
that interacts OK with being in an atomic context but I can't say I've
verified.

> If we pass clk to regmap, it will make the runtime pm power high, because
> regmap mmio will call clk_prepare at the beginning.

> That's why use clk_prepare_enable and clk_disable_unprepare.

> Thinking about another direction, how about add clk_prepare and clk_unprepare
> into debugfs ops open/close?

Something still has to prepare the clocks for normal operation...

Attachment: signature.asc
Description: PGP signature