Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3801499ybb; Mon, 6 Apr 2020 16:20:42 -0700 (PDT) X-Google-Smtp-Source: APiQypJemDZn2p31fPIqaYW69niiqE8FSNJBYpiFugFPWFDdhnw6DoLBzb+4IjXouFLaGw9OAm5e X-Received: by 2002:aca:4a08:: with SMTP id x8mr1517195oia.158.1586215242871; Mon, 06 Apr 2020 16:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586215242; cv=none; d=google.com; s=arc-20160816; b=Ayx3Mcw7leTFMWJawCOKaZrVsdkRY3Emt2gGYAXeGCeZVjR+4OqWEqfJ3Hp9Se22Au +1qmUAJL3JNrj7WsCSZJ7wt+SUQ6MqAq0AafqseQCxrWu2ZCPYSmTnujzrKyoVq0LsPW xtzTDT3wK8mVjssPgLx+qstXqaYdfOUyagzm45d/ZQjLkVpSRY2ym26mH7V1FDGnUomI DjhjmRVKvAFJmAyxPcDt5M1dDSrtlUgrxA2WQZKdizp9+PJjNlxz+3mUeV4+D0AM7YCI VRhFuNvw4P3ww08cmN37QnE+xmKRPvcxXCqSLUQa42RBNWIbIh/6jKlpd74YV4OATrji m4yw== 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=qiEMQ3MnZPBtfcN59NTsvK6kDONkxcqt/LljkK1BS58=; b=aNryJNSIegiRXlfDmAXb16gexGVPlUp7+pjUrjt5IRku3H/lvKu77eWqtE5yYms+Re fVp63R9pgGkC8mGoCREXQsbmvexiYFczEaza+/2OpVUhzoCGccx43eJUX79E3P5/WofR RcEWEYLHJVPtn1TYwbwas3sbGh3FEPZWW+kOSHGGKMU6O5vK9uT5Iruw66wyRo3mBBvb 3DTNQdf9bnIyzDZkPaafg3VNoMjBap/2TYZG1NVf5WW0PAcb9kZiPw5xcNrbWc8T/yAT Nl+oVfj630fWGKiyQEWcmuv98qt/vIjVQ1aGMEqJukF+M/Q3vQw2VaiQ3RFzeBdamKG7 H0VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wh907092; 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 l22si450235otd.53.2020.04.06.16.20.30; Mon, 06 Apr 2020 16:20:42 -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=Wh907092; 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 S1726329AbgDFXTp (ORCPT + 99 others); Mon, 6 Apr 2020 19:19:45 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:38478 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbgDFXTp (ORCPT ); Mon, 6 Apr 2020 19:19:45 -0400 Received: by mail-pj1-f66.google.com with SMTP id m15so578641pje.3; Mon, 06 Apr 2020 16:19:43 -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=qiEMQ3MnZPBtfcN59NTsvK6kDONkxcqt/LljkK1BS58=; b=Wh9070924djEGtjlOfMWm3UFGyjc2B4vmxZxdcBAFkiAc1QiSjxqTx9d0m8DBopdP7 HuDT/VhNJC+8tM727HYCqdlOtJZVUQ8xhLKP2twBf5CUd4KQ15FMv7A9rkzcX3JPOUpe MV6It+FIRA2BIRSbq/bI6iw3+sXW8cqRPbwa7Y9KrRro2K3Nv0TiNBsKtmLZ2SErQfJl YJcpMjKVh/0EVzznKwspgZgcDJLvG/D4bnd9eBi1I62eZKe5iKtbub4+5EnPwyRRTtC5 TIZskK/zQ/mhyIhM7l8BYnFwGJTpp6KELsy9FFTvN0Uq67B2kLRPOSKlceAnBHUE/iAw sPGQ== 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=qiEMQ3MnZPBtfcN59NTsvK6kDONkxcqt/LljkK1BS58=; b=TSh3PiWv1LzwJqWZsgj28/aMCpuG8lHq+uBmARDvGVrIXTaYUW9ykXVZVFFX/N9N1J uo8bys8HfdJzBJQ/qWOaFqgEuhRTpyH8EFuuguqq52kZVCLCzs7po+R6xf66nDPW6y2R 6of6x+gNxY8H8DTdxzPqQPfXWAbf47mOxwqxkWlmHKvmams+9stpLrM+/EW/ncnjqE3I SGrhiXj6bUsiEK7GVXOSp33Y7PCdW5sCxWGYfh1ZplOszxMdGny+W1cnk63U7JjjqpEp Pm6I1EfcwV4soqCFjwN78PUBqK8mQLUcAH9cFT2RyB3QgXRYfECz+jqVs5jWvP2bNeiF BEIQ== X-Gm-Message-State: AGi0Puak77a+QwFBIjD2VOAWde+5uj74a0OxLc2Uagy5rtiRT40nuJhf E/z4nwngd3eOJR0dDZT1eJ4= X-Received: by 2002:a17:90a:324b:: with SMTP id k69mr1963136pjb.50.1586215183169; Mon, 06 Apr 2020 16:19:43 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id c126sm12625459pfb.83.2020.04.06.16.19.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Apr 2020 16:19:43 -0700 (PDT) Date: Mon, 6 Apr 2020 16:19:45 -0700 From: Nicolin Chen To: Shengjiu Wang Cc: timur@kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, alsa-devel@alsa-project.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 4/7] ASoC: fsl_asrc: Support new property fsl,asrc-format Message-ID: <20200406231945.GA20945@Asurada-Nvidia.nvidia.com> References: <496f49f1fe20b969f4456b591f62223d430c6d74.1585726761.git.shengjiu.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <496f49f1fe20b969f4456b591f62223d430c6d74.1585726761.git.shengjiu.wang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just some small comments. On Wed, Apr 01, 2020 at 04:45:37PM +0800, Shengjiu Wang wrote: > In order to align with new ESARC, we add new property fsl,asrc-format. > The fsl,asrc-format can replace the fsl,asrc-width, driver > can accept format from devicetree, don't need to convert it to > format through width. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/fsl_asrc.c | 40 ++++++++++++++++++++++-------------- > sound/soc/fsl/fsl_asrc.h | 4 ++-- > sound/soc/fsl/fsl_asrc_dma.c | 15 +++++++++++--- > 3 files changed, 39 insertions(+), 20 deletions(-) > > diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c > index 4d3e51bfa949..eea19e2b723b 100644 > --- a/sound/soc/fsl/fsl_asrc.c > +++ b/sound/soc/fsl/fsl_asrc.c > @@ -1052,16 +1047,31 @@ static int fsl_asrc_probe(struct platform_device *pdev) > return ret; > } > > - ret = of_property_read_u32(np, "fsl,asrc-width", > - &asrc->asrc_width); > + ret = of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_format); > if (ret) { > - dev_err(&pdev->dev, "failed to get output width\n"); > - return ret; > + ret = of_property_read_u32(np, "fsl,asrc-width", &width); > + if (ret) { > + dev_err(&pdev->dev, "failed to get output width\n"); Similar to the comments against sound card driver: "failed to decide output format" > + return ret; > + } > + > + switch (width) { > + case 16: > + asrc->asrc_format = SNDRV_PCM_FORMAT_S16_LE; > + break; > + case 24: > + asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; > + break; > + default: > + dev_warn(&pdev->dev, "unsupported width, switching to 24bit\n"); Should match what the code does after the change: + dev_warn(&pdev->dev, + "unsupported width, use default S24_LE\n"); > + asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; > + break; > + } > } > > - if (asrc->asrc_width != 16 && asrc->asrc_width != 24) { > - dev_warn(&pdev->dev, "unsupported width, switching to 24bit\n"); > - asrc->asrc_width = 24; > + if (!(FSL_ASRC_FORMATS & (1ULL << asrc->asrc_format))) { > + dev_warn(&pdev->dev, "unsupported format, switching to S24_LE\n"); Could fit 80 characters: + dev_warn(&pdev->dev, "unsupported width, use default S24_LE\n"); > diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c > index 5fe83aece25b..b15946e03380 100644 > --- a/sound/soc/fsl/fsl_asrc_dma.c > +++ b/sound/soc/fsl/fsl_asrc_dma.c > @@ -230,10 +230,19 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component *component, > return -EINVAL; > } > > - if (asrc->asrc_width == 16) > + bits = snd_pcm_format_physical_width(asrc->asrc_format); Can we just use 'width' to match the function name?