Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 48263195 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: otg: Prevent negative runtime PM count in host mode



In the case of OTG_STATE_A_HOST it's possible that this state
may get entered multiple times due to consecutive ID low & BSV
high interrupts. This would cause the pm_runtime_put() to get
called multiple times, and results in the runtime PM usage_count
getting decremented past zero.

Later when the host mode cable gets disconnected, the
dwc3_otg_start_host() routine will attempt to call pm_runtime_get()
but would result in a reference count of zero, and inadvertently
allows the dwc3-msm parent to go into suspend prematurely. This
will allow register acccess after the controller's clocks are
off and cause a system hang.

This is a relatively simple fix that replaces the pm_runtime_put()
with a put_noidle(), which guarantees that the reference count
does not go negative. The "noidle" in this case is allowable
because we are not attempting to go into suspend right away,
since the xHCI child device is active due to it being resumed
right before this. Only when the xHCI suspends will the parent
devices also get suspended.

Change-Id: Ia741c5044d1e3a0dcffae8d250508579d30bd10f
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 9e91c0c5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment