Commit 5e7820e3 authored by Brent Lu's avatar Brent Lu Committed by Mark Brown

ASoC: intel: atom: Add period size constraint

Use constraint to make sure the period size could always be multiple
of 1ms to align with the fundamental design/limitation of firmware.
Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/1596198365-10105-2-git-send-email-brent.lu@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5610921a
...@@ -333,6 +333,17 @@ static int sst_media_open(struct snd_pcm_substream *substream, ...@@ -333,6 +333,17 @@ static int sst_media_open(struct snd_pcm_substream *substream,
if (ret_val < 0) if (ret_val < 0)
goto out_power_up; goto out_power_up;
/*
* Make sure the period to be multiple of 1ms to align the
* design of firmware. Apply same rule to buffer size to make
* sure alsa could always find a value for period size
* regardless the buffer size given by user space.
*/
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 48);
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 48);
/* Make sure, that the period size is always even */ /* Make sure, that the period size is always even */
snd_pcm_hw_constraint_step(substream->runtime, 0, snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIODS, 2); SNDRV_PCM_HW_PARAM_PERIODS, 2);
......
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