aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/pxa-ssp.c
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-08-12 04:42:39 -0400
committerMark Brown <broonie@linaro.org>2013-08-15 06:29:07 -0400
commitd65a14587a9be853a887a1407db133df1fb68e29 (patch)
tree97e31a61fe5c8d567ccb4c6f97c5eaf95fe700ce /sound/soc/pxa/pxa-ssp.c
parent2023c90c3a2c4c1aeb7f47649367d551c676da07 (diff)
ASoC: pxa: use snd_dmaengine_dai_dma_data
Use snd_dmaengine_dai_dma_data for passing the dma parameters from clients to the pxa pcm lib. This does no functional change, it's just an intermedia step to migrate the pxa bits over to dmaengine. The calculation of dcmd is a transition hack which will be removed again in a later patch. It's just there to make the transition more readable. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/pxa/pxa-ssp.c')
-rw-r--r--sound/soc/pxa/pxa-ssp.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 19296f22cb28..c0dcc3538e35 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/pxa2xx_ssp.h> 23#include <linux/pxa2xx_ssp.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/dmaengine.h>
25 26
26#include <asm/irq.h> 27#include <asm/irq.h>
27 28
@@ -31,9 +32,9 @@
31#include <sound/pcm_params.h> 32#include <sound/pcm_params.h>
32#include <sound/soc.h> 33#include <sound/soc.h>
33#include <sound/pxa2xx-lib.h> 34#include <sound/pxa2xx-lib.h>
35#include <sound/dmaengine_pcm.h>
34 36
35#include <mach/hardware.h> 37#include <mach/hardware.h>
36#include <mach/dma.h>
37 38
38#include "../../arm/pxa2xx-pcm.h" 39#include "../../arm/pxa2xx-pcm.h"
39#include "pxa-ssp.h" 40#include "pxa-ssp.h"
@@ -80,27 +81,14 @@ static void pxa_ssp_disable(struct ssp_device *ssp)
80 __raw_writel(sscr0, ssp->mmio_base + SSCR0); 81 __raw_writel(sscr0, ssp->mmio_base + SSCR0);
81} 82}
82 83
83struct pxa2xx_pcm_dma_data {
84 struct pxa2xx_pcm_dma_params params;
85 char name[20];
86};
87
88static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4, 84static void pxa_ssp_set_dma_params(struct ssp_device *ssp, int width4,
89 int out, struct pxa2xx_pcm_dma_params *dma_data) 85 int out, struct snd_dmaengine_dai_dma_data *dma)
90{ 86{
91 struct pxa2xx_pcm_dma_data *dma; 87 dma->filter_data = out ? &ssp->drcmr_tx : &ssp->drcmr_rx;
92 88 dma->addr_width = width4 ? DMA_SLAVE_BUSWIDTH_4_BYTES :
93 dma = container_of(dma_data, struct pxa2xx_pcm_dma_data, params); 89 DMA_SLAVE_BUSWIDTH_2_BYTES;
94 90 dma->maxburst = 16;
95 snprintf(dma->name, 20, "SSP%d PCM %s %s", ssp->port_id, 91 dma->addr = ssp->phys_base + SSDR;
96 width4 ? "32-bit" : "16-bit", out ? "out" : "in");
97
98 dma->params.name = dma->name;
99 dma->params.drcmr = &DRCMR(out ? ssp->drcmr_tx : ssp->drcmr_rx);
100 dma->params.dcmd = (out ? (DCMD_INCSRCADDR | DCMD_FLOWTRG) :
101 (DCMD_INCTRGADDR | DCMD_FLOWSRC)) |
102 (width4 ? DCMD_WIDTH4 : DCMD_WIDTH2) | DCMD_BURST16;
103 dma->params.dev_addr = ssp->phys_base + SSDR;
104} 92}
105 93
106static int pxa_ssp_startup(struct snd_pcm_substream *substream, 94static int pxa_ssp_startup(struct snd_pcm_substream *substream,
@@ -108,7 +96,7 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
108{ 96{
109 struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai); 97 struct ssp_priv *priv = snd_soc_dai_get_drvdata(cpu_dai);
110 struct ssp_device *ssp = priv->ssp; 98 struct ssp_device *ssp = priv->ssp;
111 struct pxa2xx_pcm_dma_data *dma; 99 struct snd_dmaengine_dai_dma_data *dma;
112 int ret = 0; 100 int ret = 0;
113 101
114 if (!cpu_dai->active) { 102 if (!cpu_dai->active) {
@@ -116,10 +104,10 @@ static int pxa_ssp_startup(struct snd_pcm_substream *substream,
116 pxa_ssp_disable(ssp); 104 pxa_ssp_disable(ssp);
117 } 105 }
118 106
119 dma = kzalloc(sizeof(struct pxa2xx_pcm_dma_data), GFP_KERNEL); 107 dma = kzalloc(sizeof(struct snd_dmaengine_dai_dma_data), GFP_KERNEL);
120 if (!dma) 108 if (!dma)
121 return -ENOMEM; 109 return -ENOMEM;
122 snd_soc_dai_set_dma_data(cpu_dai, substream, &dma->params); 110 snd_soc_dai_set_dma_data(cpu_dai, substream, dma);
123 111
124 return ret; 112 return ret;
125} 113}
@@ -560,7 +548,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
560 u32 sspsp; 548 u32 sspsp;
561 int width = snd_pcm_format_physical_width(params_format(params)); 549 int width = snd_pcm_format_physical_width(params_format(params));
562 int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf; 550 int ttsa = pxa_ssp_read_reg(ssp, SSTSA) & 0xf;
563 struct pxa2xx_pcm_dma_params *dma_data; 551 struct snd_dmaengine_dai_dma_data *dma_data;
564 552
565 dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); 553 dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream);
566 554