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

Skip to content
Commit 6c0ffc67 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh Committed by Subbaraman Narayanamurthy
Browse files

soc: altmode: Detect when remote subsys fails to respond



The remote subsystem acknowledges all Altmode PMIC GLINK messages sent
to it. Print an error message anytime it fails to do this.

In the case when no client is found for a received message, do the
sending of the ack in a separate worker thread instead of a plain
function call to altmode_send_ack(). This is to avoid a deadlock and
consequent timing out in altmode_write(), which will happen in the
following scenario:
- A message is received for a nonexistent client.
- altmode_send_ack() is called from within altmode_callback().
- The PAN ACK is sent to the remote subsystem via pmic_glink_write() in
  altmode_write() and the remote subsystem replies with an ACK (opcode
  USBC_CMD_WRITE_REQ).
- Subsequently, in altmode_write() we wait for completion timeout, which
  will happen only if this new ACK message is processed by PMIC GLINK.
- PMIC GLINK is waiting for altmode_callback() to return so that it can
  process the new message.
- We are still waiting in altmode_callback() for altmode_send_ack() to
  complete.
- We time out in altmode_write() waiting for the completion to occur.

This problem is solved by firing off a worker thread to send the PAN ACK
so that altmode_callback() can exit quickly and allow the incoming new
ACK to hit the complete() in the USBC_CMD_WRITE_REQ case in
altmode_callback().

Also add a couple of minor fixes to some debug messages while we're at
it.

Change-Id: I3d80b1a7d6cc03b0eba61b5c9cc660ce7d377942
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent fd62b366
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