From patchwork Tue Jun 23 10:23:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 6659501 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B956C05AC for ; Tue, 23 Jun 2015 10:24:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F327120699 for ; Tue, 23 Jun 2015 10:24:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2A7952038F for ; Tue, 23 Jun 2015 10:24:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8AAE32656F0; Tue, 23 Jun 2015 12:24:35 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 6C9482654DF; Tue, 23 Jun 2015 12:24:27 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EE3B02654E0; Tue, 23 Jun 2015 12:24:25 +0200 (CEST) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0115.outbound.protection.outlook.com [157.56.111.115]) by alsa0.perex.cz (Postfix) with ESMTP id 627792654D7 for ; Tue, 23 Jun 2015 12:24:18 +0200 (CEST) Received: from CH1PR03CA005.namprd03.prod.outlook.com (10.255.156.150) by CH1PR03MB612.namprd03.prod.outlook.com (10.255.156.168) with Microsoft SMTP Server (TLS) id 15.1.195.15; Tue, 23 Jun 2015 10:24:16 +0000 Received: from BN1AFFO11FD017.protection.gbl (10.255.156.132) by CH1PR03CA005.outlook.office365.com (10.255.156.150) with Microsoft SMTP Server (TLS) id 15.1.195.15 via Frontend Transport; Tue, 23 Jun 2015 10:24:16 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; lists.ozlabs.org; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD017.mail.protection.outlook.com (10.58.52.77) with Microsoft SMTP Server (TLS) id 15.1.201.10 via Frontend Transport; Tue, 23 Jun 2015 10:24:16 +0000 Received: from audiosh1.ap.freescale.net (audiosh1.ap.freescale.net [10.192.241.212]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t5NAOBkB008855; Tue, 23 Jun 2015 03:24:12 -0700 From: Shengjiu Wang To: , , , , , , Date: Tue, 23 Jun 2015 18:23:53 +0800 Message-ID: <1435055033-12608-1-git-send-email-shengjiu.wang@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD017; 1:rxFIIXY+/kOxz6ycJfInNnQIKTvRvslBWz9J0iIA8ggZFbx3wRwMokN1G0aqtZ3zgj148YMkCIZmqFGOc43WFbh1tXbJcv6EsymQpCUfiSVrGPIBWx1ey1KFOocEIKbMJIj9rQM91bIEcoMq0CDKac5P6rYoVtT9WHG3ckqisihdCPoill4Je1O+mPRED6OQDu7ztVTopMqoDKt4MyK9UeeY19bqbXSolXkRipR5htgi9bBx0cNKDsvC1gV1P9u+mOuIYtoBt8/0nTUGoY56Rw9WgfuUovhSphroY7e+KwYUu0W6If3i8tTcx+gT0Af/ X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(189002)(199003)(189998001)(86362001)(106466001)(46102003)(36756003)(229853001)(5001960100002)(19580395003)(47776003)(50226001)(2201001)(19580405001)(6806004)(50466002)(87936001)(104016003)(77096005)(92566002)(62966003)(77156002)(85426001)(48376002)(50986999)(33646002); DIR:OUT; SFP:1102; SCL:1; SRVR:CH1PR03MB612; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CH1PR03MB612; 2:UKwps6fWRl8V9R1HBjPIYO8Eu+WYV/eBeatMcM460HNtmDBr4fSMc6x6HQ1Iu4RI; 3:tRqVVl5TeyVZab5H9kf31mIMtoMrUobBCkMjVmfNqQWO3pePBLY5GYEp3eiyDlW3J71EOy0tFf70NsuQqDpQEKR9n5VBGE+tMbwheBbnFEw6NFmLZ95acBuRnDWpji2uQHVNRh0rHk6xgFw3Joe81XVq2AmHQOGqSkU293UGuBegiND6Twymj1mOXSDZPwooOQSz0NWlWsyac3OWXEI3xG6W3nBGMn4NQlivAK/crdw=; 20:ZC92wzQuvffbt8+Fi4TjQskEpkyMCLfMlH4BTyegZPjIPmDKMuXyp4uEAqrxqjSKtNunNjasAfrov8ytqn5gUtNOz4nf1iff9C22M/LST0ELHvdaFK+TkgyLLAKs0z2YvMtMiTLb/XJEAjXyxrYiOUaw0Cu2hH8n15wmTCxvwYMoOclsPV5OS4sr1dLcGBIGL91DOGITitcFMgBFyFzdIT39iud+T2LtfzOt6BDCMFiHPxp5H9g82aZ8JiWIxwYDyyv4RohNIN+qK/SqIJa7mPvz2fJP/pAw+TfMo727CmuW/1D6QsmQd9PeoRvo4K09JQftPkl6XOVsdAeY2fD5Bk5k5zNk3U77yudUQf84wNU=; 4:HRR6nOVQJ9IgJkHMVRM19qSg8SWEb0F9dEAuGLnL3oS63lyE/fffwzC6yKnisVUTiVT3fsULUNS2eoD9sAm03yjaA7C3+BtSkSaxM4XszZay9xfTdMESX0ob4fIbBiEOiA0OFmiRDwNAzD3WYvM1AERLsoh5aycI728P1wHxvrTstpet2oUweY9zQJO3q5lOi3lINmQEu8yx0INhanNAGtQgVXk8lyd9zQOgfvN6in/MABWVIi21dwCtk0N5HAHonFwScgWnL/HfmxaVD1N19CjKrQHaHwPLad4ky38j2Tk= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CH1PR03MB612; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CH1PR03MB612; BCL:0; PCL:0; RULEID:; SRVR:CH1PR03MB612; X-Forefront-PRVS: 06167FAD59 X-Microsoft-Exchange-Diagnostics: 1; CH1PR03MB612; 23:pSP21nApvI/2dhI7JtMpGRMslUVuFx8Or7wJcG1pMJDNdFyqKW9/apN+BheeJOf3dr5adn/+sLrLAKna1G5wtEetjm4WVgm+CRRxE1aP4e+mpQmo6UNfwSk3+EE4wmHOxGJJBflHbrZHYXiq+b687VqqIvgGV+d/5s94sQ/IowtfzHCZaBTOuC6k17Fw6DQxoLEC6IMgohtlH24tX2PB31qetKK+tCBZiwycLMjoKWFQRaOqZrXIa65YwTCDYpzY81p6PfwkmWdlOtZVDVWU+no775eRHZOT08UzagYPLy+Uu5g83LTUWj6ngFh+6Hx/l95/eHqLWKsqtvXdu9szuEseO0T6aJaxZt10wkEeKtLeavD/q5VMv8KFTQ9XXkQPDcwo0BYqZcPvT2cK/5niH0suMj8FVC5atf9FgA/GRzC3rOCc7uOTdjThNzmtGIf4FWvaUokiv7hm+t0dBfKHjPm8LrtJlIkWGKOMUL12cDnrzfVbn7kHPohg8jvp+B5I9K8sh1EbjV9nYal1SwbGXoF59FRock4peJNA7ChXtHbLcTP2xeskW4mDNoWKdp42xH0BAYzEuh+GGsNbui+EyRw4vENgrs/+7R8x0a8W7OmTQxFX2nxbNwzx67anF7H+j6kue6XnNw88ugBz6tE3NtpgwVHDM1CKQTFSoO/OVOCeJRLZj4y/X44mZ4H0LgV2hU4+POuxVA5ICadueKkRDPtzh4oV2dLEaioRxvF1WLVELc/YDPJqFWlJEw0CocMo8WM6rj5KA7WwqbCYN4aXQW7ddpQaapI7HeJjBoPQZFU=; 5:M2A2roKuo08OrqaeMi03bX6I2dW5/N8Gt6N9dy7a5xHY7oECaY3Nxx+rqHC1pwecNj8TheTbrUcxZpzx0jBcy1PdPXG7TK7byDWVTdzCLT2u8EjwVGRaBLpAHwTt25Kw+g70ebMGNEy6PGBv4V9SFg== X-Microsoft-Exchange-Diagnostics: 1; CH1PR03MB612; 24:Wm3dD8NgjIEPjSLbR9+5lJpEhD5T5m5jzAmn/4pJgujZeqjYiQJxC+UzchjlJjhfiw4RfeCcF8UK6ysiKqWC2AkifySTMjih/STbood+UtI=; 20:qfzIe+ED6iLbFb6c0evZYnmrrFq4iT6IhL47JFi5w1yIK05S2kplNqbfx9ALIUhq9IlmjKmyIvSIhbPR8UiawQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2015 10:24:16.4894 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PR03MB612 Cc: alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Subject: [alsa-devel] [PATCH] ASoC: fsl: Add dedicated DMA buffer size for each cpu dai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP As the ssi is not the only cpu dai, there are esai, spdif, sai. and imx_pcm_dma can be used by all of them. Especially ESAI need a larger DMA buffer size. So Add dedicated DMA buffer for each cpu dai. Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen Acked-by: Timur Tabi --- sound/soc/fsl/fsl_esai.c | 2 +- sound/soc/fsl/fsl_sai.c | 2 +- sound/soc/fsl/fsl_spdif.c | 2 +- sound/soc/fsl/fsl_ssi.c | 2 +- sound/soc/fsl/imx-pcm-dma.c | 25 +++++++++++++++++++++---- sound/soc/fsl/imx-pcm.h | 9 +++++++-- sound/soc/fsl/imx-ssi.c | 2 +- 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 5c75971..8c2ddc1 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c @@ -839,7 +839,7 @@ static int fsl_esai_probe(struct platform_device *pdev) return ret; } - ret = imx_pcm_dma_init(pdev); + ret = imx_pcm_dma_init(pdev, IMX_ESAI_DMABUF_SIZE); if (ret) dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret); diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 5c73bea..a18fd92 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -791,7 +791,7 @@ static int fsl_sai_probe(struct platform_device *pdev) return ret; if (sai->sai_on_imx) - return imx_pcm_dma_init(pdev); + return imx_pcm_dma_init(pdev, IMX_SAI_DMABUF_SIZE); else return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); } diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 8e93221..d1e9be7 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -1255,7 +1255,7 @@ static int fsl_spdif_probe(struct platform_device *pdev) return ret; } - ret = imx_pcm_dma_init(pdev); + ret = imx_pcm_dma_init(pdev, IMX_SPDIF_DMABUF_SIZE); if (ret) dev_err(&pdev->dev, "imx_pcm_dma_init failed: %d\n", ret); diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index c7647e0..e122dab 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -1257,7 +1257,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, if (ret) goto error_pcm; } else { - ret = imx_pcm_dma_init(pdev); + ret = imx_pcm_dma_init(pdev, IMX_SSI_DMABUF_SIZE); if (ret) goto error_pcm; } diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 0db94f49..1fc01ed 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c @@ -40,7 +40,7 @@ static const struct snd_pcm_hardware imx_pcm_hardware = { SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, - .buffer_bytes_max = IMX_SSI_DMABUF_SIZE, + .buffer_bytes_max = IMX_DEFAULT_DMABUF_SIZE, .period_bytes_min = 128, .period_bytes_max = 65535, /* Limited by SDMA engine */ .periods_min = 2, @@ -52,13 +52,30 @@ static const struct snd_dmaengine_pcm_config imx_dmaengine_pcm_config = { .pcm_hardware = &imx_pcm_hardware, .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, .compat_filter_fn = filter, - .prealloc_buffer_size = IMX_SSI_DMABUF_SIZE, + .prealloc_buffer_size = IMX_DEFAULT_DMABUF_SIZE, }; -int imx_pcm_dma_init(struct platform_device *pdev) +int imx_pcm_dma_init(struct platform_device *pdev, size_t size) { + struct snd_dmaengine_pcm_config *config; + struct snd_pcm_hardware *pcm_hardware; + + config = devm_kzalloc(&pdev->dev, + sizeof(struct snd_dmaengine_pcm_config), GFP_KERNEL); + *config = imx_dmaengine_pcm_config; + if (size) + config->prealloc_buffer_size = size; + + pcm_hardware = devm_kzalloc(&pdev->dev, + sizeof(struct snd_pcm_hardware), GFP_KERNEL); + *pcm_hardware = imx_pcm_hardware; + if (size) + pcm_hardware->buffer_bytes_max = size; + + config->pcm_hardware = pcm_hardware; + return devm_snd_dmaengine_pcm_register(&pdev->dev, - &imx_dmaengine_pcm_config, + config, SND_DMAENGINE_PCM_FLAG_COMPAT); } EXPORT_SYMBOL_GPL(imx_pcm_dma_init); diff --git a/sound/soc/fsl/imx-pcm.h b/sound/soc/fsl/imx-pcm.h index c79cb27..133c4470a 100644 --- a/sound/soc/fsl/imx-pcm.h +++ b/sound/soc/fsl/imx-pcm.h @@ -20,6 +20,11 @@ */ #define IMX_SSI_DMABUF_SIZE (64 * 1024) +#define IMX_DEFAULT_DMABUF_SIZE (64 * 1024) +#define IMX_SAI_DMABUF_SIZE (64 * 1024) +#define IMX_SPDIF_DMABUF_SIZE (64 * 1024) +#define IMX_ESAI_DMABUF_SIZE (256 * 1024) + static inline void imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data, int dma, enum sdma_peripheral_type peripheral_type) @@ -39,9 +44,9 @@ struct imx_pcm_fiq_params { }; #if IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA) -int imx_pcm_dma_init(struct platform_device *pdev); +int imx_pcm_dma_init(struct platform_device *pdev, size_t size); #else -static inline int imx_pcm_dma_init(struct platform_device *pdev) +static inline int imx_pcm_dma_init(struct platform_device *pdev, size_t size) { return -ENODEV; } diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index 461ce27..48b2d24 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c @@ -603,7 +603,7 @@ static int imx_ssi_probe(struct platform_device *pdev) ssi->fiq_params.dma_params_tx = &ssi->dma_params_tx; ssi->fiq_init = imx_pcm_fiq_init(pdev, &ssi->fiq_params); - ssi->dma_init = imx_pcm_dma_init(pdev); + ssi->dma_init = imx_pcm_dma_init(pdev, IMX_SSI_DMABUF_SIZE); if (ssi->fiq_init && ssi->dma_init) { ret = ssi->fiq_init;