Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1154277pxa; Thu, 13 Aug 2020 01:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEeoq59cZlb98QsKXi6S6PgdzzOS6Xv2X163GLdYwFsoKMF2L0WJPhNfHpC2lvgJbQ3iQl X-Received: by 2002:a05:6402:37b:: with SMTP id s27mr3721493edw.239.1597308582053; Thu, 13 Aug 2020 01:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597308582; cv=none; d=google.com; s=arc-20160816; b=FBByTBNsYqlYETBBaPCT03No4IyoMZCTqD/SwPphOWhQrSMKOm3ij9hfqZhCXmDucJ lW6kggRNT4nlTWwk1AjlnEyQpTHlo0j4iij0I89IayKPgeUaL9cM+q7w/DORooqG6gjy 4Y7ck7fP5M2glM2g/cUrTDfkUDFBRclC9BtW7WPI4in93HFiy39uucXVrq7vgrRA8+yK KXpKNyPGN6Sw/c6LRFrjHvwCmWzzkzw5iWxHW2NryeQR8uD1kd1VypjLb2Y4FvTJ8izh OhniYHnmACkJCcMgBTBDe7Oz+ybID4z2DaPNaSPG44Pd+c1encYhHoPg5pf2mguYGG6K shtQ== 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:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=/8Zb7twX/q14Gfv7gxs2eAASLEVBsyuTxj2VKwvPgbQ=; b=NECCcYTJz6T1D1TDMJKRs02/1Auhd5ugRVaCTjwpy9uoWz+T3vNMAK3RIlEbny9sa1 7b8BhTWSbazr+ta8Whrsuu/8egv3K4z5M07Ttq0OOfuCeP5Qpl9K3lZGowzKCS/vn6FT B8UyKVlJtwXXjrqc7n+5UuopjCCeeOxnliXGxWd2kB74ixi5qn8ZsUdgCrA+PFuRpXwH CvV0TVAeE5TrD+gmbxo12BFnoO6maY9EP27SJCgrEMDb08fvHA3oVB2u+aQmXfdCxox9 rheobZoj2+vCWeDdwsAF7OQHHn9VXGMWRLRIQI0dCjNR5HVdzE+ZTTG/Wuh5VUW+RSrd vhSA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bf22si2946758edb.475.2020.08.13.01.49.19; Thu, 13 Aug 2020 01:49:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726703AbgHMIpO (ORCPT + 99 others); Thu, 13 Aug 2020 04:45:14 -0400 Received: from mx2.suse.de ([195.135.220.15]:37448 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726107AbgHMIpO (ORCPT ); Thu, 13 Aug 2020 04:45:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 86D17B5EC; Thu, 13 Aug 2020 08:45:34 +0000 (UTC) Date: Thu, 13 Aug 2020 10:45:11 +0200 Message-ID: From: Takashi Iwai To: Yu-Hsuan Hsu Cc: "Lu, Brent" , Pierre-Louis Bossart , 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 Subject: Re: [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board In-Reply-To: References: <3f3baf5e-f73d-9cd6-cbfb-36746071e126@linux.intel.com> <20200811145353.GG6967@sirena.org.uk> <20200811172209.GM6967@sirena.org.uk> <0714b222-d3fc-5744-1147-bfac7df2651e@linux.intel.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=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Takashi > > > > > Another problem is the buffer size. Too large buffer is not just wasting memories. > > It also creates problems to memory allocator since continuous pages are not > > always there. Using a small period_count like 2 or 4 should be sufficient for audio > > data transfer. > > > > buffer_size = period_size * period_count * 1000000 / sample_rate; > > snd_pcm_hw_params_set_buffer_time_near(mPcmDevice, params, &buffer_size, NULL); > > > > And one more problem here: you need to decide period_size and period_count > > first in order to calculate the buffer size... > It's a good point. I will bring it up to our team and see whether we > can use the smaller buffer size. Thanks! > > > > > > Regards, > > Brent > > Thanks, > Yu-Hsuan >