Skip to content

Commit 62916eb

Browse files
ujfalusigregkh
authored andcommitted
ASoC: SOF: Intel: hda-pcm: Limit the maximum number of periods by MAX_BDL_ENTRIES
[ Upstream commit 82bb8db ] 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 <peter.ujfalusi@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://patch.msgid.link/20240704090106.371497-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c100e7c commit 62916eb

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
@@ -254,6 +254,12 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
254254
snd_pcm_hw_constraint_integer(substream->runtime,
255255
SNDRV_PCM_HW_PARAM_PERIODS);
256256

257+
/* Limit the maximum number of periods to not exceed the BDL entries count */
258+
if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES)
259+
snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
260+
runtime->hw.periods_min,
261+
HDA_DSP_MAX_BDL_ENTRIES);
262+
257263
/* Only S16 and S32 supported by HDA hardware when used without DSP */
258264
if (sdev->dspless_mode_selected)
259265
snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT,

0 commit comments

Comments
 (0)