[Sound-open-firmware] [PATCH v2 10/26] host: for the last bytes/period, send read notification later

Keyon Jie yang.jie at linux.intel.com
Thu Feb 9 16:04:02 CET 2017


This read pointer indicate how much we have read, we can use it
to inform host side to refill the free periods.

But as it doesn't really mean that we have rendered all of them
(there may be several periods in the pipeline buffer), and for
the last bytes/period, host side will trigger stop immediately
once it got this notification.

To avoid lost for last several periods issue, we postpone this
notification to the finish of last bytes/period copy in dai,
which will be add in the following patches.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/host.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/audio/host.c b/src/audio/host.c
index ed4af37..4bd6406 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -174,7 +174,14 @@ static void host_dma_cb_playback(struct comp_dev *dev,
 	hd->host_period_pos += local_elem->size;
 	if (hd->host_period_pos >= hd->host_period_bytes) {
 		hd->host_period_pos = 0;
-		ipc_stream_send_notification(dev, &hd->cp);
+		/* for the last bytes/period, send notification later */
+		if (hd->host_avail) {
+			/* update for host side */
+			if (hd->host_pos) {
+				*hd->host_pos = hd->host_pos_read;
+				ipc_stream_send_notification(dev, &hd->cp);
+			}
+		}
 	}
 
 	local_elem->src += local_elem->size;
-- 
2.7.4



More information about the Sound-open-firmware mailing list