summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/atom
diff options
context:
space:
mode:
authorBrent Lu <brent.lu@intel.com>2020-07-31 14:26:04 +0200
committerMark Brown <broonie@kernel.org>2020-08-21 16:04:28 +0200
commit5e7820e369248f880767c4c4079b414529bc2125 (patch)
treefcb46e3449bdde15a9333b3e060c95c420483f64 /sound/soc/intel/atom
parentASoC: Intel: skl_hda_dsp_generic: Fix NULLptr dereference in autosuspend delay (diff)
downloadlinux-5e7820e369248f880767c4c4079b414529bc2125.tar.xz
linux-5e7820e369248f880767c4c4079b414529bc2125.zip
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: Brent Lu <brent.lu@intel.com> Link: https://lore.kernel.org/r/1596198365-10105-2-git-send-email-brent.lu@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/atom')
-rw-r--r--sound/soc/intel/atom/sst-mfld-platform-pcm.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index b1cac7abdc0a..fba2c795ce0d 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -333,6 +333,17 @@ static int sst_media_open(struct snd_pcm_substream *substream,
if (ret_val < 0)
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 */
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIODS, 2);