diff options
author | Barry Song <barry.song@analog.com> | 2011-03-28 01:45:10 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-29 18:20:05 -0400 |
commit | 2c66cb99d134d787827ed1cd93cc59351ab66a95 (patch) | |
tree | 4c67200205b224947e9500b17af9537e54254a65 /sound/soc/blackfin/bf5xx-i2s-pcm.c | |
parent | bfe4ee0a935dccf5980ecb5605c66fe50feb9056 (diff) |
ASoC: Blackfin: push down SPORT settings from global variables
Now that we have multi-component support, take the time to unify the
SPORT implementations a bit and make the setup dynamic. This kills
off the global sport_handle which was shared across all the Blackfin
machine drivers. The pin management aspect is off loaded to platform
resources, and now multiple SPORTs can be instantiated simultaneously.
Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Scott Jiang <scott.jiang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/blackfin/bf5xx-i2s-pcm.c')
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s-pcm.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 50b1df8c1416..b5101efd1c87 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c | |||
@@ -148,10 +148,15 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) | |||
148 | 148 | ||
149 | static int bf5xx_pcm_open(struct snd_pcm_substream *substream) | 149 | static int bf5xx_pcm_open(struct snd_pcm_substream *substream) |
150 | { | 150 | { |
151 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
152 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
153 | struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai); | ||
151 | struct snd_pcm_runtime *runtime = substream->runtime; | 154 | struct snd_pcm_runtime *runtime = substream->runtime; |
155 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
152 | int ret; | 156 | int ret; |
153 | 157 | ||
154 | pr_debug("%s enter\n", __func__); | 158 | pr_debug("%s enter\n", __func__); |
159 | |||
155 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); | 160 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); |
156 | 161 | ||
157 | ret = snd_pcm_hw_constraint_integer(runtime, \ | 162 | ret = snd_pcm_hw_constraint_integer(runtime, \ |
@@ -159,9 +164,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) | |||
159 | if (ret < 0) | 164 | if (ret < 0) |
160 | goto out; | 165 | goto out; |
161 | 166 | ||
162 | if (sport_handle != NULL) | 167 | if (sport_handle != NULL) { |
168 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
169 | sport_handle->tx_buf = buf->area; | ||
170 | else | ||
171 | sport_handle->rx_buf = buf->area; | ||
172 | |||
163 | runtime->private_data = sport_handle; | 173 | runtime->private_data = sport_handle; |
164 | else { | 174 | } else { |
165 | pr_err("sport_handle is NULL\n"); | 175 | pr_err("sport_handle is NULL\n"); |
166 | return -1; | 176 | return -1; |
167 | } | 177 | } |
@@ -214,11 +224,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | |||
214 | pr_debug("%s, area:%p, size:0x%08lx\n", __func__, | 224 | pr_debug("%s, area:%p, size:0x%08lx\n", __func__, |
215 | buf->area, buf->bytes); | 225 | buf->area, buf->bytes); |
216 | 226 | ||
217 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
218 | sport_handle->tx_buf = buf->area; | ||
219 | else | ||
220 | sport_handle->rx_buf = buf->area; | ||
221 | |||
222 | return 0; | 227 | return 0; |
223 | } | 228 | } |
224 | 229 | ||
@@ -239,8 +244,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
239 | dma_free_coherent(NULL, buf->bytes, buf->area, 0); | 244 | dma_free_coherent(NULL, buf->bytes, buf->area, 0); |
240 | buf->area = NULL; | 245 | buf->area = NULL; |
241 | } | 246 | } |
242 | if (sport_handle) | ||
243 | sport_done(sport_handle); | ||
244 | } | 247 | } |
245 | 248 | ||
246 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); | 249 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); |