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-tdm-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-tdm-pcm.c')
-rw-r--r-- | sound/soc/blackfin/bf5xx-tdm-pcm.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c index d1bd745d72cf..07cfc7a9e49a 100644 --- a/sound/soc/blackfin/bf5xx-tdm-pcm.c +++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c | |||
@@ -154,7 +154,12 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) | |||
154 | 154 | ||
155 | static int bf5xx_pcm_open(struct snd_pcm_substream *substream) | 155 | static int bf5xx_pcm_open(struct snd_pcm_substream *substream) |
156 | { | 156 | { |
157 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
158 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
159 | struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai); | ||
157 | struct snd_pcm_runtime *runtime = substream->runtime; | 160 | struct snd_pcm_runtime *runtime = substream->runtime; |
161 | struct snd_dma_buffer *buf = &substream->dma_buffer; | ||
162 | |||
158 | int ret = 0; | 163 | int ret = 0; |
159 | 164 | ||
160 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); | 165 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); |
@@ -164,9 +169,14 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) | |||
164 | if (ret < 0) | 169 | if (ret < 0) |
165 | goto out; | 170 | goto out; |
166 | 171 | ||
167 | if (sport_handle != NULL) | 172 | if (sport_handle != NULL) { |
173 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
174 | sport_handle->tx_buf = buf->area; | ||
175 | else | ||
176 | sport_handle->rx_buf = buf->area; | ||
177 | |||
168 | runtime->private_data = sport_handle; | 178 | runtime->private_data = sport_handle; |
169 | else { | 179 | } else { |
170 | pr_err("sport_handle is NULL\n"); | 180 | pr_err("sport_handle is NULL\n"); |
171 | ret = -ENODEV; | 181 | ret = -ENODEV; |
172 | } | 182 | } |
@@ -249,11 +259,6 @@ static int bf5xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) | |||
249 | } | 259 | } |
250 | buf->bytes = size; | 260 | buf->bytes = size; |
251 | 261 | ||
252 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
253 | sport_handle->tx_buf = buf->area; | ||
254 | else | ||
255 | sport_handle->rx_buf = buf->area; | ||
256 | |||
257 | return 0; | 262 | return 0; |
258 | } | 263 | } |
259 | 264 | ||
@@ -274,8 +279,6 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
274 | dma_free_coherent(NULL, buf->bytes, buf->area, 0); | 279 | dma_free_coherent(NULL, buf->bytes, buf->area, 0); |
275 | buf->area = NULL; | 280 | buf->area = NULL; |
276 | } | 281 | } |
277 | if (sport_handle) | ||
278 | sport_done(sport_handle); | ||
279 | } | 282 | } |
280 | 283 | ||
281 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); | 284 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); |