diff options
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 6f44cb4d30b..b06d8f1620d 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -59,6 +59,7 @@ struct omap_mcbsp_data { | |||
59 | int configured; | 59 | int configured; |
60 | unsigned int in_freq; | 60 | unsigned int in_freq; |
61 | int clk_div; | 61 | int clk_div; |
62 | int wlen; | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | #define to_mcbsp(priv) container_of((priv), struct omap_mcbsp_data, bus_id) | 65 | #define to_mcbsp(priv) container_of((priv), struct omap_mcbsp_data, bus_id) |
@@ -155,19 +156,21 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream) | |||
155 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 156 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; |
156 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 157 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
157 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); | 158 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(mcbsp_data->bus_id); |
158 | int samples; | 159 | int words; |
159 | 160 | ||
160 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ | 161 | /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ |
161 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) | 162 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) |
162 | samples = snd_pcm_lib_period_bytes(substream) >> 1; | 163 | /* The FIFO size depends on the McBSP word configuration */ |
164 | words = snd_pcm_lib_period_bytes(substream) / | ||
165 | (mcbsp_data->wlen / 8); | ||
163 | else | 166 | else |
164 | samples = 1; | 167 | words = 1; |
165 | 168 | ||
166 | /* Configure McBSP internal buffer usage */ | 169 | /* Configure McBSP internal buffer usage */ |
167 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 170 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
168 | omap_mcbsp_set_tx_threshold(mcbsp_data->bus_id, samples - 1); | 171 | omap_mcbsp_set_tx_threshold(mcbsp_data->bus_id, words); |
169 | else | 172 | else |
170 | omap_mcbsp_set_rx_threshold(mcbsp_data->bus_id, samples - 1); | 173 | omap_mcbsp_set_rx_threshold(mcbsp_data->bus_id, words); |
171 | } | 174 | } |
172 | 175 | ||
173 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | 176 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, |
@@ -409,6 +412,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
409 | } | 412 | } |
410 | 413 | ||
411 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); | 414 | omap_mcbsp_config(bus_id, &mcbsp_data->regs); |
415 | mcbsp_data->wlen = wlen; | ||
412 | mcbsp_data->configured = 1; | 416 | mcbsp_data->configured = 1; |
413 | 417 | ||
414 | return 0; | 418 | return 0; |