From 9a94fdf00b7933a489cd39ca94229ffae23d49ed Mon Sep 17 00:00:00 2001 From: Huang Chao Date: Mon, 30 Jun 2014 16:35:47 +0800 Subject: [PATCH] ASoC: samsung: i2s: Configure dmaengine playback/capture DAI DMA data This patch configures the standard alsa dmaengine configure dai data. The dma address, width and maxburst size will be initialized during cpu dai probe process, in which the address width is assigned with a default value as four bytes. Then when the hardware parameters are configured as playback or capture are started, the dma address width will be configured again according to current sound channels. After the configuration, this patch will set the dai dma data into the private dma data field in snd_soc_dai structure. Change-Id: I46ece6472464d003a19d409441619ebbe4ef30cd Signed-off-by: Huang Chao --- sound/soc/samsung/i2s.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 08ab1d7..d80121e 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -603,16 +603,19 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, break; case 2: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - i2s->dma_playback.dma_size = 4; + i2s->snd_dma_playback.addr_width = + DMA_SLAVE_BUSWIDTH_4_BYTES; else - i2s->dma_capture.dma_size = 4; + i2s->snd_dma_capture.addr_width = + DMA_SLAVE_BUSWIDTH_4_BYTES; break; case 1: if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - i2s->dma_playback.dma_size = 2; + i2s->snd_dma_playback.addr_width = + DMA_SLAVE_BUSWIDTH_2_BYTES; else - i2s->dma_capture.dma_size = 2; - + i2s->snd_dma_capture.addr_width = + DMA_SLAVE_BUSWIDTH_2_BYTES; break; default: dev_err(&i2s->pdev->dev, "%d channels not supported\n", @@ -662,10 +665,10 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) snd_soc_dai_set_dma_data(dai, substream, - (void *)&i2s->dma_playback); + (void *)&i2s->snd_dma_playback); else snd_soc_dai_set_dma_data(dai, substream, - (void *)&i2s->dma_capture); + (void *)&i2s->snd_dma_capture); i2s->frmclk = params_rate(params); @@ -1248,16 +1251,14 @@ static int samsung_i2s_probe(struct platform_device *pdev) } regs_base = res->start; - pri_dai->dma_playback.dma_addr = regs_base + I2STXD; - pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; - pri_dai->dma_playback.client = - (struct s3c2410_dma_client *)&pri_dai->dma_playback; - pri_dai->dma_playback.ch_name = "tx"; - pri_dai->dma_capture.client = - (struct s3c2410_dma_client *)&pri_dai->dma_capture; - pri_dai->dma_capture.ch_name = "rx"; - pri_dai->dma_playback.dma_size = 4; - pri_dai->dma_capture.dma_size = 4; + pri_dai->snd_dma_playback.addr = regs_base + I2STXD; + pri_dai->snd_dma_playback.addr_width = + DMA_SLAVE_BUSWIDTH_4_BYTES; /* Default address width */ + pri_dai->snd_dma_playback.maxburst = 1; + pri_dai->snd_dma_capture.addr = regs_base + I2SRXD; + pri_dai->snd_dma_capture.addr_width = + DMA_SLAVE_BUSWIDTH_4_BYTES; /* Default address width */ + pri_dai->snd_dma_capture.maxburst = 1; pri_dai->base = regs_base; pri_dai->quirks = quirks; pri_dai->op_clk = ERR_PTR(-EINVAL); -- 2.7.4