Received: by 10.213.65.68 with SMTP id h4csp2433677imn; Mon, 2 Apr 2018 07:31:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+T4ta4Mlew8ckoqO3K0uy/s1OvJQSQQnLo9g2AmFwYJ89ZMz/SiMi5zdrXEsLWuUURK//U X-Received: by 10.99.158.81 with SMTP id r17mr6595791pgo.348.1522679472706; Mon, 02 Apr 2018 07:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522679472; cv=none; d=google.com; s=arc-20160816; b=iDcmyikMYt5ksWkeqmUxmO8R2JQFaw9e72s88wZqD0FOeSwYRwZKtDakD6vwY1K9Pd S3grG5qc8Sy78lWHfTVNy1+RaRb/jhWqDPvgTv8wclMvVTRdlCELQfJwt0N1ihROUmpp uzX+zJ8G7ATdTaWCJRcHVoD91f9oaL0DghxKKz3Gy5dUDBacQeU4CFrWGd7WTErMRdwU dRCtfP2fv0rGXwdueojxYg2tQCh4WxK3qmfuKk1WVGQNMJFODa/YFaEvKwmulhyD59Nq ITCj8QzsEAlxQn+3FVo7JqNn4shkiVk6SO+GaHJXcsTE+nMB3/9PD7ItxqsVLrJ0fYN9 Gtvg== 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:message-id:date :subject:cc:to:from:arc-authentication-results; bh=p9aU8b5TpOFtU1gcLUTCyr+4mkY4yFHbD4FYVcQqlHo=; b=iZt5EOEX2gDtUJzstSRPlBTYMum6rkAZh7itJKzW3joSBTn6whUfVWlbC75+EuguTP Bem4Pb5P94PGq+nMxPmMdH4oKk47jEqVoTtKfvQXwpQgMop9Ox/3r2CSmRhpaebPmSqd qlNSvlyEhacbu5bqbMXrEFOvhTwF9A0Jd0hyQksJIBJoHUD8/elMI+xXMcWqze199kl+ HGw3KcGsZjOTZZHv8B55/Eor4NDKFAjwDjl1GMGLWITQGGd+2DrMzCkU61GCFWn+u0C8 ugfOn3tXyC6BNS2qsRmcKmn4r64NsncIybA/dLuOLL4aFJJMZJt7CNNkp9VnD8u6K1xC W13g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si308146pgb.180.2018.04.02.07.30.58; Mon, 02 Apr 2018 07:31:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752936AbeDBO3X (ORCPT + 99 others); Mon, 2 Apr 2018 10:29:23 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:18796 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296AbeDBO3P (ORCPT ); Mon, 2 Apr 2018 10:29:15 -0400 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, dmaengine@vger.kernel.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.11.0