Skip to content

Commit 9830008

Browse files
committed
ASoC: SOF: Intel: hda: modify period size constraints for ACE4
Intel ACE4 based products set more strict constraints on HDA BDLE start address and length alignment. Add a constraint to align period size to 128 bytes. The commit removes the "minimum as per HDA spec" comment. This comment was misleading as spec actually does allow a 2 byte BDLE length, and more importantly, period size also directly impacts how the BDLE start addresses are aligned, so it is not sufficient just to consider allowed buffer length. Reported-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 9133fb9 commit 9830008

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ EXPORT_SYMBOL_NS(hda_dsp_pcm_pointer, "SND_SOC_SOF_INTEL_HDA_COMMON");
219219
int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
220220
struct snd_pcm_substream *substream)
221221
{
222+
const struct sof_intel_dsp_desc *chip_info = get_chip_info(sdev->pdata);
222223
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
223224
struct snd_pcm_runtime *runtime = substream->runtime;
224225
struct snd_soc_component *scomp = sdev->component;
@@ -268,8 +269,17 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
268269
return -ENODEV;
269270
}
270271

271-
/* minimum as per HDA spec */
272-
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
272+
/*
273+
* Set period size constraint to ensure BDLE buffer length and
274+
* start address alignment requirements are met. Align to 128
275+
* bytes for newer Intel platforms, with older ones using 4 byte alignment.
276+
*/
277+
if (chip_info->hw_ip_version >= SOF_INTEL_ACE_4_0)
278+
snd_pcm_hw_constraint_step(substream->runtime, 0,
279+
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
280+
else
281+
snd_pcm_hw_constraint_step(substream->runtime, 0,
282+
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
273283

274284
/* avoid circular buffer wrap in middle of period */
275285
snd_pcm_hw_constraint_integer(substream->runtime,

0 commit comments

Comments
 (0)