diff options
Diffstat (limited to 'sound/soc/soc-dmaengine-pcm.c')
-rw-r--r-- | sound/soc/soc-dmaengine-pcm.c | 68 |
1 files changed, 39 insertions, 29 deletions
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c index 111b7d921e89..a9a300acb506 100644 --- a/sound/soc/soc-dmaengine-pcm.c +++ b/sound/soc/soc-dmaengine-pcm.c | |||
@@ -33,8 +33,6 @@ struct dmaengine_pcm_runtime_data { | |||
33 | dma_cookie_t cookie; | 33 | dma_cookie_t cookie; |
34 | 34 | ||
35 | unsigned int pos; | 35 | unsigned int pos; |
36 | |||
37 | void *data; | ||
38 | }; | 36 | }; |
39 | 37 | ||
40 | static inline struct dmaengine_pcm_runtime_data *substream_to_prtd( | 38 | static inline struct dmaengine_pcm_runtime_data *substream_to_prtd( |
@@ -43,33 +41,6 @@ static inline struct dmaengine_pcm_runtime_data *substream_to_prtd( | |||
43 | return substream->runtime->private_data; | 41 | return substream->runtime->private_data; |
44 | } | 42 | } |
45 | 43 | ||
46 | /** | ||
47 | * snd_dmaengine_pcm_set_data - Set dmaengine substream private data | ||
48 | * @substream: PCM substream | ||
49 | * @data: Data to set | ||
50 | */ | ||
51 | void snd_dmaengine_pcm_set_data(struct snd_pcm_substream *substream, void *data) | ||
52 | { | ||
53 | struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); | ||
54 | |||
55 | prtd->data = data; | ||
56 | } | ||
57 | EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_data); | ||
58 | |||
59 | /** | ||
60 | * snd_dmaengine_pcm_get_data - Get dmaeinge substream private data | ||
61 | * @substream: PCM substream | ||
62 | * | ||
63 | * Returns the data previously set with snd_dmaengine_pcm_set_data | ||
64 | */ | ||
65 | void *snd_dmaengine_pcm_get_data(struct snd_pcm_substream *substream) | ||
66 | { | ||
67 | struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); | ||
68 | |||
69 | return prtd->data; | ||
70 | } | ||
71 | EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_get_data); | ||
72 | |||
73 | struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) | 44 | struct dma_chan *snd_dmaengine_pcm_get_chan(struct snd_pcm_substream *substream) |
74 | { | 45 | { |
75 | struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); | 46 | struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); |
@@ -118,10 +89,49 @@ int snd_hwparams_to_dma_slave_config(const struct snd_pcm_substream *substream, | |||
118 | slave_config->src_addr_width = buswidth; | 89 | slave_config->src_addr_width = buswidth; |
119 | } | 90 | } |
120 | 91 | ||
92 | slave_config->device_fc = false; | ||
93 | |||
121 | return 0; | 94 | return 0; |
122 | } | 95 | } |
123 | EXPORT_SYMBOL_GPL(snd_hwparams_to_dma_slave_config); | 96 | EXPORT_SYMBOL_GPL(snd_hwparams_to_dma_slave_config); |
124 | 97 | ||
98 | /** | ||
99 | * snd_dmaengine_pcm_set_config_from_dai_data() - Initializes a dma slave config | ||
100 | * using DAI DMA data. | ||
101 | * @substream: PCM substream | ||
102 | * @dma_data: DAI DMA data | ||
103 | * @slave_config: DMA slave configuration | ||
104 | * | ||
105 | * Initializes the {dst,src}_addr, {dst,src}_maxburst, {dst,src}_addr_width and | ||
106 | * slave_id fields of the DMA slave config from the same fields of the DAI DMA | ||
107 | * data struct. The src and dst fields will be initialized depending on the | ||
108 | * direction of the substream. If the substream is a playback stream the dst | ||
109 | * fields will be initialized, if it is a capture stream the src fields will be | ||
110 | * initialized. The {dst,src}_addr_width field will only be initialized if the | ||
111 | * addr_width field of the DAI DMA data struct is not equal to | ||
112 | * DMA_SLAVE_BUSWIDTH_UNDEFINED. | ||
113 | */ | ||
114 | void snd_dmaengine_pcm_set_config_from_dai_data( | ||
115 | const struct snd_pcm_substream *substream, | ||
116 | const struct snd_dmaengine_dai_dma_data *dma_data, | ||
117 | struct dma_slave_config *slave_config) | ||
118 | { | ||
119 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
120 | slave_config->dst_addr = dma_data->addr; | ||
121 | slave_config->dst_maxburst = dma_data->maxburst; | ||
122 | if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED) | ||
123 | slave_config->dst_addr_width = dma_data->addr_width; | ||
124 | } else { | ||
125 | slave_config->src_addr = dma_data->addr; | ||
126 | slave_config->src_maxburst = dma_data->maxburst; | ||
127 | if (dma_data->addr_width != DMA_SLAVE_BUSWIDTH_UNDEFINED) | ||
128 | slave_config->src_addr_width = dma_data->addr_width; | ||
129 | } | ||
130 | |||
131 | slave_config->slave_id = dma_data->slave_id; | ||
132 | } | ||
133 | EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_config_from_dai_data); | ||
134 | |||
125 | static void dmaengine_pcm_dma_complete(void *arg) | 135 | static void dmaengine_pcm_dma_complete(void *arg) |
126 | { | 136 | { |
127 | struct snd_pcm_substream *substream = arg; | 137 | struct snd_pcm_substream *substream = arg; |