OSDN Git Service

usb: pd: Avoid blocking wait in SRC_TRANSITION_TO_DEFAULT
authorJack Pham <jackp@codeaurora.org>
Tue, 10 Oct 2017 23:59:32 +0000 (16:59 -0700)
committerGerrit - the friendly Code Review server <code-review@localhost>
Fri, 8 Dec 2017 06:39:30 +0000 (22:39 -0800)
commit37d3ef23d682f66d7f3d77ce49928a2882325777
treec9b69ed8f36984508056e941f5a46b09f23c31a7
parente5f8604fdbb137f26a6cdb89b33b4214ead43dfc
usb: pd: Avoid blocking wait in SRC_TRANSITION_TO_DEFAULT

When sending/receiving a hard reset in source mode, the
PE_SRC_TRANSITION_TO_DEFAULT state turns off VBUS/VCONN and
sleeps for 750ms. During this fairly long period any Type-C
event such as cable disconnect or reconnect won't get
processed as the workqueue is blocked by this wait condition.
This can lead to incorrect state handling, for example when
a sink is removed and a source is attached; the state machine
will think a sink is still attached. Fix this by removing
the msleep() and set a timer to restart the state machine
to PE_UNKNOWN which will turn VBUS/VCONN back on and start
again in PE_SRC_STARTUP. This frees up the workqueue to
process any potential incoming events in the meantime.

Change-Id: I282551a58252a672f319d1559eac9f4ad4c3ca8a
Signed-off-by: Jack Pham <jackp@codeaurora.org>
drivers/usb/pd/policy_engine.c