Skip to content

Commit 82bb8db

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: Intel: hda-pcm: Limit the maximum number of periods by MAX_BDL_ENTRIES
The HDaudio specification Section 3.6.2 limits the number of BDL entries to 256. Make sure we don't allow more periods than this normative value. Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7441e7f commit 82bb8db

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
258258
snd_pcm_hw_constraint_integer(substream->runtime,
259259
SNDRV_PCM_HW_PARAM_PERIODS);
260260

261+
/* Limit the maximum number of periods to not exceed the BDL entries count */
262+
if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES)
263+
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
264+
runtime->hw.periods_min,
265+
HDA_DSP_MAX_BDL_ENTRIES);
266+
261267
/* Only S16 and S32 supported by HDA hardware when used without DSP */
262268
if (sdev->dspless_mode_selected)
263269
snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT,

0 commit comments

Comments
 (0)