diff options
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; |