diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2012-09-14 08:05:57 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-22 11:13:02 -0400 |
commit | bcd6da7bfd1bc3e9d5f8887967ec3d550ce56c70 (patch) | |
tree | 185bd9cd57ba3dbf3e223fe83e6bbd1a7ed8a92f /sound | |
parent | f05cc9dac99ac6403d057d2cccb3c754714d2f32 (diff) |
ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time
Set the dma_data for the stream (snd_soc_dai_set_dma_data) at dai_startup
time so omap-pcm will have access to the needed information regarding to
the DMA channel earlier.
This is needed for the clean dmaengine support.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/omap/omap-dmic.c | 6 | ||||
-rw-r--r-- | sound/soc/omap/omap-hdmi.c | 15 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 7 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 8 |
4 files changed, 21 insertions, 15 deletions
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index df0ff247f496..68f2cd1a9206 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
@@ -118,6 +118,7 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream, | |||
118 | 118 | ||
119 | mutex_unlock(&dmic->mutex); | 119 | mutex_unlock(&dmic->mutex); |
120 | 120 | ||
121 | snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); | ||
121 | return ret; | 122 | return ret; |
122 | } | 123 | } |
123 | 124 | ||
@@ -202,6 +203,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, | |||
202 | struct snd_soc_dai *dai) | 203 | struct snd_soc_dai *dai) |
203 | { | 204 | { |
204 | struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); | 205 | struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai); |
206 | struct omap_pcm_dma_data *dma_data; | ||
205 | int channels; | 207 | int channels; |
206 | 208 | ||
207 | dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params)); | 209 | dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params)); |
@@ -227,8 +229,8 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream, | |||
227 | } | 229 | } |
228 | 230 | ||
229 | /* packet size is threshold * channels */ | 231 | /* packet size is threshold * channels */ |
230 | omap_dmic_dai_dma_params.packet_size = dmic->threshold * channels; | 232 | dma_data = snd_soc_dai_get_dma_data(dai, substream); |
231 | snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params); | 233 | dma_data->packet_size = dmic->threshold * channels; |
232 | 234 | ||
233 | return 0; | 235 | return 0; |
234 | } | 236 | } |
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c index 095176738fd6..f59c69fb400e 100644 --- a/sound/soc/omap/omap-hdmi.c +++ b/sound/soc/omap/omap-hdmi.c | |||
@@ -67,6 +67,9 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream, | |||
67 | dev_err(dai->dev, "audio not supported\n"); | 67 | dev_err(dai->dev, "audio not supported\n"); |
68 | return -ENODEV; | 68 | return -ENODEV; |
69 | } | 69 | } |
70 | |||
71 | snd_soc_dai_set_dma_data(dai, substream, &priv->dma_params); | ||
72 | |||
70 | return 0; | 73 | return 0; |
71 | } | 74 | } |
72 | 75 | ||
@@ -85,24 +88,24 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream, | |||
85 | struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); | 88 | struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai); |
86 | struct snd_aes_iec958 *iec = &priv->iec; | 89 | struct snd_aes_iec958 *iec = &priv->iec; |
87 | struct snd_cea_861_aud_if *cea = &priv->cea; | 90 | struct snd_cea_861_aud_if *cea = &priv->cea; |
91 | struct omap_pcm_dma_data *dma_data; | ||
88 | int err = 0; | 92 | int err = 0; |
89 | 93 | ||
94 | dma_data = snd_soc_dai_get_dma_data(dai, substream); | ||
95 | |||
90 | switch (params_format(params)) { | 96 | switch (params_format(params)) { |
91 | case SNDRV_PCM_FORMAT_S16_LE: | 97 | case SNDRV_PCM_FORMAT_S16_LE: |
92 | priv->dma_params.packet_size = 16; | 98 | dma_data->packet_size = 16; |
93 | break; | 99 | break; |
94 | case SNDRV_PCM_FORMAT_S24_LE: | 100 | case SNDRV_PCM_FORMAT_S24_LE: |
95 | priv->dma_params.packet_size = 32; | 101 | dma_data->packet_size = 32; |
96 | break; | 102 | break; |
97 | default: | 103 | default: |
98 | dev_err(dai->dev, "format not supported!\n"); | 104 | dev_err(dai->dev, "format not supported!\n"); |
99 | return -EINVAL; | 105 | return -EINVAL; |
100 | } | 106 | } |
101 | 107 | ||
102 | priv->dma_params.data_type = 32; | 108 | dma_data->data_type = 32; |
103 | |||
104 | snd_soc_dai_set_dma_data(dai, substream, | ||
105 | &priv->dma_params); | ||
106 | 109 | ||
107 | /* | 110 | /* |
108 | * fill the IEC-60958 channel status word | 111 | * fill the IEC-60958 channel status word |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index a23064644e58..fef2f5933bb2 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -151,6 +151,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
151 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); | 151 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); |
152 | } | 152 | } |
153 | 153 | ||
154 | snd_soc_dai_set_dma_data(cpu_dai, substream, | ||
155 | &mcbsp->dma_data[substream->stream]); | ||
156 | |||
154 | return err; | 157 | return err; |
155 | } | 158 | } |
156 | 159 | ||
@@ -228,7 +231,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
228 | int pkt_size = 0; | 231 | int pkt_size = 0; |
229 | unsigned int format, div, framesize, master; | 232 | unsigned int format, div, framesize, master; |
230 | 233 | ||
231 | dma_data = &mcbsp->dma_data[substream->stream]; | 234 | dma_data = snd_soc_dai_get_dma_data(cpu_dai, substream); |
232 | channels = params_channels(params); | 235 | channels = params_channels(params); |
233 | 236 | ||
234 | switch (params_format(params)) { | 237 | switch (params_format(params)) { |
@@ -277,8 +280,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
277 | 280 | ||
278 | dma_data->packet_size = pkt_size; | 281 | dma_data->packet_size = pkt_size; |
279 | 282 | ||
280 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
281 | |||
282 | if (mcbsp->configured) { | 283 | if (mcbsp->configured) { |
283 | /* McBSP already configured by another stream */ | 284 | /* McBSP already configured by another stream */ |
284 | return 0; | 285 | return 0; |
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 84743d47e687..775565032ce3 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c | |||
@@ -267,9 +267,11 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream, | |||
267 | } | 267 | } |
268 | omap_mcpdm_open_streams(mcpdm); | 268 | omap_mcpdm_open_streams(mcpdm); |
269 | } | 269 | } |
270 | |||
271 | mutex_unlock(&mcpdm->mutex); | 270 | mutex_unlock(&mcpdm->mutex); |
272 | 271 | ||
272 | snd_soc_dai_set_dma_data(dai, substream, | ||
273 | &omap_mcpdm_dai_dma_params[substream->stream]); | ||
274 | |||
273 | return 0; | 275 | return 0; |
274 | } | 276 | } |
275 | 277 | ||
@@ -324,7 +326,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, | |||
324 | return -EINVAL; | 326 | return -EINVAL; |
325 | } | 327 | } |
326 | 328 | ||
327 | dma_data = &omap_mcpdm_dai_dma_params[stream]; | 329 | dma_data = snd_soc_dai_get_dma_data(dai, substream); |
328 | 330 | ||
329 | /* Configure McPDM channels, and DMA packet size */ | 331 | /* Configure McPDM channels, and DMA packet size */ |
330 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 332 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
@@ -336,8 +338,6 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, | |||
336 | dma_data->packet_size = mcpdm->up_threshold * channels; | 338 | dma_data->packet_size = mcpdm->up_threshold * channels; |
337 | } | 339 | } |
338 | 340 | ||
339 | snd_soc_dai_set_dma_data(dai, substream, dma_data); | ||
340 | |||
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | 343 | ||