diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2013-04-15 13:19:51 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-17 09:21:36 -0400 |
commit | c999836d37c6c1125e856f68877ae13952baa61a (patch) | |
tree | 77ca9109474b59a6a811e36784f3fed5b3458a2e /include/sound | |
parent | 28c4468b00a1e55e08cc20117de968f7c6275441 (diff) |
ASoC: dmaengine_pcm: Add support for compat platforms
Add support for platforms which don't use devicetree yet or have to optionally
support a non-devicetree way to request the DMA channel. The patch adds the
compat_request_channel and compat_filter_fn callbacks to the
snd_dmaengine_pcm_config struct. If the compat_request_channel is implemented it
will be used to request the DMA channel. If not dma_request_channel with
compat_filter_fn as the filter function will be used to request the channel.
The patch also exports the snd_dmaengine_pcm_request_chan() function, since
compat platforms will want to use it to request their DMA channel.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/dmaengine_pcm.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index e0bf24e90669..1a7897ab3572 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define __SOUND_DMAENGINE_PCM_H__ | 16 | #define __SOUND_DMAENGINE_PCM_H__ |
17 | 17 | ||
18 | #include <sound/pcm.h> | 18 | #include <sound/pcm.h> |
19 | #include <sound/soc.h> | ||
19 | #include <linux/dmaengine.h> | 20 | #include <linux/dmaengine.h> |
20 | 21 | ||
21 | /** | 22 | /** |
@@ -46,6 +47,8 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream, | |||
46 | dma_filter_fn filter_fn, void *filter_data); | 47 | dma_filter_fn filter_fn, void *filter_data); |
47 | int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream); | 48 | int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream); |
48 | 49 | ||
50 | struct dma_chan *snd_dmaengine_pcm_request_channel(dma_filter_fn filter_fn, | ||
51 | void *filter_data); | ||
49 | struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream); | 52 | struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream); |
50 | 53 | ||
51 | /** | 54 | /** |
@@ -72,17 +75,43 @@ void snd_dmaengine_pcm_set_config_from_dai_data( | |||
72 | const struct snd_dmaengine_dai_dma_data *dma_data, | 75 | const struct snd_dmaengine_dai_dma_data *dma_data, |
73 | struct dma_slave_config *config); | 76 | struct dma_slave_config *config); |
74 | 77 | ||
78 | |||
79 | /* | ||
80 | * Try to request the DMA channel using compat_request_channel or | ||
81 | * compat_filter_fn if it couldn't be requested through devicetree. | ||
82 | */ | ||
83 | #define SND_DMAENGINE_PCM_FLAG_COMPAT BIT(0) | ||
84 | /* | ||
85 | * Don't try to request the DMA channels through devicetree. This flag only | ||
86 | * makes sense if SND_DMAENGINE_PCM_FLAG_COMPAT is set as well. | ||
87 | */ | ||
88 | #define SND_DMAENGINE_PCM_FLAG_NO_DT BIT(1) | ||
89 | |||
75 | /** | 90 | /** |
76 | * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM | 91 | * struct snd_dmaengine_pcm_config - Configuration data for dmaengine based PCM |
77 | * @prepare_slave_config: Callback used to fill in the DMA slave_config for a | 92 | * @prepare_slave_config: Callback used to fill in the DMA slave_config for a |
78 | * PCM substream. Will be called from the PCM drivers hwparams callback. | 93 | * PCM substream. Will be called from the PCM drivers hwparams callback. |
94 | * @compat_request_channel: Callback to request a DMA channel for platforms | ||
95 | * which do not use devicetree. | ||
96 | * @compat_filter_fn: Will be used as the filter function when requesting a | ||
97 | * channel for platforms which do not use devicetree. The filter parameter | ||
98 | * will be the DAI's DMA data. | ||
79 | * @pcm_hardware: snd_pcm_hardware struct to be used for the PCM. | 99 | * @pcm_hardware: snd_pcm_hardware struct to be used for the PCM. |
80 | * @prealloc_buffer_size: Size of the preallocated audio buffer. | 100 | * @prealloc_buffer_size: Size of the preallocated audio buffer. |
101 | * | ||
102 | * Note: If both compat_request_channel and compat_filter_fn are set | ||
103 | * compat_request_channel will be used to request the channel and | ||
104 | * compat_filter_fn will be ignored. Otherwise the channel will be requested | ||
105 | * using dma_request_channel with compat_filter_fn as the filter function. | ||
81 | */ | 106 | */ |
82 | struct snd_dmaengine_pcm_config { | 107 | struct snd_dmaengine_pcm_config { |
83 | int (*prepare_slave_config)(struct snd_pcm_substream *substream, | 108 | int (*prepare_slave_config)(struct snd_pcm_substream *substream, |
84 | struct snd_pcm_hw_params *params, | 109 | struct snd_pcm_hw_params *params, |
85 | struct dma_slave_config *slave_config); | 110 | struct dma_slave_config *slave_config); |
111 | struct dma_chan *(*compat_request_channel)( | ||
112 | struct snd_soc_pcm_runtime *rtd, | ||
113 | struct snd_pcm_substream *substream); | ||
114 | dma_filter_fn compat_filter_fn; | ||
86 | 115 | ||
87 | const struct snd_pcm_hardware *pcm_hardware; | 116 | const struct snd_pcm_hardware *pcm_hardware; |
88 | unsigned int prealloc_buffer_size; | 117 | unsigned int prealloc_buffer_size; |