Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1527002pxa; Thu, 13 Aug 2020 10:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDlgVmMPlmkEwnqHNEDZOMiqEi9egbry0QNRAaLjdDEfRxK56nFxNDNEdtjOUwR/8Kp+Oj X-Received: by 2002:a50:9d8a:: with SMTP id w10mr5547160ede.16.1597339174994; Thu, 13 Aug 2020 10:19:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597339174; cv=none; d=google.com; s=arc-20160816; b=YIWDLKd3nQ5FQx4r9KU65jUbwzWfF+Z5bgRRGckVXZykzIm8cra0sSHm9XJ0FyespE cnEKMzbeMfULcfOrYe5eXVndWd1tcuSKf0T93pCNZqxDXMH/wbMIa+C+khiD3hkdaa/j 11iWiq1GLJzdblNXsRuC9YDzJfqX7rUu75D1q+XcSk+onDxL0p3RqtXmlAFq2oPiSTKZ 8i4ewkUGfSB62OlF0hGoI8u3jecXE7Y1fCj0m9zvmvhGszh6leSQ4OAVVBGGKB92bIKS ARI9we+sZKymai6xWEbfuC9W1Kp+fnnXhNiYQBZ74XCHm/CYVqi7iqtQRGY4mG6MgBl3 HWGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=tAbE60AfPQ68SFoJfLwXxAhzymsyN9ddwLjjDAk36no=; b=qu/XBNfGXIooPmH10gU7Gjd1IyqSbI4V4ouO0+NziTL9mdzoaWMfH18CBkptQjl1Z+ q/o4412GlRlti7AItJ47yh+jWlKKPOlrBYw7mPhXdtqRTLcMPyzzQm8JloIR7BuSLz4I NVJ/BwaWde+O7H3oLnwqUFP6yDtzNpQofvxsj6pEhvgk2qHBZEKDnoIjTZmEySr9mmVN YCYs7+5dLDTat6lQjcst8Hvny5nlCKtRy/FUq3BiIpsFIZQ9WKYHoqTDWTxk1IBNcwqv 9RJj9RBhivoKMgETCJvOBhmlGGegjlowOAv0teP4qN6Di2m/8dqOCRD0pKSENoKxdVE/ 4Cxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U64AEa3y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si3349637ejj.109.2020.08.13.10.19.11; Thu, 13 Aug 2020 10:19:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U64AEa3y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726499AbgHMRQK (ORCPT + 99 others); Thu, 13 Aug 2020 13:16:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbgHMRQI (ORCPT ); Thu, 13 Aug 2020 13:16:08 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76074C061757 for ; Thu, 13 Aug 2020 10:16:07 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id a15so5959461wrh.10 for ; Thu, 13 Aug 2020 10:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=tAbE60AfPQ68SFoJfLwXxAhzymsyN9ddwLjjDAk36no=; b=U64AEa3ypgo0b0GxsyeuQmYXUbFWfpNdJO6SToZ63kYzeRUKcpZxxUu22Z+/O+B1SE LQ29FfOkUFi2kK4ebi32x20f0vDVQ0uSLjRZOOrWJnei4Z3CY9FAPtMVRQV2ahyQKt1M QTMiOpRlEwtXg4h7UGMJcg2UtpdD18dC0K0bM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tAbE60AfPQ68SFoJfLwXxAhzymsyN9ddwLjjDAk36no=; b=p5U7bqQJV3Xi6DC0O1eg8R1mJ2PU8KZ9lvXHs0nbP7OX0WnHkE3iw13UzMCahdX/73 qO6ebROLWdG1H4jY1t4jf81bW31KevnEFguFhvOp2sC2axVA3sZDmwBsqdk0YH3lfFhe Tp03381kR3ygd25wnZPKiTcH5H78+LYkDz8q+m+Fq4aAdkKqXx33PEkb0Rz9qmsTqcfq 8GXdrNeYbTW+8dXKf0OBci/OrHg91NraBnuT5LAjJ7f3RfVFJtdTIlA1nZGn8LLqD8s4 tnqq6gJvj6MiraPkJ8XsN9Mt2IlRomxBxOPyetCxw5uowDk3JCn5xTsOqouRzS5s5wdW YA2Q== X-Gm-Message-State: AOAM533Aq1tWdOcH0V0iDPbsWcxYIr4NtbulnSdE1WHydM2agiIIYB0J SrA9tNzgH+MejjZER9n6CBoJ5I0XoAvc68iMdAq3TA== X-Received: by 2002:a05:6000:1091:: with SMTP id y17mr5222406wrw.255.1597338966174; Thu, 13 Aug 2020 10:16:06 -0700 (PDT) MIME-Version: 1.0 References: <3f3baf5e-f73d-9cd6-cbfb-36746071e126@linux.intel.com> <20200811172209.GM6967@sirena.org.uk> <0714b222-d3fc-5744-1147-bfac7df2651e@linux.intel.com> In-Reply-To: From: Yu-Hsuan Hsu Date: Fri, 14 Aug 2020 01:15:54 +0800 Message-ID: Subject: Re: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board To: Pierre-Louis Bossart Cc: Takashi Iwai , "Lu, Brent" , Guennadi Liakhovetski , "alsa-devel@alsa-project.org" , Andy Shevchenko , Kuninori Morimoto , Kai Vehmanen , "linux-kernel@vger.kernel.org" , "Rojewski, Cezary" , Jie Yang , Takashi Iwai , Liam Girdwood , Sam McNally , Mark Brown , Ranjani Sridharan , Daniel Stuart , "yuhsuan@google.com" , Damian van Soelen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pierre-Louis Bossart =E6=96=BC 2020=E5=B9=B48=E6=9C=8813=E6=97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=888:5= 7=E5=AF=AB=E9=81=93=EF=BC=9A > > > > On 8/13/20 3:45 AM, Takashi Iwai wrote: > > On Thu, 13 Aug 2020 10:36:57 +0200, > > Yu-Hsuan Hsu wrote: > >> > >> Lu, Brent =E6=96=BC 2020=E5=B9=B48=E6=9C=8813=E6= =97=A5 =E9=80=B1=E5=9B=9B =E4=B8=8B=E5=8D=883:55=E5=AF=AB=E9=81=93=EF=BC=9A > >>> > >>>>>> > >>>>>> CRAS calls snd_pcm_hw_params_set_buffer_size_max() to use as large > >>>>>> buffer as possible. So the period size is an arbitrary number in > >>>>>> different platforms. Atom SST platform happens to be 256, and CML > >>>>>> SOF platform is 1056 for example. > >>>>> > >>>>> ok, but earlier in this thread it was mentioned that values such as > >>>>> 432 are not suitable. the statement above seems to mean the period > >>>>> actual value is a "don't care", so I don't quite see why this speci= fic > >>>>> patch2 restricting the value to 240 is necessary. Patch1 is needed = for > >>>>> sure, > >>>>> Patch2 is where Takashi and I are not convinced. > >>>> > >>>> I have downloaded the patch1 but it does not work. After applying pa= tch1, > >>>> the default period size changes to 320. However, it also has the sam= e issue > >>>> with period size 320. (It can be verified by aplay.) > >>> > >>> The period_size is related to the audio latency so it's decided by ap= plication > >>> according to the use case it's running. That's why there are concerns= about > >>> patch 2 and also you cannot find similar constraints in other machine= driver. > >> You're right. However, the problem here is the provided period size > >> does not work. Like 256, setting the period size to 320 also makes > >> users have big latency in the DSP ring buffer. > >> > >> localhost ~ # aplay -Dhw:1,0 --period-size=3D320 --buffer-size=3D640 > >> /dev/zero -d 1 -f dat --test-position > >> Playing raw data '/dev/zero' : Signed 16 bit Little Endian, Rate 48000 > >> Hz, Stereo > >> Suspicious buffer position (1 total): avail =3D 0, delay =3D 2640, buf= fer =3D 640 > >> Suspicious buffer position (2 total): avail =3D 0, delay =3D 2640, buf= fer =3D 640 > >> Suspicious buffer position (3 total): avail =3D 0, delay =3D 2720, buf= fer =3D 640 > >> ... > > > > It means that the delay value returned from the driver is bogus. > > I suppose it comes pcm_delay value calculated in sst_calc_tstamp(), > > but haven't followed the code closely yet. Maybe checking the debug > > outputs can help to trace what's going wrong. > > the problem is really that we add a constraint that the period size be a > multiple of 1ms, and it's not respected. 320 samples is not a valid > choice, I don't get how it ends-up being selected? there's a glitch in > the matrix here. > > Oh sorry that I applied the wrong patch. With the correct patch, the default period size is 432. With period size 432, running aplay with --test-position does not show any errors. However, by cat `/proc/asound/card1/pcm0p/sub0/status`. We can see the delay is around 3000. Here are all period sizes I have tried. All buffer sizes are set to 2 * period size. period size: 192, delay is a negative number. Not sure what happened. period size: 240, delay is fixed at 960 period size: 288, delay is around 27XX period size: 336, delay is around 27XX period size: 384, delay is around 24XX (no errors from aplay) period size: 432, delay is around 30XX (no errors from aplay) period size: 480, delay is fixed at 3120 (no errors from aplay) period size: 524, delay is around 31XX (no errors from aplay) Not sure why the delay is around 50ms except for the period size 240. Is it normal? Thanks, Yu-Hsuan