Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3843266ybv; Mon, 10 Feb 2020 07:24:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwUsGCyztqFaK5evhUqhjCXDIIVBvpHEGP0m3vfJuO1x+wgV75Fld+Vfeak+av2O17dXPq7 X-Received: by 2002:a9d:6415:: with SMTP id h21mr1521466otl.152.1581348263297; Mon, 10 Feb 2020 07:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581348263; cv=none; d=google.com; s=arc-20160816; b=VE+Uxpz46xbkOBBYGuNj2dUlhovPlCNpuhpXuWtxgkGdyht353LwY1ln5tbO7DzJHe Y0425VbzsyhNFSkKFgM8zdQRs3C79JFoayFy7tN4yC04/DJFG7cGK/tbV2Sk/S33WC8Y uSLwZl5zNqWOS/LLpaH5xT6EmMzQZYRjkeHGwF/IdZNnnPKjvlfk1+2pviN5tlFArB5r TtpgY2689JG/TAHu0dGANEHF2vexBlq9TAnzbF2HYf8Ufhh+CvGpaYeZY1rGLaKtbPQS sLPlwxwNyaH9QcQZjKGmMZD4JjxtLkSPxwsy7PhK1y3aqW24EBMfXXCmcRasPxLk4DJR DfHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=tGOYffr8yDK9VT9AqvrxFzAU8FlGdNurvbCg3wJuIo8=; b=pkqzoixlXzf6+Rt7eWg68X7gUT+jZWa29GjgavOOGtXsNN5r+dQ7BMz7+boM9ORnlI 8B8jXXsRYzeqSWHmG5MWzD38KCahiBxm/5VT4ocaZNYBCYW1olE81btY78l1P4yFVcaf boAwQOF+uWuM8fk8stm69HeWwj72UhDFF/c7zF5BJNNPBVWeNycEUsWUs2nirx+9947L 9AmVKecf8NA7sY6GpRxMDYbXbvsPZjfnBelZV7GEZeln/BHKuEE2YJPRo3kCQgfnwQrk 8g2mAzIOG1Niv7706mda9R5MIXaijUKgkne0B36sHUsGthB5VaJAj+bkJpar/2H/Qcce hyzw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si319528otr.304.2020.02.10.07.24.11; Mon, 10 Feb 2020 07:24:23 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727777AbgBJPXb (ORCPT + 99 others); Mon, 10 Feb 2020 10:23:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:40708 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgBJPXb (ORCPT ); Mon, 10 Feb 2020 10:23:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 669F1B12A; Mon, 10 Feb 2020 15:23:29 +0000 (UTC) Date: Mon, 10 Feb 2020 16:23:29 +0100 Message-ID: From: Takashi Iwai To: Peter Ujfalusi Cc: , , , , , , , Subject: Re: [PATCH v2] ALSA: dmaengine_pcm: Consider DMA cache caused delay in pointer callback In-Reply-To: <20200210151402.29634-1-peter.ujfalusi@ti.com> References: <20200210151402.29634-1-peter.ujfalusi@ti.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Feb 2020 16:14:02 +0100, Peter Ujfalusi wrote: > > 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 > --- > Hi, > > Changes since v1: > - use bytes_to_frames() for the DMA delay calculation > - Drop changes to soc-pcm > > 5.6-rc1 now have support for reporting the DMA cached data. > With this patch we can include it to the delay calculation. > The first DMA driver which reports this is the TI K3 UDMA driver. > > Regards, > Peter > > 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); Another call of bytes_to_frames() below... > } > > return bytes_to_frames(substream->runtime, pos); ... refers to substream->runtime. Better to align both places, either runtime or substream->runtime. With that minor nitpick, the change looks good: Reviewed-by: Takashi Iwai thanks, Takashi