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: 3823411 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 27A559F1CD for ; Thu, 13 Mar 2014 09:22:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50D52200CC for ; Thu, 13 Mar 2014 09:22:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 659492020A for ; Thu, 13 Mar 2014 09:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753499AbaCMJWC (ORCPT ); Thu, 13 Mar 2014 05:22:02 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:33145 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753844AbaCMJUI (ORCPT ); Thu, 13 Mar 2014 05:20:08 -0400 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: , , , , CC: , , Mark Brown , Liam Girdwood , Tony Lindgren , , Jyri Sarha , , , Subject: [PATCH 15/18] ASoC: davinci-mcasp: Use dmaengine based platform driver for AM335x/447x 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 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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);