On 16/04/2025 at 16:20:06 +03, Wadim Egorov <w.ego...@phytec.de> wrote:
> Am 16.04.25 um 12:50 schrieb Neha Malcom Francis: >> Hi Miquel >> On 16/04/25 14:36, Miquel Raynal wrote: >>> Hello, >>> >>>>>> -int power_domain_on(struct power_domain *power_domain) >>>>>> +int power_domain_on_lowlevel(struct power_domain *power_domain) >>>>>> { >>>>>> + struct power_domain_priv *priv = >>>>>> dev_get_uclass_priv(power_domain->dev); >>>>>> struct power_domain_ops *ops = >>>>>> power_domain_dev_ops(power_domain->dev); >>>>>> + int ret; >>>>>> debug("%s(power_domain=%p)\n", __func__, power_domain); >>>>>> - return ops->on ? ops->on(power_domain) : 0; >>>>>> + if (priv->on_count++ > 0) >>>>>> + return -EALREADY; >>>>> >>>>> This change is broken for power domain providers with #power-domain-cells >>>>> = <1>, >>>>> which can have multiple domains per provider device. There would need to >>>>> be a >>>>> separate reference count per domain, and currently the uclass doesn't >>>>> know the >>>>> range of valid domain IDs. >>>> >>>> I didn't see this reply earlier, would've saved some time debugging to >>>> come to the same conclusion :) but yes this is the reason for >>>> breaking. >>> >>> That's indeed the reason, thanks a lot for figuring this out. I am >>> looking for a solution. I can reproduce on imx8mp by enabling the two >>> LCD interfaces, as they have a similar pattern as on k3 platform: a >>> single power domain node and one cell for figuring out which PD to >>> enable. >>> >>> The uclass does not save any data, so I don't have an immediate fix to >>> propose. Let me dig a bit more into that and find a solution. >>> >> Thanks! >> Meanwhile, could we revert this patch to keep the platforms from >> breaking? > > Would be nice, just took me the same route to pin this commit and find > out about this discussion. I think more people will run into the same > issue soon Go ahead, unfortunately, it's not straightforward to fix properly. Thanks, Miquèl