From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA09C433DF for ; Thu, 13 Aug 2020 12:57:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61DE020791 for ; Thu, 13 Aug 2020 12:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726546AbgHMM5j (ORCPT ); Thu, 13 Aug 2020 08:57:39 -0400 Received: from mga17.intel.com ([192.55.52.151]:30638 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgHMM5i (ORCPT ); Thu, 13 Aug 2020 08:57:38 -0400 IronPort-SDR: XMbXD5wOjMy9ylOIT79c5GULY32En/0TbSGuDlH2t3NjxCfD0ZjSbEkYXIkyifrbEQuuicv/L2 1KQmnGV6YK0g== X-IronPort-AV: E=McAfee;i="6000,8403,9711"; a="134262895" X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="134262895" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 05:57:38 -0700 IronPort-SDR: 4TbxNK5/QPQDHXXHIJNqMc9bTYRc/awbplus0DHvOH1EX6V8zHMPTO2JPHWk16GPlh3qi1OJok zcLByXumFfhA== X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="333100702" Received: from jsdraege-mobl1.amr.corp.intel.com (HELO [10.209.128.166]) ([10.209.128.166]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 05:57:36 -0700 Subject: Re: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board To: Takashi Iwai , Yu-Hsuan Hsu Cc: "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 References: <3f3baf5e-f73d-9cd6-cbfb-36746071e126@linux.intel.com> <20200811172209.GM6967@sirena.org.uk> <0714b222-d3fc-5744-1147-bfac7df2651e@linux.intel.com> From: Pierre-Louis Bossart Message-ID: Date: Thu, 13 Aug 2020 07:57:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 於 2020年8月13日 週四 下午3:55寫道: >>> >>>>>> >>>>>> 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 specific >>>>> 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 patch1, >>>> the default period size changes to 320. However, it also has the same 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 application >>> 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=320 --buffer-size=640 >> /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 = 0, delay = 2640, buffer = 640 >> Suspicious buffer position (2 total): avail = 0, delay = 2640, buffer = 640 >> Suspicious buffer position (3 total): avail = 0, delay = 2720, buffer = 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8D9DC433E1 for ; Thu, 13 Aug 2020 12:58:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43DA320829 for ; Thu, 13 Aug 2020 12:58:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="OyWYtspi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43DA320829 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9AD801616; Thu, 13 Aug 2020 14:57:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9AD801616 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1597323521; bh=CQkZnhNUCbl5WFGnGYih1ZdarJP7T1UBu8DBeOkoVbQ=; h=Subject:To:References:From:Date:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OyWYtspirXy3ivQGTCOmjHP49BBLLLWw763MhyaFdlb3C7nJt1xfTQxbWs9d7tmVH jBiOzHgoxI3QctMTHA6PG8JGLEmH83rVQXG4I9jGdbkYkU2+oMGc+2DrlZGygpXo5N fjWdWq/eu7hSLTtV3E41liz5rxgFRp6SmAgbhspQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 33749F8014C; Thu, 13 Aug 2020 14:57:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6624BF8015B; Thu, 13 Aug 2020 14:57:49 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 08B97F800F4 for ; Thu, 13 Aug 2020 14:57:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08B97F800F4 IronPort-SDR: m9SM90pgxM8xJ5xvX33/fEUWY3Tf+B/MqOZB8WJPONm+pD0nPJg1TFduAcf8ILIxmFpMYmw+vG 54eJaVn+ryxw== X-IronPort-AV: E=McAfee;i="6000,8403,9711"; a="172250870" X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="172250870" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 05:57:38 -0700 IronPort-SDR: 4TbxNK5/QPQDHXXHIJNqMc9bTYRc/awbplus0DHvOH1EX6V8zHMPTO2JPHWk16GPlh3qi1OJok zcLByXumFfhA== X-IronPort-AV: E=Sophos;i="5.76,308,1592895600"; d="scan'208";a="333100702" Received: from jsdraege-mobl1.amr.corp.intel.com (HELO [10.209.128.166]) ([10.209.128.166]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2020 05:57:36 -0700 Subject: Re: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board To: Takashi Iwai , Yu-Hsuan Hsu References: <3f3baf5e-f73d-9cd6-cbfb-36746071e126@linux.intel.com> <20200811172209.GM6967@sirena.org.uk> <0714b222-d3fc-5744-1147-bfac7df2651e@linux.intel.com> From: Pierre-Louis Bossart Message-ID: Date: Thu, 13 Aug 2020 07:57:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Cc: Guennadi Liakhovetski , "alsa-devel@alsa-project.org" , Kai Vehmanen , Kuninori Morimoto , "Rojewski, Cezary" , Jie Yang , "linux-kernel@vger.kernel.org" , Takashi Iwai , Liam Girdwood , Sam McNally , Mark Brown , "yuhsuan@google.com" , Ranjani Sridharan , Daniel Stuart , Andy Shevchenko , "Lu, Brent" , Damian van Soelen X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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 於 2020年8月13日 週四 下午3:55寫道: >>> >>>>>> >>>>>> 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 specific >>>>> 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 patch1, >>>> the default period size changes to 320. However, it also has the same 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 application >>> 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=320 --buffer-size=640 >> /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 = 0, delay = 2640, buffer = 640 >> Suspicious buffer position (2 total): avail = 0, delay = 2640, buffer = 640 >> Suspicious buffer position (3 total): avail = 0, delay = 2720, buffer = 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.