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

Commit a88c330f authored by Yan He's avatar Yan He
Browse files

msm: sps: add handling of late EOT



The EOT signal can come later after the descriptor has been closed
by BAM HW. Add the support to handle this late EOT at the pipe
level.

Change-Id: Ibd2e467cf77e792888bb3748e8b31924911e2651
Signed-off-by: default avatarYan He <yanhe@codeaurora.org>
parent a47f571c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -177,6 +177,8 @@ enum sps_option {
	SPS_O_IRQ_MTI   = 0x00020000,
	/* NWD bit written with EOT for BAM2BAM producer pipe */
	SPS_O_WRITE_NWD   = 0x00040000,
	/* EOT set after pipe SW offset advanced */
	SPS_O_LATE_EOT   = 0x00080000,

	/* Options to enable software features */
	/* Do not disable a pipe during disconnection */
+20 −0
Original line number Diff line number Diff line
@@ -587,6 +587,7 @@ static void pipe_clear(struct sps_pipe *pipe)
	pipe->num_descs = 0;
	pipe->desc_size = 0;
	pipe->disconnecting = false;
	pipe->late_eot = false;
	memset(&pipe->sys, 0, sizeof(pipe->sys));
	INIT_LIST_HEAD(&pipe->sys.events_q);
}
@@ -1048,6 +1049,7 @@ int sps_bam_pipe_set_params(struct sps_bam *dev, u32 pipe_index, u32 options)
	ack_xfers = ((options & SPS_O_ACK_TRANSFERS));

	pipe->hybrid = options & SPS_O_HYBRID;
	pipe->late_eot = options & SPS_O_LATE_EOT;

	/* Create interrupt source mask */
	mask = 0;
@@ -1569,6 +1571,24 @@ static void pipe_handler_eot(struct sps_bam *dev, struct sps_pipe *pipe)
	/* Get offset of last descriptor completed by the pipe */
	end_offset = bam_pipe_get_desc_read_offset(dev->base, pipe_index);

	if (producer && pipe->late_eot) {
		struct sps_iovec *desc_end;
		if (end_offset == 0)
			desc_end = (struct sps_iovec *)(pipe->sys.desc_buf
				+ pipe->desc_size - sizeof(struct sps_iovec));
		else
			desc_end = (struct sps_iovec *)	(pipe->sys.desc_buf
				+ end_offset - sizeof(struct sps_iovec));

		if (!(desc_end->flags & SPS_IOVEC_FLAG_EOT)) {
			if (end_offset == 0)
				end_offset = pipe->desc_size
					- sizeof(struct sps_iovec);
			else
				end_offset -= sizeof(struct sps_iovec);
		}
	}

	/* If no queue, then do not generate any events */
	if (pipe->sys.no_queue) {
		if (!pipe->sys.ack_xfers) {
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ struct sps_pipe {
	u32 irq_mask;
	int polled;
	int hybrid;
	bool late_eot;
	u32 irq_gen_addr;
	enum sps_mode mode;
	u32 num_descs; /* Size (number of elements) of descriptor FIFO */