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

Skip to content
Commit eb567250 authored by Saket Saurabh's avatar Saket Saurabh
Browse files

usb: phy-msm-usb: Fix bug with hvdcp connect and disconnect processing



The HVDCP charger is detected as a DCP charger by the USB driver. When a
DCP is detected, ext_chg_active flag is set to true and low power mode is
deferred by 3 seconds. When the user space receives the DCP connect uevent,
it kicks the charger detection algorithm. The charger detection procedure
involves reading and writing to the USB hardware registers and it makes an
ioctl call to block the low power mode by incrementing the pmruntime usage
counter. The user space calls the ioctl to unblock low power mode once
hvdcp detection is done by decrementing the pmruntime usage counter.

Consider the scenario where DCP detection is done and userspace makes
ioctl call to block low power mode. Next usb cable is disconnected and then
userspace makes ioctl call to unblock the low power mode by decrementing
the pmruntime usage counter. Due to this runtime suspend gets called and
USB clocks are turned off which later leads to unclocked access in
disconnnect processing. As part of USB disconnect, phy reset is done which
also involves ulpi register access. As clocks are turned off, it leads to
crash.

Fix the issue by making sure otg_sm work for usb disconnect is processed
first followed by decrementing the pmruntime usage counter in the ioctl
call made by userspace for unblocking the low power mode.

CRs-Fixed: 668648
Change-Id: I91db5f2e1084ae8f65dd8ec51c4314acc764c9c5
Signed-off-by: default avatarSaket Saurabh <ssaurabh@codeaurora.org>
parent 5e741700
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