diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2017-01-17 08:16:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-01-23 13:16:33 -0500 |
commit | 9bfa24e90956cc79362572391657b84cf54a559a (patch) | |
tree | 42054d8feed6201b0eb86976f24ce9a07b316a9f | |
parent | b8ab0ccc0b6e517ff595f1b06fb9f578c8b4001f (diff) |
ASoC: Revert "Drop SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag"
This reverts commit c6644119a3f80ea644bde10009d5e1013b5aff29 and
restores the ability to specify DMA channel names per DAI dma_data.
Unfortunately the functionality removed in the patch being reverted
cannot be entirely replaced by specifying DMA channel names in struct
snd_dmaengine_pcm_config as that does not cover devices with more than
2 DMA channels.
Together with patch "ASoC: Revert "samsung: Remove unneeded
initialization of chan_name"" this fixes broken sound on the s3c24xx
SoC platforms.
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/dmaengine_pcm.h | 6 | ||||
-rw-r--r-- | sound/soc/soc-generic-dmaengine-pcm.c | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index 1c8f9e1ef2a5..67be2445941a 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h | |||
@@ -71,6 +71,7 @@ struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) | |||
71 | * @slave_id: Slave requester id for the DMA channel. | 71 | * @slave_id: Slave requester id for the DMA channel. |
72 | * @filter_data: Custom DMA channel filter data, this will usually be used when | 72 | * @filter_data: Custom DMA channel filter data, this will usually be used when |
73 | * requesting the DMA channel. | 73 | * requesting the DMA channel. |
74 | * @chan_name: Custom channel name to use when requesting DMA channel. | ||
74 | * @fifo_size: FIFO size of the DAI controller in bytes | 75 | * @fifo_size: FIFO size of the DAI controller in bytes |
75 | * @flags: PCM_DAI flags, only SND_DMAENGINE_PCM_DAI_FLAG_PACK for now | 76 | * @flags: PCM_DAI flags, only SND_DMAENGINE_PCM_DAI_FLAG_PACK for now |
76 | */ | 77 | */ |
@@ -80,6 +81,7 @@ struct snd_dmaengine_dai_dma_data { | |||
80 | u32 maxburst; | 81 | u32 maxburst; |
81 | unsigned int slave_id; | 82 | unsigned int slave_id; |
82 | void *filter_data; | 83 | void *filter_data; |
84 | const char *chan_name; | ||
83 | unsigned int fifo_size; | 85 | unsigned int fifo_size; |
84 | unsigned int flags; | 86 | unsigned int flags; |
85 | }; | 87 | }; |
@@ -105,6 +107,10 @@ void snd_dmaengine_pcm_set_config_from_dai_data( | |||
105 | * playback. | 107 | * playback. |
106 | */ | 108 | */ |
107 | #define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3) | 109 | #define SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX BIT(3) |
110 | /* | ||
111 | * The PCM streams have custom channel names specified. | ||
112 | */ | ||
113 | #define SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME BIT(4) | ||
108 | 114 | ||
109 | /** | 115 | /** |
110 | * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM | 116 | * 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 17eb14935577..d53786498b61 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c | |||
@@ -263,6 +263,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
263 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 263 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); |
264 | const struct snd_dmaengine_pcm_config *config = pcm->config; | 264 | const struct snd_dmaengine_pcm_config *config = pcm->config; |
265 | struct device *dev = rtd->platform->dev; | 265 | struct device *dev = rtd->platform->dev; |
266 | struct snd_dmaengine_dai_dma_data *dma_data; | ||
266 | struct snd_pcm_substream *substream; | 267 | struct snd_pcm_substream *substream; |
267 | size_t prealloc_buffer_size; | 268 | size_t prealloc_buffer_size; |
268 | size_t max_buffer_size; | 269 | size_t max_buffer_size; |
@@ -282,6 +283,13 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
282 | if (!substream) | 283 | if (!substream) |
283 | continue; | 284 | continue; |
284 | 285 | ||
286 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
287 | |||
288 | if (!pcm->chan[i] && | ||
289 | (pcm->flags & SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) | ||
290 | pcm->chan[i] = dma_request_slave_channel(dev, | ||
291 | dma_data->chan_name); | ||
292 | |||
285 | if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { | 293 | if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { |
286 | pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, | 294 | pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, |
287 | substream); | 295 | substream); |
@@ -350,7 +358,9 @@ static int dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, | |||
350 | const char *name; | 358 | const char *name; |
351 | struct dma_chan *chan; | 359 | struct dma_chan *chan; |
352 | 360 | ||
353 | if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_DT) || !dev->of_node) | 361 | if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT | |
362 | SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) || | ||
363 | !dev->of_node) | ||
354 | return 0; | 364 | return 0; |
355 | 365 | ||
356 | if (config && config->dma_dev) { | 366 | if (config && config->dma_dev) { |