diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2010-07-29 02:51:28 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-02 05:38:16 -0400 |
commit | 998a8a69f3a40f9c82e83730bfdaceb63954d753 (patch) | |
tree | 07b02d547ef8e70e93ae25f4d7b9ae1eb03a1405 /sound/soc/omap | |
parent | cf80e15860852be5ce38714979db94ec36c5e288 (diff) |
ASoC: omap-mcbsp: Remove period size constraint in THRESHOLD mode
The use of sDMA packet mode in THRESHOLD mode removes the restriction on the
period size.
With the extended THRESHOLD mode user space can ask for any
period size it wishes, and the driver will configure the
sDMA and McBSP FIFO accordingly.
Replace the hw_rule for the period size with static constraint,
which will make sure that the period size will be always
even (to avoid prime period size, which could be possible in
mono stream)
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.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 | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 9fd00b091814..86f213905e2c 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -202,31 +202,6 @@ static int omap_mcbsp_hwrule_min_buffersize(struct snd_pcm_hw_params *params, | |||
202 | return snd_interval_refine(buffer_size, &frames); | 202 | return snd_interval_refine(buffer_size, &frames); |
203 | } | 203 | } |
204 | 204 | ||
205 | static int omap_mcbsp_hwrule_max_periodsize(struct snd_pcm_hw_params *params, | ||
206 | struct snd_pcm_hw_rule *rule) | ||
207 | { | ||
208 | struct snd_interval *period_size = hw_param_interval(params, | ||
209 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE); | ||
210 | struct snd_interval *channels = hw_param_interval(params, | ||
211 | SNDRV_PCM_HW_PARAM_CHANNELS); | ||
212 | struct snd_pcm_substream *substream = rule->private; | ||
213 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
214 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
215 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | ||
216 | struct snd_interval frames; | ||
217 | int size; | ||
218 | |||
219 | snd_interval_any(&frames); | ||
220 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
221 | size = omap_mcbsp_get_max_tx_threshold(mcbsp_data->bus_id); | ||
222 | else | ||
223 | size = omap_mcbsp_get_max_rx_threshold(mcbsp_data->bus_id); | ||
224 | |||
225 | frames.max = size / channels->min; | ||
226 | frames.integer = 1; | ||
227 | return snd_interval_refine(period_size, &frames); | ||
228 | } | ||
229 | |||
230 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | 205 | static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, |
231 | struct snd_soc_dai *dai) | 206 | struct snd_soc_dai *dai) |
232 | { | 207 | { |
@@ -255,10 +230,8 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
255 | * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words) | 230 | * 4 channels: size is 128 / 4 = 32 frames (4 * 32 words) |
256 | */ | 231 | */ |
257 | if (cpu_is_omap343x()) { | 232 | if (cpu_is_omap343x()) { |
258 | int dma_op_mode = omap_mcbsp_get_dma_op_mode(bus_id); | ||
259 | |||
260 | /* | 233 | /* |
261 | * The first rule is for the buffer size, we should not allow | 234 | * Rule for the buffer size. We should not allow |
262 | * smaller buffer than the FIFO size to avoid underruns | 235 | * smaller buffer than the FIFO size to avoid underruns |
263 | */ | 236 | */ |
264 | snd_pcm_hw_rule_add(substream->runtime, 0, | 237 | snd_pcm_hw_rule_add(substream->runtime, 0, |
@@ -267,17 +240,9 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream, | |||
267 | mcbsp_data, | 240 | mcbsp_data, |
268 | SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); | 241 | SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); |
269 | 242 | ||
270 | /* | 243 | /* Make sure, that the period size is always even */ |
271 | * In case of threshold mode, the rule will ensure, that the | 244 | snd_pcm_hw_constraint_step(substream->runtime, 0, |
272 | * period size is not bigger than the maximum allowed threshold | 245 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2); |
273 | * value. | ||
274 | */ | ||
275 | if (dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) | ||
276 | snd_pcm_hw_rule_add(substream->runtime, 0, | ||
277 | SNDRV_PCM_HW_PARAM_CHANNELS, | ||
278 | omap_mcbsp_hwrule_max_periodsize, | ||
279 | substream, | ||
280 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); | ||
281 | } | 246 | } |
282 | 247 | ||
283 | return err; | 248 | return err; |