usb: pd: Do not allow pending out going requests with src_cap_ext
Currently, charger daemon requesting get_src_cap_ext request back to back,
resulting in too many PD messages from userspace to handle get_src_cap_ext.
There is a case where phy_msg_received() for SOURCE_CAPABILITIES_EXTENDED
and sm_work is queued to handle the response. Meanwhile userspace daemon
requested for select_pdo which will set the pd->send_request flag and
queue another sm_work immediately. But there is a possibility that
usbpd_sm work is still in running state to handle previous rx_msg received
for src_cap_ext. It will further checks for any pending out going requests
and try to handle it from from the same work hence state transition
to select_capability. In this state it will send the pd_msg for
SNK_SELECT_CAPABILITY and wait for response.
In this case the next sm_work has a deliberate delay such as waiting
for minimum 26msec of SENDER_RESPONSE_TIME, but the delay is effectively
eliminated and usbpd_sm gets executed immediately again which can cause
the state machine to think that timeout occurred and
will result in hard reset.
Hence fix this issue by exit the work after complete of src_ext_cap
so that it won't handle other pending outgoing requests from the
same work. Also handle this for other possible cases like PPS_Status,
Status, Battery_Capabilities and Battery_Status.
Change-Id: I586fbf50837c81b856eb30176564013e9bcde90f
Signed-off-by:
Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
Loading
Please register or sign in to comment