Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp289951yba; Thu, 18 Apr 2019 01:04:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzrOuxkw6sUA/aBKaOBwORO02Q7usVstyLNOC06vCK/Fu2Tyb6KVvpB3+1oeCvQhulqlO17 X-Received: by 2002:aa7:82cb:: with SMTP id f11mr95815822pfn.0.1555574688304; Thu, 18 Apr 2019 01:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555574688; cv=none; d=google.com; s=arc-20160816; b=gqK/m/6EjTie1toOEThaWWv51AEEmkfBwoFnMAJBq3+rz9SnBN0Z0/L1OSw9GD6GAt PvsxDXms1/VE10izqNa7oJMJgBb5E7TqBjQumFb9X7nF1orfW9y3mt+KJEsptdDOuc+J 3of/xGjVxhojKP94ePG7BliKaKc/vj0A0OC8VkslTfVsJ6755j5E0JJjVcX4Ob2aS3zD 347LHUGib6qTHYGxeuCgcMWwanlJI0+AS66NP/morYPcpMka1YYtz7mohlh+03pBvZkw 45njZSQdOm5Rr76/ryjOmDM2WtFUbQuqRra557HBp3i9aBGkHgkjH12sWB+U5YnbH3oO lgyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+AcexFMyMV8J9T4qaaiOIbAuRbOHeJ5v2ghunSbBPws=; b=YdnH0Qq44catsr6IsCThmp1VNLlVveiy3Xzb+VfHLexoVwu8Y8DUnIwTxI8T0ZW4Mr unW1tYsUWFwtdVJapLfje6tEnQAbdPTSqh1NF1ba7AzNracpypQFm7Mi2j62J1vsjPYn tpgZfIeneGdSn6IZ0JeVnG1iP/J54FPpJ5gkEHVw0x5Z1m3BlChEs86XKOYmDqKyg28v RUnJX6OI/OI6hbhon1XzQ4Wlw5x+TCiNA/fOHKRus2Ev7pO6rrC6eCfGLNy5+QDAw+k+ Se5dKE2pKAfSkOeLHLgZWUK5vgATwWaDNjq1apzcs+3Kq8dxf+L2AqFJO82iWLxfG9eb V0Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KoU9tiDF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si1278151pgd.166.2019.04.18.01.04.33; Thu, 18 Apr 2019 01:04:48 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KoU9tiDF; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388237AbfDRIDU (ORCPT + 99 others); Thu, 18 Apr 2019 04:03:20 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44898 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726873AbfDRIDU (ORCPT ); Thu, 18 Apr 2019 04:03:20 -0400 Received: by mail-pg1-f194.google.com with SMTP id i2so811026pgj.11 for ; Thu, 18 Apr 2019 01:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+AcexFMyMV8J9T4qaaiOIbAuRbOHeJ5v2ghunSbBPws=; b=KoU9tiDFNy/SfiGvLelvpEoklY4NKmsjJk9yitVcyFbcDCltCLOAXmUtuDvVNteD8G +BFVVantAaV1AItQq+6OtHbUb4RoFl6PXdbfP17LXgfWkTdyP/ICNrvwu0vnLdKShHkL pU405XnZK+7hY09ALpr9j6HDYSw0xnEgN0lZhfqRI2fInkXOyhcIJS7HJwmO3NjokhbC 3zm5eWlUbOEME4Mf3MrljVKUAoz3rjlP+MsovqQe/JVoI7yPO0sl2Ki6eKvldtDM11Br bsEB/2xJuoeJLl9c/rR1Nb6Habkj3R3FHnjTqV0PkE6O+9FVDEDoPuF/2tX05qKFAwQ5 L1iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=+AcexFMyMV8J9T4qaaiOIbAuRbOHeJ5v2ghunSbBPws=; b=p0FTnWOLK4WthUOq/X5e1l6CHQGMLqr9M544e3BcUd1kq+maUxBoOuslacTmZbNpAc J7hevNx3kEJzEQEcUzW9F8Iri4pof8NqBCNcuuKSSndUDeudquGs5hqoUlj/kGcB/Z0o 3XdnTPm3vG95YFg+qSSAkAL6tnukMSz+XNY477REf1D8WC1zqYq1mjntINWmBgACSXLv W3ych49/SDl+V67csMdOpF8vN0Em/JO3iMbSR3J3gvQKirlzmgL95eDtKbIDDe9vIZzK ISQAHgzDhK+34M7tVe5qikjmfvc2FIc5z8MPjMFz6yc0SookcUArQuW+UhykCj4TS93w r1Ig== X-Gm-Message-State: APjAAAWP49Elh1BzMz8+RRdTbwgCVsiTRA0OFDuLH+gAgftv8ioZPoNs trOGROxmaJHTttVWdTrQoiA= X-Received: by 2002:a63:ef4c:: with SMTP id c12mr74651267pgk.43.1555574598950; Thu, 18 Apr 2019 01:03:18 -0700 (PDT) Received: from Asurada (c-98-248-47-108.hsd1.ca.comcast.net. [98.248.47.108]) by smtp.gmail.com with ESMTPSA id d69sm2455676pfg.24.2019.04.18.01.03.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 01:03:18 -0700 (PDT) Date: Thu, 18 Apr 2019 01:03:10 -0700 From: Nicolin Chen To: "S.j. Wang" Cc: "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V3 1/2] ASoC: fsl_asrc: replace the process_option table with function Message-ID: <20190418080309.GA9788@Asurada> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 18, 2019 at 02:37:03AM +0000, S.j. Wang wrote: > > Here: > > > + /* Does not support cases: Tsout > 8.125 * Tsin */ > > > + if (inrate * 8 > 65 * outrate) Though it might not matter any more (see my last comments), it should be "inrate > 8.125 * outrate" in the comments. > > > + return -EINVAL; > > And here: > > > + ret = fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc); > > > + if (ret) { > > > + pair_err("No supported pre-processing options\n"); > > > + return ret; > > > + } > > > > Instead of a general message, I was thinking of a more specific one by > > telling users that the ratio between the two rates isn't supported -- > > something similar to what I suggested previously: > > > > pair_err("Does not support %d (input) > 8.125 * %d (output)\n", > > outrate, inrate); > > > In fsl_asrc_sel_proc, we can't call the pair_err for there is no > struct fsl_asrc_pair *pair in the argument. Do you think we need to > add this argument? I's thinking of adding it to the top of fsl_asrc_config_pair() as a part of inrate-outrate-validation, however, I found that actually we already have a similar check in the early routine: if ((outrate > 8000 && outrate < 30000) && (outrate/inrate > 24 || inrate/outrate > 8)) { pair_err("exceed supported ratio range [1/24, 8] for \ inrate/outrate: %d/%d\n", inrate, outrate); return -EINVAL; } And this is according to IMX6DQRM: Limited support for the case when output sampling rates is between 8kHz and 30kHz. The limitation is the supported ratio (Fsin/Fsout) range as between 1/24 to 8 This should cover your 8.125 condition already, even if having an outrate range between [8KHz, 30KHz] check, since an outrate above 30KHz will not have an inrate bigger than 8.125 times of it, given the maximum input rate is 192KHz. So I think that we can just drop that 8.125 condition from your change and there's no need to error out any more. However, we do need a patch to fix a potential rounding issue: - (outrate/inrate > 24 || inrate/outrate > 8)) { + (outrate > 24 * inrate || inrate > 8 * outrate)) { Should fix the missing whitespace also. And it will be needed to send to stable kernel too. Will you help submit a change? Thanks