[PATCH v6 05/12] power-domain: Add refcounting
Miquel Raynal
miquel.raynal at bootlin.com
Wed Apr 16 11:06:25 CEST 2025
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,
Miquèl
More information about the U-Boot
mailing list