usb: phy-msm-qusb-v2: Add support for reference counting of regulators
Upon cable disconnect PMI calls qusb_phy_update_dpdm() to turn off phy
regulators before notifying vbus off to usb. As a result phy power down
sequence is executed with phy regulators turned off. This may result into
improper phy line state. Fix this issue by adding a reference counter to
keep track of all regulator enable and disable requests and only disable
regulator when ref count becomes zero. Also add a mutex in
qusb_phy_enable_power() API to prevent any race condition in enabling and
disabling phy regulators between the callers i.e. PMI and phy driver.
Change-Id: I620f2b8cbf4f9271db81d5a517f1ee2a13c57f27
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
1 file changed