aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-19 12:43:51 -0400
committerMark Brown <broonie@linaro.org>2013-10-24 04:52:14 -0400
commitea73b7ddf13548afd666373dc5e26ee7c812a3fe (patch)
treeee450969a1f904da0d13144edb22bef186bf07f0
parent0eef5381b7271702c7e65c637cb46804c482a90a (diff)
ASoC: dmaengine: Support custom channel names
Some devices have more than just simple TX and RX DMA channels, for example modern Samsung I2S IPs support a secondary transmit DMA stream which is mixed into the primary stream during playback. Allow such devices to specify the names of the channels to be requested in their dma_data. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
-rw-r--r--include/sound/dmaengine_pcm.h6
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c13
2 files changed, 18 insertions, 1 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
index 83b2c3e95a1a..15017311f2e9 100644
--- a/include/sound/dmaengine_pcm.h
+++ b/include/sound/dmaengine_pcm.h
@@ -61,6 +61,7 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream)
61 * @slave_id: Slave requester id for the DMA channel. 61 * @slave_id: Slave requester id for the DMA channel.
62 * @filter_data: Custom DMA channel filter data, this will usually be used when 62 * @filter_data: Custom DMA channel filter data, this will usually be used when
63 * requesting the DMA channel. 63 * requesting the DMA channel.
64 * @chan_name: Custom channel name to use when requesting DMA channel.
64 * @fifo_size: FIFO size of the DAI controller in bytes 65 * @fifo_size: FIFO size of the DAI controller in bytes
65 */ 66 */
66struct snd_dmaengine_dai_dma_data { 67struct snd_dmaengine_dai_dma_data {
@@ -69,6 +70,7 @@ struct snd_dmaengine_dai_dma_data {
69 u32 maxburst; 70 u32 maxburst;
70 unsigned int slave_id; 71 unsigned int slave_id;
71 void *filter_data; 72 void *filter_data;
73 const char *chan_name;
72 unsigned int fifo_size; 74 unsigned int fifo_size;
73}; 75};
74 76
@@ -98,6 +100,10 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
98 * playback. 100 * playback.
99 */ 101 */
100#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3) 102#define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3)
103/*
104 * The PCM streams have custom channel names specified.
105 */
106#define SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME BIT(4)
101 107
102/** 108/**
103 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM 109 * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 99f9495c1c40..793cd6c246f6 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -183,6 +183,8 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
183{ 183{
184 struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); 184 struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
185 const struct snd_dmaengine_pcm_config *config = pcm->config; 185 const struct snd_dmaengine_pcm_config *config = pcm->config;
186 struct device *dev = rtd->platform->dev;
187 struct snd_dmaengine_dai_dma_data *dma_data;
186 struct snd_pcm_substream *substream; 188 struct snd_pcm_substream *substream;
187 size_t prealloc_buffer_size; 189 size_t prealloc_buffer_size;
188 size_t max_buffer_size; 190 size_t max_buffer_size;
@@ -203,6 +205,13 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
203 if (!substream) 205 if (!substream)
204 continue; 206 continue;
205 207
208 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
209
210 if (!pcm->chan[i] &&
211 (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME))
212 pcm->chan[i] = dma_request_slave_channel(dev,
213 dma_data->chan_name);
214
206 if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { 215 if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) {
207 pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, 216 pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd,
208 substream); 217 substream);
@@ -275,7 +284,9 @@ static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
275{ 284{
276 unsigned int i; 285 unsigned int i;
277 286
278 if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || !dev->of_node) 287 if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT |
288 SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) ||
289 !dev->of_node)
279 return; 290 return;
280 291
281 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) { 292 if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) {