Skip to content

Commit da9054c

Browse files
committed
ASoC: SOF: Intel: hda-pcm: Use dsp_buffer_time_ms to place constraint
If the PCM have the dsp_buffer_time_ms set then place a constraint to limit the minimum period time to avoid smaller period sizes than the DMA burst. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent b75fef1 commit da9054c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sound/soc/sof/intel/hda-pcm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
263263
snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT,
264264
SNDRV_PCM_FMTBIT_S16 | SNDRV_PCM_FMTBIT_S32);
265265

266+
/*
267+
* Set constraint on the period time to make sure that it is larger than
268+
* the DSP buffer size. This is the maximum DMA burst size that can
269+
* happen on stream start for example.
270+
* The period size must not be smaller than this.
271+
*/
272+
if (spcm->stream[substream->stream].dsp_buffer_time_ms)
273+
snd_pcm_hw_constraint_minmax(substream->runtime,
274+
SNDRV_PCM_HW_PARAM_PERIOD_TIME,
275+
spcm->stream[substream->stream].dsp_buffer_time_ms * USEC_PER_MSEC,
276+
UINT_MAX);
277+
266278
/* binding pcm substream to hda stream */
267279
substream->runtime->private_data = &dsp_stream->hstream;
268280
return 0;

0 commit comments

Comments
 (0)