Commit caebea04 authored by Kai Vehmanen's avatar Kai Vehmanen Committed by Mark Brown

ASoC: SOF: Intel: add hw specific PCM constraints

Part of PCM constraints are set based on DSP topology, but rest
should be set based on hardware capabilities. Add PCM constraints
for Intel platforms:

- Add constraint for the period count to be integer. This avoids
  wrap-arounds of the DMA circular buffer in middle of a period.

- Align period size to dword/32bit as per HDA spec.

Both constraints are aligned with current implementation in snd-hda-intel
driver.
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20201118140545.2138895-2-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9983ac49
...@@ -225,6 +225,13 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev, ...@@ -225,6 +225,13 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
return -ENODEV; return -ENODEV;
} }
/* minimum as per HDA spec */
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
/* avoid circular buffer wrap in middle of period */
snd_pcm_hw_constraint_integer(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
/* binding pcm substream to hda stream */ /* binding pcm substream to hda stream */
substream->runtime->private_data = &dsp_stream->hstream; substream->runtime->private_data = &dsp_stream->hstream;
return 0; return 0;
......
...@@ -73,6 +73,13 @@ int intel_pcm_open(struct snd_sof_dev *sdev, ...@@ -73,6 +73,13 @@ int intel_pcm_open(struct snd_sof_dev *sdev,
/* binding pcm substream to hda stream */ /* binding pcm substream to hda stream */
substream->runtime->private_data = stream; substream->runtime->private_data = stream;
/* align to DMA minimum transfer size */
snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4);
/* avoid circular buffer wrap in middle of period */
snd_pcm_hw_constraint_integer(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
return 0; return 0;
} }
EXPORT_SYMBOL_NS(intel_pcm_open, SND_SOC_SOF_INTEL_HIFI_EP_IPC); EXPORT_SYMBOL_NS(intel_pcm_open, SND_SOC_SOF_INTEL_HIFI_EP_IPC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment