On Fri, Apr 25, 2025 at 11:09 AM Miquel Raynal <miquel.ray...@bootlin.com> wrote: > > On one side we have a power domain uclass which is mostly clueless about > the topology of the power domains it manages. > > On the other side we have SoCs which are getting more and more complex, > ie. with several layers of power domains. Sometimes (eg. on TI K3 > platforms) all power domains are defined by a single device tree node > and the "subdomains" are referenced using an identification > cell (#power-domain-cells = <1 or more>). Sometimes however (eg. on NXP > i.MX8 SoCs), the description uses many device tree nodes. > > When a power domain is referenced several times, it is likely that the > power_domain_on() function will be called several times in a row, which > in some cases may lead to glitches or even breakages. This situation is > problematic on i.MX8MP and only with proper reference counting we can > safely support the video pipeline. > > There was a first attempt to bring refcount support to the power domain > uclass, but it miserably failed because of the details mentioned > above: > https://lore.kernel.org/u-boot/20250403-ge-mainline-display-support-v6-5-478b5e3dd...@bootlin.com/ > > So here is a new version of it, which takes into consideration: > - the fact that a single power domain udev can target several power > domain IDs (referred as "subdomains") > - the fact that some platforms might count on a uneven count of on/off > calls to work, and "fixing" this may break the platforms. > > So refcounting is an opt-in parameter, it is a matter of filling the > platform (public part of a per-uclass structure) subdomains number with > the number of subdomains this device nodes features (one per > power_domain->id) in the probe function of the power domain driver. > > This series shows how it can be done by enabling refcounting on i.MX8MP. > > Samuel, Neha, Wadim, Heiko, could you please confirm it works on your > side? > > For once, CI is green :-) > https://github.com/u-boot/u-boot/pull/753
Applied, thanks.