Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp425603ybz; Fri, 1 May 2020 01:23:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJIiwJ6gQIV6qEJWJuzkOyhBmjzej/YeI6hB/ZjCJJaWEcBsARkl9o63iu+qu3wu1BuLaD0 X-Received: by 2002:a17:907:2645:: with SMTP id ar5mr2203829ejc.75.1588321384554; Fri, 01 May 2020 01:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588321384; cv=none; d=google.com; s=arc-20160816; b=XG1lc2ypilI3pEmufto3dwaJyhTuFWlRmmcNIzW7drfj1ZpVzEPsoyPi7EwteS2hnA cfl2A8xafyvRhyyA362FNuUzWK0X48plCsih0hf3lHvhlcAgvqmixaSNyWinhqZeypot KxByYOTV/kt9RbBcjgNL/g1E1PGEaN8bwoQLShGgvYRnAVcjmTDcg0OxyvcnGCabc/nr z8HSvZ/zA3R/MEczqS6tZ+pUGvvYbTsQiHUXMD5dkDq2MvUXWaVm8Fud7wDy3/+TAQ1A 5XCsD2imtM44qdqvFxkBYvIfHahuD7fkLZzPXykFtYqMjm6er3hwSySEEptxFigz3o6Z Umqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=vpXPd4L/u8LRkqHl4XF2QYPHcWLSaumbwb0ixKHS360=; b=NZUzOQP17/51dCPp7CdGD6J0U2R2SPnZsZbmrr1iaUgWWJMTEAupTFHTqPpA/Bl4Rx J4fFyW/A7LU2x7UuuyJaQRopKYb8wWzLrT/tIAT6g9x3ZMteYcIPoEgVjKrZWKJSC4me oK3MTUQPACEtoLz9l/j31Mzzb2MHfVfQvNbhwbrCfWBdPAP7MgK1hCKHsRdyhmXdumot dqDoQ1EENj8UgmeTMuLgYrHqGHYrJWEreMR2aAVWiftl1Vc8MbGnpfNq2PKTdnHN0XfQ fc9jwNeZB13joGsrkTknspxNAjQgOgPx21k2vMsUSmf8sm28trFu2ADr7iW2Vme5LxkV f4lA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si1272147edv.171.2020.05.01.01.22.41; Fri, 01 May 2020 01:23:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728464AbgEAIVP (ORCPT + 99 others); Fri, 1 May 2020 04:21:15 -0400 Received: from inva021.nxp.com ([92.121.34.21]:49920 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728277AbgEAIVJ (ORCPT ); Fri, 1 May 2020 04:21:09 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A67F5200B30; Fri, 1 May 2020 10:21:06 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6C932200B47; Fri, 1 May 2020 10:21:01 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B2D69402DE; Fri, 1 May 2020 16:20:54 +0800 (SGT) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, lgirdwood@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ASoC: fsl_esai: Add support for imx8qm Date: Fri, 1 May 2020 16:12:05 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The difference for esai on imx8qm is that DMA device is EDMA. EDMA requires the period size to be multiple of maxburst. Otherwise the remaining bytes are not transferred and thus noise is produced. We can handle this issue by adding a constraint on SNDRV_PCM_HW_PARAM_PERIOD_SIZE to be multiple of tx/rx maxburst value. Signed-off-by: Shengjiu Wang --- sound/soc/fsl/fsl_esai.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index bac65ba7fbad..61b5c0bde788 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -26,10 +26,12 @@ * * @imx: for imx platform * @reset_at_xrun: flags for enable reset operaton + * @use_edma: edma is used. */ struct fsl_esai_soc_data { bool imx; bool reset_at_xrun; + bool use_edma; }; /** @@ -88,16 +90,25 @@ struct fsl_esai { static struct fsl_esai_soc_data fsl_esai_vf610 = { .imx = false, .reset_at_xrun = true, + .use_edma = false, }; static struct fsl_esai_soc_data fsl_esai_imx35 = { .imx = true, .reset_at_xrun = true, + .use_edma = false, }; static struct fsl_esai_soc_data fsl_esai_imx6ull = { .imx = true, .reset_at_xrun = false, + .use_edma = false, +}; + +static struct fsl_esai_soc_data fsl_esai_imx8qm = { + .imx = true, + .reset_at_xrun = false, + .use_edma = true, }; static irqreturn_t esai_isr(int irq, void *devid) @@ -513,6 +524,7 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai); + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; if (!dai->active) { /* Set synchronous mode */ @@ -527,6 +539,12 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream, ESAI_xCCR_xDC_MASK, ESAI_xCCR_xDC(2)); } + if (esai_priv->soc->use_edma) + snd_pcm_hw_constraint_step(substream->runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + tx ? esai_priv->dma_params_tx.maxburst : + esai_priv->dma_params_rx.maxburst); + return 0; } @@ -1094,6 +1112,7 @@ static const struct of_device_id fsl_esai_dt_ids[] = { { .compatible = "fsl,imx35-esai", .data = &fsl_esai_imx35 }, { .compatible = "fsl,vf610-esai", .data = &fsl_esai_vf610 }, { .compatible = "fsl,imx6ull-esai", .data = &fsl_esai_imx6ull }, + { .compatible = "fsl,imx8qm-esai", .data = &fsl_esai_imx8qm }, {} }; MODULE_DEVICE_TABLE(of, fsl_esai_dt_ids); -- 2.21.0