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

Commit a64cfbbe authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

usb_bam: Inject descriptor with EOT set if sps pipe is not empty



Currently USB driver is checking whether sps pipe for IPA consumer
is empty for 10msec and if it is not drained within timeout, going
ahead disconnecting IPA consumer pipe. IPA core won't ack to IPA BAM
if last descriptor before cable disconnect doesn't have EOT. This leads
to NOC error at IPA core level if goes ahead with disconnecting pipes
without sps pipe is drained. Hence inject descriptor with EOT set
to resolve the issue.

Change-Id: If0d7717137ce0d191299dc154b2321e1be1d1356
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 66bb76e4
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -931,22 +931,27 @@ static int usb_bam_disconnect_ipa_cons(
	struct usb_bam_pipe_connect *pipe_connect;
	struct sps_pipe *pipe;
	u32 timeout = 10, pipe_empty;
	struct usb_bam_sps_type usb_bam_sps = ctx->usb_bam_sps;
	struct sps_connect *sps_connection;
	bool inject_zlt = true;

	idx = ipa_params->src_idx;
	pipe = ctx->usb_bam_sps.sps_pipes[idx];
	pipe_connect = &ctx->usb_bam_connections[idx];
	sps_connection = &usb_bam_sps.sps_connections[idx];

	pipe_connect->activity_notify = NULL;
	pipe_connect->inactivity_notify = NULL;
	pipe_connect->priv = NULL;

retry:
	/* Make sure pipe is empty before disconnecting it */
	while (1) {
		ret = sps_is_pipe_empty(pipe, &pipe_empty);
		if (ret) {
			pr_err("%s: sps_is_pipe_empty failed with %d\n",
			       __func__, ret);
			break;
			return ret;
		}
		if (pipe_empty || !--timeout)
			break;
@@ -954,9 +959,22 @@ static int usb_bam_disconnect_ipa_cons(
		/* Check again */
		usleep_range(1000, 2000);
	}
	if (!pipe_empty)
	if (!pipe_empty) {
		if (inject_zlt) {
			pr_debug("%s: Inject ZLT\n", __func__);
			inject_zlt = false;
			sps_pipe_inject_zlt(sps_connection->destination,
					sps_connection->dest_pipe_index);
			timeout = 10;
			goto retry;
		}
		pr_err("%s: src pipe(USB) not empty, wait timed out!\n",
								__func__);
		sps_get_bam_debug_info(ctx->h_bam, 93,
				(SPS_BAM_PIPE(0) | SPS_BAM_PIPE(1)), 0, 2);
		ipa_bam_reg_dump();
		panic("%s:SPS pipe not empty for USB->IPA\n", __func__);
	}

	/* close USB -> IPA pipe */
	if (pipe_connect->pipe_type == USB_BAM_PIPE_BAM2BAM) {