From patchwork Thu Mar 13 09:18:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 3824001 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DCB45BF540 for ; Thu, 13 Mar 2014 09:31:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3593201BF for ; Thu, 13 Mar 2014 09:31:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C247A20176 for ; Thu, 13 Mar 2014 09:31:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9884F2652FB; Thu, 13 Mar 2014 10:31:28 +0100 (CET) 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 0DCD3265207; Thu, 13 Mar 2014 10:21:45 +0100 (CET) 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 A66F12652FD; Thu, 13 Mar 2014 10:21:43 +0100 (CET) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by alsa0.perex.cz (Postfix) with ESMTP id 21B2B26517E for ; Thu, 13 Mar 2014 10:19:43 +0100 (CET) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s2D9JhHZ005349; Thu, 13 Mar 2014 04:19:43 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2D9Jg24011536; Thu, 13 Mar 2014 04:19:42 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 13 Mar 2014 04:19:42 -0500 Received: from dflp32.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s2D9Ifhk005531; Thu, 13 Mar 2014 04:19:39 -0500 From: Peter Ujfalusi To: , , , , Date: Thu, 13 Mar 2014 11:18:37 +0200 Message-ID: <1394702320-21743-16-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394702320-21743-1-git-send-email-peter.ujfalusi@ti.com> References: <1394702320-21743-1-git-send-email-peter.ujfalusi@ti.com> MIME-Version: 1.0 Cc: davinci-linux-open-source@linux.davincidsp.com, joelf@ti.com, nsekhar@ti.com, Liam Girdwood , Jyri Sarha , Tony Lindgren , Mark Brown , mporter@linaro.org, dan.j.williams@intel.com, vinod.koul@intel.com Subject: [alsa-devel] [PATCH 15/18] ASoC: davinci-mcasp: Use dmaengine based platform driver for AM335x/447x 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 Use the edma-pcm with AM335x and AM447x SoCs. Keep using the davinci-pcm for DaVinci devices, they can be switched to use the dmaengine based driver later when they are verified to work correctly. Signed-off-by: Peter Ujfalusi --- sound/soc/davinci/davinci-mcasp.c | 46 +++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b0ae0677f023..604aa982f5c4 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -36,6 +36,7 @@ #include "davinci-pcm.h" #include "davinci-mcasp.h" +#include "edma-pcm.h" struct davinci_mcasp_context { u32 txfmtctl; @@ -721,10 +722,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, { struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); - if (mcasp->version == MCASP_VERSION_4) + if (mcasp->version >= MCASP_VERSION_3) + /* Using dmaengine PCM */ snd_soc_dai_set_dma_data(dai, substream, &mcasp->dma_data[substream->stream]); else + /* Using davinci-pcm */ snd_soc_dai_set_dma_data(dai, substream, mcasp->dma_params); return 0; @@ -1154,12 +1157,28 @@ static int davinci_mcasp_probe(struct platform_device *pdev) if (ret != 0) goto err_release_clk; - if (mcasp->version != MCASP_VERSION_4) { + /* Based on the McASP version use different platform driver */ + switch (mcasp->version) { + case MCASP_VERSION_1: + case MCASP_VERSION_2: ret = davinci_soc_platform_register(&pdev->dev); - if (ret) { - dev_err(&pdev->dev, "register PCM failed: %d\n", ret); - goto err_unregister_component; - } + break; + case MCASP_VERSION_3: + ret = edma_pcm_platform_register(&pdev->dev); + break; + case MCASP_VERSION_4: + /* Using omap-pcm as platform driver */ + break; + default: + dev_err(&pdev->dev, "Invalid McASP version: %d\n", + mcasp->version); + ret = -EINVAL; + break; + } + + if (ret) { + dev_err(&pdev->dev, "register PCM failed: %d\n", ret); + goto err_unregister_component; } return 0; @@ -1177,8 +1196,21 @@ static int davinci_mcasp_remove(struct platform_device *pdev) struct davinci_mcasp *mcasp = dev_get_drvdata(&pdev->dev); snd_soc_unregister_component(&pdev->dev); - if (mcasp->version != MCASP_VERSION_4) + + switch (mcasp->version) { + case MCASP_VERSION_1: + case MCASP_VERSION_2: davinci_soc_platform_unregister(&pdev->dev); + break; + case MCASP_VERSION_3: + edma_pcm_platform_unregister(&pdev->dev); + break; + case MCASP_VERSION_4: + /* Using omap-pcm as platform driver */ + break; + default: + break; + } pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev);