
On 5/4/23 14:41, Marek Vasut wrote:
On 5/4/23 10:12, Eugen Hristev wrote:
On 5/4/23 00:52, Marek Vasut wrote:
On 5/2/23 18:13, Tim Harvey wrote:
On Mon, May 1, 2023 at 11:51 PM Eugen Hristev eugen.hristev@collabora.com wrote:
regulator_set_enable_if_allowed already handles cases when the regulator is already enabled, or already disabled, and does not treat these as errors. With this change, the driver can work correctly even if the regulator is already taken or already disabled by another consumer.
Signed-off-by: Eugen Hristev eugen.hristev@collabora.com
Hi Tim,
I have not tested this as I do not have a mx6 board. can you please try it ?
Thanks, Eugen
Eugen,
This does resolve the issue that occurs after your refcount series [1].
However after thinking about this more and seeing Marek's responses this wasn't an issue of multiple consumers sharing the same regulator. Instead this particular issue was that the vbus regulator is getting enabled twice without being disabled.
This kind of issues can be uncovered when we add the refcounter :)
Yeah, and that's a good thing. The refcounter is much appreciated (am I repeating myself?)
On one hand I am happy to uncover such bugs. However, this leads me to wonder, even without a refcount, even without my series, enabling a regulator that is already enabled should return -EALREADY
I don't that so, you can have regulators which supply multiple things and which are claimed by multiple driver instances, at which point they will each enable the regulator (refcount++) and that shouldn't end up returning -EALREADY . Right ?
That was my thought. And I was returning success if regulator was already enabled. Then Simon asked me to return error codes on each path (review on the v2 of the patches):
https://marc.info/?l=u-boot&m=168012024923488&w=2
One such example is buck regulator supplying e.g. SD and eMMC Vcc .
On the other hand, it appears it will take longer to get the refcount applied though.
I think we need to sort out the fallout, but that's probably still fine.