diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-06-03 00:39:35 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-06-03 11:12:40 -0400 |
commit | 3f024039e08598521a2c4c3eaedf8de2119797f4 (patch) | |
tree | 8556b7e70decf1be3bdba930dd1340556d0df288 /sound/soc/omap | |
parent | f10b8ad15f9531b6d58edabccf05e9eb738c4409 (diff) |
ASoC: omap-mcbsp: Save, and use wlen for threshold configuration
Save the word length configuration of McBSP, and use that information
to calculate, and configure the threshold in McBSP.
Previously the calculation was only correct when the stream had 16bit
audio.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolsfonmicro.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/omap')
-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 6f44cb4d30b8..b06d8f1620d7 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; |