From patchwork Mon Apr 2 14:26:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 10319913 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A29B60375 for ; Mon, 2 Apr 2018 14:48:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568A128ABD for ; Mon, 2 Apr 2018 14:48:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4785928AC1; Mon, 2 Apr 2018 14:48:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AB79428ABD for ; Mon, 2 Apr 2018 14:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=et+JG+XQHHEcjpYnGjqN+OWuT/JwQZ9C7SzuiL5ls5A=; b=N3Y6Rt0pLbxeAiOnpRS3OAPNeP /2bEkoKN/sa7v3CiS2bIpWBacvSn0n1Itxajejd5cYZ3PAtVIKSAcLTbtlalftleeDja80Koxp0E8 tQVqKddMvgmfy1Oz0dUNqQZ5wgJPmBHpvxZjEHEXM/1KsmWjHfFXO8u558U9ZY7F1doeQAO9e2doH bt1ZdsLbyhhLseg0kiMYA75rzupXX1tM9mdklX2AbN0Pur11LXP+Vr4Adz6D/BHyO9W/sU5ZJGDTB Z5SeLqchwFAY0GUdVfb8v2ee7zjR+ArvPV8Fij+CXpDDppYfCq2HR5XRQi7abWWZhco7j4d62yB8j yvpFGBIw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f30lD-0005aT-3V; Mon, 02 Apr 2018 14:48:39 +0000 Received: from smtp06.smtpout.orange.fr ([80.12.242.128] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f30Sc-0005C3-Nf for linux-arm-kernel@lists.infradead.org; Mon, 02 Apr 2018 14:29:32 +0000 Received: from belgarion.home ([86.201.130.131]) by mwinf5d63 with ME id VSSy1x00R2qEl8e03SUkTc; Mon, 02 Apr 2018 16:29:14 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Mon, 02 Apr 2018 16:29:14 +0200 X-ME-IP: 86.201.130.131 From: Robert Jarzmik To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Bartlomiej Zolnierkiewicz , Tejun Heo , Vinod Koul , Mauro Carvalho Chehab , Ulf Hansson , Ezequiel Garcia , Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Cyrille Pitchen , Nicolas Pitre , Samuel Ortiz , Greg Kroah-Hartman , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Arnd Bergmann , Russell King , Jarkko Nikula Subject: [PATCH 15/15] ARM: pxa: change SSP DMA channels allocation Date: Mon, 2 Apr 2018 16:26:56 +0200 Message-Id: <20180402142656.26815-16-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180402142656.26815-1-robert.jarzmik@free.fr> References: <20180402142656.26815-1-robert.jarzmik@free.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180402_072927_280244_D6A3F8EB X-CRM114-Status: GOOD ( 25.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, alsa-devel@alsa-project.org, netdev@vger.kernel.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now the dma_slave_map is available for PXA architecture, switch the SSP device to it. This specifically means that : - for platform data based machines, the DMA requestor channels are extracted from platform data and passed further to the SSP user, ie. usually the pxa-pcm-audio driver - for device tree platforms, the dma node should be hooked into the pxa-pcm-audio node. Signed-off-by: Robert Jarzmik --- arch/arm/plat-pxa/ssp.c | 50 +++++----------------------------------------- include/linux/pxa2xx_ssp.h | 4 ++-- sound/soc/pxa/pxa-ssp.c | 5 ++--- 3 files changed, 9 insertions(+), 50 deletions(-) diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c index ba13f793fbce..3457f01e3340 100644 --- a/arch/arm/plat-pxa/ssp.c +++ b/arch/arm/plat-pxa/ssp.c @@ -16,6 +16,7 @@ * Author: Liam Girdwood */ +#include #include #include #include @@ -116,6 +117,7 @@ static int pxa_ssp_probe(struct platform_device *pdev) struct resource *res; struct ssp_device *ssp; struct device *dev = &pdev->dev; + struct pxa_ssp_info *info = dev_get_platdata(dev); ssp = devm_kzalloc(dev, sizeof(struct ssp_device), GFP_KERNEL); if (ssp == NULL) @@ -127,51 +129,9 @@ static int pxa_ssp_probe(struct platform_device *pdev) if (IS_ERR(ssp->clk)) return PTR_ERR(ssp->clk); - if (dev->of_node) { - struct of_phandle_args dma_spec; - struct device_node *np = dev->of_node; - int ret; - - /* - * FIXME: we should allocate the DMA channel from this - * context and pass the channel down to the ssp users. - * For now, we lookup the rx and tx indices manually - */ - - /* rx */ - ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", - 0, &dma_spec); - - if (ret) { - dev_err(dev, "Can't parse dmas property\n"); - return -ENODEV; - } - ssp->drcmr_rx = dma_spec.args[0]; - of_node_put(dma_spec.np); - - /* tx */ - ret = of_parse_phandle_with_args(np, "dmas", "#dma-cells", - 1, &dma_spec); - if (ret) { - dev_err(dev, "Can't parse dmas property\n"); - return -ENODEV; - } - ssp->drcmr_tx = dma_spec.args[0]; - of_node_put(dma_spec.np); - } else { - res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (res == NULL) { - dev_err(dev, "no SSP RX DRCMR defined\n"); - return -ENODEV; - } - ssp->drcmr_rx = res->start; - - res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (res == NULL) { - dev_err(dev, "no SSP TX DRCMR defined\n"); - return -ENODEV; - } - ssp->drcmr_tx = res->start; + if (!dev->of_node && info) { + ssp->dma_chan_rx = info->dma_chan_rx_name; + ssp->dma_chan_tx = info->dma_chan_tx_name; } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h index 8461b18e4608..99c99d397e4d 100644 --- a/include/linux/pxa2xx_ssp.h +++ b/include/linux/pxa2xx_ssp.h @@ -212,9 +212,9 @@ struct ssp_device { int type; int use_count; int irq; - int drcmr_rx; - int drcmr_tx; + const char *dma_chan_rx; + const char *dma_chan_tx; struct device_node *of_node; }; diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c index 0291c7cb64eb..a0189b88f1d2 100644 --- a/sound/soc/pxa/pxa-ssp.c +++ b/sound/soc/pxa/pxa-ssp.c @@ -104,9 +104,8 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream, dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL); if (!dma) return -ENOMEM; - - dma->filter_data = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - &ssp->drcmr_tx : &ssp->drcmr_rx; + dma->chan_name = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? + ssp->dma_chan_tx : ssp->dma_chan_rx; snd_soc_dai_set_dma_data(cpu_dai, substream, dma);