From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolin Chen Subject: Re: [PATCH] ASoC: fsl_asrc: add protection for the asrc of older version Date: Fri, 1 Mar 2019 00:08:12 -0800 Message-ID: <20190301080812.GA5244@Asurada> References: <1551407560-29950-1-git-send-email-shengjiu.wang@nxp.com> <20190301025356.GA1371@Asurada-Nvidia.nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AA3AAF896C0 for ; Fri, 1 Mar 2019 09:08:21 +0100 (CET) Received: by mail-pl1-x641.google.com with SMTP id k2so11110143plt.3 for ; Fri, 01 Mar 2019 00:08:21 -0800 (PST) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: "S.j. Wang" Cc: "alsa-devel@alsa-project.org" , "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "linuxppc-dev@lists.ozlabs.org" List-Id: alsa-devel@alsa-project.org On Fri, Mar 01, 2019 at 06:55:25AM +0000, S.j. Wang wrote: > > Alternatively, I feel instead of error-out at here, should we add a HW > > constraint or at least fence it off at the beginning of the hw_params()? This > > is actually nothing specific to the pair-request function but a hardware > > constraint. > > How about add constraint in startup? > static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream, > struct snd_soc_dai *dai) > { > struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai); > > if (asrc_priv->channel_bits == 3) { > snd_pcm_hw_constraint_step(substream->runtime, 0, > SNDRV_PCM_HW_PARAM_CHANNELS, 2); > } > > return 0; > } Yea, that looks good to me. Better to have a line of comments to tell that "bits==3" means older version -- maybe we should have something much more clear than using channel_bits but it is fine for now since they only differ here.