Re: [PATCH] pmdomain: core: connect consumer with supplier via device link
From: Stefan Dösinger
Date: Wed Dec 02 2026 - 03:34:24 EST
Hi,
Am Donnerstag, 12. November 2026, 10:45:43 Ostafrikanische Zeit schrieb Yixun
Lan:
> Connect downstream Power Domain consumer with the supplier through
> the device link API, So when the pmdomain driver is unloaded or unbinded,
> the consumer can be automatically notified and purged gracefully.
I ran into the same issue with the zx297520v3 pmdomain driver I submitted [0].
The issue happens when the pm domain device is an MFD child registered with
mfd_add_devices() and the #power-domain-cells rolled into the MFD parent's DTS
node. In this case from the DTS's point of view the provider is the MFD
parent, whereas the runtime provider is the MFD child.
Linking the consumer to the MFD child that actually provides the pmdomain
makes sure that the consumer gets unbound when the MFD child gets unbound.
Why not make the pmdomain child a DTS node? writing-bindings.rst explicitly
discourages it:
> - DON'T create nodes just for the sake of instantiating drivers. Multi-
> function devices only need child nodes when the child nodes have their own
> DT resources. A single node can be multiple providers (e.g. clocks and
> resets).
In my case Krzysztof Kozlowski reiterated that in [1].
The clk subsystem takes extra care to handle provider registration from a MFD
child - see dev_or_parent_of_node().
I don't deeply care about being able to unbind my pmdomain driver and/or build
it as module and unload it. I implemented it because Brian Masney asked me to
build the clk drivers this way[2]. On my hardware the pmdomain is easy to shut
down without crashing/powering off the board, so I might as well. And to me
being able to unwind a device registration is a good check that the device
registration itself is built the right way.
Cheers,
Stefan
0: https://lore.kernel.org/linux-arm-kernel/20261120-zx29usb-v1-3-b0433258e51b@xxxxxxxxx/
1: https://lore.kernel.org/linux-arm-kernel/20260717-uncovered-feathered-groundhog-eab16e@quoll/
2: https://lore.kernel.org/linux-arm-kernel/anPD-I9GDyOZSDO7@xxxxxxxxxx/
Attachment:
signature.asc
Description: This is a digitally signed message part.