RE: [PATCH] phy: renesas: rcar-gen3-usb2: fix imbalance powered flag
From: Yoshihiro Shimoda
Date: Fri Jun 07 2019 - 05:04:44 EST
Hi Geert-san,
> From: Geert Uytterhoeven, Sent: Wednesday, June 5, 2019 10:08 PM
<snip>
> > > From: Geert Uytterhoeven, Sent: Wednesday, June 5, 2019 6:25 PM
> > <snip>
> > > Thank you, this seems to fix the warning, so
> > > Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> >
> > Thank you for the testing!
> >
> > > However, the other imbalance (phy-ee080200.usb-phy.6 enabling its
> > > regulator during each system resume phase, but never touching it
> > > otherwise) is still present.
> >
> > Umm, since I'd like to investigate this,
> > would you share your debug print patch?
>
> Attached.
Thank you for your patch. Finally, I found the other imbalance is caused by
rcar_gen3_phy_usb2_power_on(). rcar_gen3_phy_usb2_power_on() should have
own mutex lock to avoid a race condition between calls rcar_gen3_are_all_rphys_power_off()
and assign the ->powered. So, I'll submit v2 patch later.
Notes:
- Even if the driver has such an own mutex, sometimes the different phy number
enables the regulator. But the imbalance enabling the regulator issue disappears.
- One of the phy channel has 4 phy devices. And the phy channel has a regulator
so that enabling the regulator by one of the phy devices is enough.
--- Example (v5.2-rc3 on R-Car H3) ---
# ls /sys/class/phy/
phy-e65ee000.usb-phy.12 phy-ee0a0200.usb-phy.0 phy-ee0c0200.usb-phy.5
phy-ee080200.usb-phy.10 phy-ee0a0200.usb-phy.1 phy-ee0c0200.usb-phy.6
phy-ee080200.usb-phy.11 phy-ee0a0200.usb-phy.2 phy-ee0c0200.usb-phy.7
phy-ee080200.usb-phy.8 phy-ee0a0200.usb-phy.3
phy-ee080200.usb-phy.9 phy-ee0c0200.usb-phy.4
- phy-ee080200.usb-phy is one of the phy channel.
-- And the "phy-ee080200.usb-phy" phy channel has a regulator.
-- Other phy channels (phy-ee0[ac]0200.usb-phy) don't have their regulators.
- phy-ee080200.usb-phy.{8,9,10,11} are phy devices.
----
Best regards,
Yoshihiro Shimoda