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.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 A466EC432C1 for ; Tue, 24 Sep 2019 21:44:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6AE94214DA for ; Tue, 24 Sep 2019 21:44:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PiWxYZbA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394922AbfIXVof (ORCPT ); Tue, 24 Sep 2019 17:44:35 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36461 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbfIXVof (ORCPT ); Tue, 24 Sep 2019 17:44:35 -0400 Received: by mail-pg1-f193.google.com with SMTP id t14so1578425pgs.3; Tue, 24 Sep 2019 14:44:33 -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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=PiWxYZbA9Phtp8IDK7idRhXLPFpVl8Nivv0bnnYLe3e3GtA0prmh/cyb4fHtq4Gim9 aqlwpu5kw/gwGvZgr1PevcKG1YZRm4NRav9JQY8t4jD9ouA1/i6jCrKJGPq1MnRdm8Za zcVcS52Iw7UOovvfOTsRw0smUUa/8C1pIbP5pRVkoBa2JcIuY3/NaibW6X98J/DrVnPP u4jagDKOIj26zhiMKPopz6CkiPG+busIukqq/hxVnslcJhWs4Uqbf5clU765/Ug97tzP vOBIcRr6706g6selmfD9KRihs4X4HljViLD/zguw80jjUXENnR6hn1v0FEDtWG+aN/C7 T+Nw== 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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=m6hwrDFZQljKqYn9xb2lspH47tRt6ugwVT9tb1PdP7hK2D/PiRmTqapFZjFRuLYmnC cHSHvN+FEhDg868zt8T14N5ZWdy6V5d0b9ORduEs59VQyMulbHqO8W1tUdmtukTzPd28 z+CUsR9o0yjbLwA84Ko2pTv1056rzYR/ot5ZBxKGunskf26C4SSrdK2atPRCGepWF6ua +jFW2XsnwnZd1R0HYbQ6hdgeXPEl5CjCn/6L2iWF+OotjdEb53urOps2YnQZwc70udQm HwTfCVRI97rVj3qF6aq8mlRxmFdEffKCj3bkQSViVbBha9YC2V2UTpWLnalyp6sTrS/K G7sA== X-Gm-Message-State: APjAAAV47cC4cMXHhoT0f+osmGVuHsQliuW+97pMN21JGUqcjeLgkKt2 JMiOZ7+dv92O3s4kIVC8SgQ= X-Google-Smtp-Source: APXvYqx85giUVZhiQHsCv//r2YbURAPCdsrA+9rcufqztCRKD6LsbMJVknHc1eyohUWvf/YPUk/5ZA== X-Received: by 2002:a65:64d5:: with SMTP id t21mr5237437pgv.43.1569361472982; Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id b22sm4651877pfo.85.2019.09.24.14.44.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Date: Tue, 24 Sep 2019 14:43:44 -0700 From: Nicolin Chen To: Shengjiu Wang Cc: timur@kernel.org, Xiubo.Lee@gmail.com, festevam@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, lars@metafoo.de Subject: Re: [PATCH V4 4/4] ASoC: fsl_asrc: Fix error with S24_3LE format bitstream in i.MX8 Message-ID: <20190924214343.GA964@Asurada-Nvidia.nvidia.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Tue, Sep 24, 2019 at 06:52:35PM +0800, Shengjiu Wang wrote: > There is error "aplay: pcm_write:2023: write error: Input/output error" > on i.MX8QM/i.MX8QXP platform for S24_3LE format. > > In i.MX8QM/i.MX8QXP, the DMA is EDMA, which don't support 24bit > sample, but we didn't add any constraint, that cause issues. > > So we need to query the caps of dma, then update the hw parameters > according to the caps. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/fsl_asrc.c | 4 +-- > sound/soc/fsl/fsl_asrc.h | 3 ++ > sound/soc/fsl/fsl_asrc_dma.c | 59 +++++++++++++++++++++++++++++++----- > 3 files changed, 56 insertions(+), 10 deletions(-) > > @@ -270,12 +268,17 @@ static int fsl_asrc_dma_hw_free(struct snd_pcm_substream *substream) > > static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > { > + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; > struct snd_soc_pcm_runtime *rtd = substream->private_data; > struct snd_pcm_runtime *runtime = substream->runtime; > struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); > + struct snd_dmaengine_dai_dma_data *dma_data; > struct device *dev = component->dev; > struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); > struct fsl_asrc_pair *pair; > + struct dma_chan *tmp_chan = NULL; > + u8 dir = tx ? OUT : IN; > + int ret = 0; > > pair = kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL); Sorry, I didn't catch it previously. We would need to release this memory also for all error-out paths, as the code doesn't have any error-out routine, prior to applying this change. > if (!pair) > @@ -285,11 +288,51 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > + /* Request a dummy pair, which will be released later. > + * Request pair function needs channel num as input, for this > + * dummy pair, we just request "1" channel temporary. > + */ "temporary" => "temporarily" > + ret = fsl_asrc_request_pair(1, pair); > + if (ret < 0) { > + dev_err(dev, "failed to request asrc pair\n"); > + return ret; > + } > + > + /* Request a dummy dma channel, which will be release later. */ "release" => "released" 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.2 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 CFC2FC432C1 for ; Tue, 24 Sep 2019 21:45:33 +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 C949D214DA for ; Tue, 24 Sep 2019 21:45:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Ph5hQyxF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PiWxYZbA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C949D214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 A8A6B16AD; Tue, 24 Sep 2019 23:44:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A8A6B16AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1569361530; bh=mdEsehiQisWzlTndea8s979Z6TrhzDKFliUwYjGDkAc=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ph5hQyxFoAvyrH4RmjRm5nlcRR3l7uq702zqRuB2FqX+CXVGuP01a0PpE9WFZAjjq CnUzdgUpq+MWXrHRGBpG0gRq7FvT/ev0VpgAvaszMCIX0d8Jdw3T4tq0ud2XGI9h++ n4a7s7pkMpxKixpcQPMT+o9FQs0gvvN5Kzlhxiro= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 337C3F803F4; Tue, 24 Sep 2019 23:44:40 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3018DF8045F; Tue, 24 Sep 2019 23:44:38 +0200 (CEST) Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (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 4779AF80213 for ; Tue, 24 Sep 2019 23:44:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4779AF80213 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PiWxYZbA" Received: by mail-pf1-x443.google.com with SMTP id y22so2120314pfr.3 for ; Tue, 24 Sep 2019 14:44:34 -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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=PiWxYZbA9Phtp8IDK7idRhXLPFpVl8Nivv0bnnYLe3e3GtA0prmh/cyb4fHtq4Gim9 aqlwpu5kw/gwGvZgr1PevcKG1YZRm4NRav9JQY8t4jD9ouA1/i6jCrKJGPq1MnRdm8Za zcVcS52Iw7UOovvfOTsRw0smUUa/8C1pIbP5pRVkoBa2JcIuY3/NaibW6X98J/DrVnPP u4jagDKOIj26zhiMKPopz6CkiPG+busIukqq/hxVnslcJhWs4Uqbf5clU765/Ug97tzP vOBIcRr6706g6selmfD9KRihs4X4HljViLD/zguw80jjUXENnR6hn1v0FEDtWG+aN/C7 T+Nw== 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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=s/xVG80Iw6mHgLl7dEdXTrLOXI+10ytA0CIs8twFrlvGrWot3hxfk3ef/BrZTQ/FMd bqmDVL/PhjxqgvxypYS064yNoZuFGd42m0S953+fCnnnFrTXxige6LtF8lbGBQL/VZj7 xg5AF/e4zfaEzcO8U8cwjSvOLFxO/+PW+qriqKrdeX2yRsa3OvwaIQxlsdaYfuQEjpvJ 72gSJ6Skkr5ANj79PVuZnM6d0X0Gkc+uVeNQTwxwBohfpHNVTmmA0BaOJLadNmKFKph7 R5h4BWJ27g6bXO3ZLKTPQGuYgL/MauGcmJ1tkCmtP4k8lWMsa6k4wjMSMZZfwMi4d3BP IrdQ== X-Gm-Message-State: APjAAAV9r9TfRExzB4fMNK21P7/mPflMdS3H8voUJBB+GEEuRtfGpuk1 sUPK01vkHTm6d/SpUBynYRM= X-Google-Smtp-Source: APXvYqx85giUVZhiQHsCv//r2YbURAPCdsrA+9rcufqztCRKD6LsbMJVknHc1eyohUWvf/YPUk/5ZA== X-Received: by 2002:a65:64d5:: with SMTP id t21mr5237437pgv.43.1569361472982; Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id b22sm4651877pfo.85.2019.09.24.14.44.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Date: Tue, 24 Sep 2019 14:43:44 -0700 From: Nicolin Chen To: Shengjiu Wang Message-ID: <20190924214343.GA964@Asurada-Nvidia.nvidia.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, lars@metafoo.de, timur@kernel.org, Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org, tiwai@suse.com, lgirdwood@gmail.com, robh+dt@kernel.org, broonie@kernel.org, festevam@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [alsa-devel] [PATCH V4 4/4] ASoC: fsl_asrc: Fix error with S24_3LE format bitstream in i.MX8 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Tue, Sep 24, 2019 at 06:52:35PM +0800, Shengjiu Wang wrote: > There is error "aplay: pcm_write:2023: write error: Input/output error" > on i.MX8QM/i.MX8QXP platform for S24_3LE format. > > In i.MX8QM/i.MX8QXP, the DMA is EDMA, which don't support 24bit > sample, but we didn't add any constraint, that cause issues. > > So we need to query the caps of dma, then update the hw parameters > according to the caps. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/fsl_asrc.c | 4 +-- > sound/soc/fsl/fsl_asrc.h | 3 ++ > sound/soc/fsl/fsl_asrc_dma.c | 59 +++++++++++++++++++++++++++++++----- > 3 files changed, 56 insertions(+), 10 deletions(-) > > @@ -270,12 +268,17 @@ static int fsl_asrc_dma_hw_free(struct snd_pcm_substream *substream) > > static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > { > + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; > struct snd_soc_pcm_runtime *rtd = substream->private_data; > struct snd_pcm_runtime *runtime = substream->runtime; > struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); > + struct snd_dmaengine_dai_dma_data *dma_data; > struct device *dev = component->dev; > struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); > struct fsl_asrc_pair *pair; > + struct dma_chan *tmp_chan = NULL; > + u8 dir = tx ? OUT : IN; > + int ret = 0; > > pair = kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL); Sorry, I didn't catch it previously. We would need to release this memory also for all error-out paths, as the code doesn't have any error-out routine, prior to applying this change. > if (!pair) > @@ -285,11 +288,51 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > + /* Request a dummy pair, which will be released later. > + * Request pair function needs channel num as input, for this > + * dummy pair, we just request "1" channel temporary. > + */ "temporary" => "temporarily" > + ret = fsl_asrc_request_pair(1, pair); > + if (ret < 0) { > + dev_err(dev, "failed to request asrc pair\n"); > + return ret; > + } > + > + /* Request a dummy dma channel, which will be release later. */ "release" => "released" _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel 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.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 9350BC4320D for ; Tue, 24 Sep 2019 21:54:07 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 14003214DA for ; Tue, 24 Sep 2019 21:54:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PiWxYZbA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14003214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46dFMJ5Jj5zDqb9 for ; Wed, 25 Sep 2019 07:54:04 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::543; helo=mail-pg1-x543.google.com; envelope-from=nicoleotsuka@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PiWxYZbA"; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46dF8R1kmyzDqVb for ; Wed, 25 Sep 2019 07:44:38 +1000 (AEST) Received: by mail-pg1-x543.google.com with SMTP id 4so1977331pgm.12 for ; Tue, 24 Sep 2019 14:44:38 -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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=PiWxYZbA9Phtp8IDK7idRhXLPFpVl8Nivv0bnnYLe3e3GtA0prmh/cyb4fHtq4Gim9 aqlwpu5kw/gwGvZgr1PevcKG1YZRm4NRav9JQY8t4jD9ouA1/i6jCrKJGPq1MnRdm8Za zcVcS52Iw7UOovvfOTsRw0smUUa/8C1pIbP5pRVkoBa2JcIuY3/NaibW6X98J/DrVnPP u4jagDKOIj26zhiMKPopz6CkiPG+busIukqq/hxVnslcJhWs4Uqbf5clU765/Ug97tzP vOBIcRr6706g6selmfD9KRihs4X4HljViLD/zguw80jjUXENnR6hn1v0FEDtWG+aN/C7 T+Nw== 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=8TaXClZL44x6R6m23BGIIOYUw8sFdA7SimmvF1Bs6II=; b=pgrJ3oysd1gTdpKlY8742rFW2GU9WkMJwQEVpoWothCptVdkIY5LX9mE1KBIl7H2hR OscEesY8JAjhN2EOL98ylU54hAhzfK4rwESEz/s4YmyGqZ4w1M3jeAvC/yOhpWyAbB8U cEJHbV4LB29nzce+BMq9UYTp8P0u/Mr+TAdaE39uvC0U0LGnsu5UT7EVGN+EveopI0Tk cP290Ye8c/ngqjRaoHx5kXe7syoIkCGtHobwSB9y9WWn449ct2/asOI3CIuHw+G/z3lG d8GE3skOihaI3Ey+9gNsN4q6vKjOwpqP8n8D+OCVDVePeR8q1jdYd7/E3aGBw4X9ZdpH zA1w== X-Gm-Message-State: APjAAAV6tjPnB05CBa/5i1caSbwMH5ZfLBQtR0MplFwsghiw+ZEBhF93 icQ8ea9GisWEPx50wGm+wyy7uFDhZas= X-Google-Smtp-Source: APXvYqx85giUVZhiQHsCv//r2YbURAPCdsrA+9rcufqztCRKD6LsbMJVknHc1eyohUWvf/YPUk/5ZA== X-Received: by 2002:a65:64d5:: with SMTP id t21mr5237437pgv.43.1569361472982; Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id b22sm4651877pfo.85.2019.09.24.14.44.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Sep 2019 14:44:32 -0700 (PDT) Date: Tue, 24 Sep 2019 14:43:44 -0700 From: Nicolin Chen To: Shengjiu Wang Subject: Re: [PATCH V4 4/4] ASoC: fsl_asrc: Fix error with S24_3LE format bitstream in i.MX8 Message-ID: <20190924214343.GA964@Asurada-Nvidia.nvidia.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, lars@metafoo.de, timur@kernel.org, Xiubo.Lee@gmail.com, linuxppc-dev@lists.ozlabs.org, tiwai@suse.com, lgirdwood@gmail.com, robh+dt@kernel.org, perex@perex.cz, broonie@kernel.org, festevam@gmail.com, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Sep 24, 2019 at 06:52:35PM +0800, Shengjiu Wang wrote: > There is error "aplay: pcm_write:2023: write error: Input/output error" > on i.MX8QM/i.MX8QXP platform for S24_3LE format. > > In i.MX8QM/i.MX8QXP, the DMA is EDMA, which don't support 24bit > sample, but we didn't add any constraint, that cause issues. > > So we need to query the caps of dma, then update the hw parameters > according to the caps. > > Signed-off-by: Shengjiu Wang > --- > sound/soc/fsl/fsl_asrc.c | 4 +-- > sound/soc/fsl/fsl_asrc.h | 3 ++ > sound/soc/fsl/fsl_asrc_dma.c | 59 +++++++++++++++++++++++++++++++----- > 3 files changed, 56 insertions(+), 10 deletions(-) > > @@ -270,12 +268,17 @@ static int fsl_asrc_dma_hw_free(struct snd_pcm_substream *substream) > > static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > { > + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; > struct snd_soc_pcm_runtime *rtd = substream->private_data; > struct snd_pcm_runtime *runtime = substream->runtime; > struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); > + struct snd_dmaengine_dai_dma_data *dma_data; > struct device *dev = component->dev; > struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); > struct fsl_asrc_pair *pair; > + struct dma_chan *tmp_chan = NULL; > + u8 dir = tx ? OUT : IN; > + int ret = 0; > > pair = kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL); Sorry, I didn't catch it previously. We would need to release this memory also for all error-out paths, as the code doesn't have any error-out routine, prior to applying this change. > if (!pair) > @@ -285,11 +288,51 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) > + /* Request a dummy pair, which will be released later. > + * Request pair function needs channel num as input, for this > + * dummy pair, we just request "1" channel temporary. > + */ "temporary" => "temporarily" > + ret = fsl_asrc_request_pair(1, pair); > + if (ret < 0) { > + dev_err(dev, "failed to request asrc pair\n"); > + return ret; > + } > + > + /* Request a dummy dma channel, which will be release later. */ "release" => "released"