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

Commit 01a9fdcd authored by Andrei Danaila's avatar Andrei Danaila Committed by Matt Wagantall
Browse files

msm: mhi: Enable clearing outstanding acks in MHI



After a channel reset, any pending acks on that channel
will not be received from the device.
In this case they must be cleared in the channel reset
command handling.

CRs-Fixed: 733172
Change-Id: I5b7c525f7f532ed107caa020cde33ec1955ae618
Signed-off-by: default avatarAndrei Danaila <adanaila@codeaurora.org>
parent 8ee8d05a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1123,6 +1123,8 @@ static enum MHI_STATUS reset_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
	struct mhi_chan_ctxt *chan_ctxt;
	struct mhi_client_handle *client_handle = NULL;
	struct mutex *chan_mutex;
	int pending_el = 0;
	struct mhi_ring *ring;

	MHI_TRB_GET_INFO(CMD_TRB_CHID, cmd_pkt, chan);

@@ -1139,6 +1141,19 @@ static enum MHI_STATUS reset_chan_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
	chan_ctxt = &mhi_dev_ctxt->mhi_ctrl_seg->mhi_cc_list[chan];
	mhi_log(MHI_MSG_INFO, "Processed cmd reset event\n");

	/*
	 * If outbound elements are pending, they must be cleared since
	 * they will never be acked after a channel reset.
	 */
	ring = &mhi_dev_ctxt->mhi_local_chan_ctxt[chan];
	if (chan % 2 == 0)
		get_nr_enclosed_el(ring, ring->rp, ring->wp, &pending_el);

	mhi_log(MHI_MSG_INFO, "Decrementing chan %d out acks by %d.\n",
				chan, pending_el);

	atomic_sub(pending_el, &mhi_dev_ctxt->counters.outbound_acks);

	/* Reset the local channel context */
	local_chan_ctxt->rp = local_chan_ctxt->base;
	local_chan_ctxt->wp = local_chan_ctxt->base;