Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5092285ybv; Tue, 11 Feb 2020 09:02:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxJoIzwEeVEKfctgnune0jita6Srb14/+icKfMnogEq5zPpiuk+fezzCh6MKBic5Z/P6JSB X-Received: by 2002:a05:6808:b1c:: with SMTP id s28mr3507913oij.2.1581440566680; Tue, 11 Feb 2020 09:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581440566; cv=none; d=google.com; s=arc-20160816; b=kYD/Pq9qihVsDKgVAE8DtJe4lbD0zI2B75uioS9pct7lAeKTzIfNJSaE3REjUthDay wStA3bnDGWaaQ2Qaly6H1yCZPOAlNnYbjLuHMALGmAOal8QKDgnEvqrZHtypUOVWpgl0 1PCN12ni2IGOB6Kx8c8giNaoP75sEML6W32eOY0BosnbsSpnC2Fz9smrPFYq6x4zUyxC IkIMa3ohxCXD0qBzPBlpS3MICVq7DVRwk9PBm8wSeLUloL1h/jbRtyAQ4vSTQ3oGsuvi dlHHSang5DJQ2xNLzRrkxj4pZNJcLdv2Fty6IXomVIDDibBRYryVOZR5DAkwHaQ+tCR7 m3Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:in-reply-to:subject:cc:to:from :date; bh=5ZtlcfBpjxZOY6tDlwzmNaGUWCpnVTQ/2PpmGLp9sN8=; b=RPqSo32j5Py5SEnTa1pjZQ7MSgbCwcA6in8iTGSSqCHA65WcmykKQ9+sBoN2oDDfTU ENILT3SVB7sC3yuDWsqf0ww5Hpg3H0uX7oJr8hiN34qlRkixzxI8evw0EpI5nKiOcv5/ gJeNQ0dr6mY8PE1eiHFqBQ7HcLIfY6asLr554XcLPpwlQ7zG0t/rR5mbjuhlea4Z3BAG leFgZAXeYoElft3Hs8j4uQ1Wo9LE9h9owynJBFZo6cUrWg4YGMyr9YTdFFTgNi3NaDqv cPkUZ31yIjuXpb+WgszuhRD5MfLHRJSk6OlR6xfRE1Xv7hu/l2PJtHMGDzbw/XQRv6o0 OfXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si2191943otf.87.2020.02.11.09.02.27; Tue, 11 Feb 2020 09:02:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729720AbgBKPsg (ORCPT + 99 others); Tue, 11 Feb 2020 10:48:36 -0500 Received: from foss.arm.com ([217.140.110.172]:48204 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729058AbgBKPsf (ORCPT ); Tue, 11 Feb 2020 10:48:35 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64AC9FEC; Tue, 11 Feb 2020 07:48:35 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD5B43F68E; Tue, 11 Feb 2020 07:48:34 -0800 (PST) Date: Tue, 11 Feb 2020 15:48:33 +0000 From: Mark Brown To: Peter Ujfalusi Cc: alsa-devel@alsa-project.org, broonie@kernel.org, lars@metafoo.de, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, Mark Brown , perex@perex.cz, tiwai@suse.com, vkoul@kernel.org Subject: Applied "ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback" to the asoc tree In-Reply-To: <20200210151402.29634-1-peter.ujfalusi@ti.com> Message-Id: X-Patchwork-Hint: ignore Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.7 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From fa1f875c120fa44572c561d86022af2f6b0774c7 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 10 Feb 2020 17:14:02 +0200 Subject: [PATCH] ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback Some DMA engines can have big FIFOs which adds to the latency. The DMAengine framework can report the FIFO utilization in bytes. Use this information for the delay reporting. Signed-off-by: Peter Ujfalusi Reviewed-by: Takashi Iwai Link: https://lore.kernel.org/r/20200210151402.29634-1-peter.ujfalusi@ti.com Signed-off-by: Mark Brown --- sound/core/pcm_dmaengine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 5749a8a49784..d8be7b488162 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -247,9 +247,14 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer(struct snd_pcm_substream *substream) status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); if (status == DMA_IN_PROGRESS || status == DMA_PAUSED) { + struct snd_pcm_runtime *runtime = substream->runtime; + buf_size = snd_pcm_lib_buffer_bytes(substream); if (state.residue > 0 && state.residue <= buf_size) pos = buf_size - state.residue; + + runtime->delay = bytes_to_frames(runtime, + state.in_flight_bytes); } return bytes_to_frames(substream->runtime, pos); -- 2.20.1