lkml.org 
[lkml]   [2020]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 1/2] ASoC: intel: atom: Add period size constraint
Date
Use constraint to enforce the period sizes which are validated in
Android BSP.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
sound/soc/intel/atom/sst-mfld-platform-pcm.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
index 49b9f18..70100ef 100644
--- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
+++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
@@ -300,6 +300,16 @@ static void power_down_sst(struct sst_runtime_stream *stream)
stream->ops->power(sst->dev, false);
}

+static const unsigned int media_period_size[] = {
+ /* sizes validated on Android platform */
+ 240, 320, 960, 3072,
+};
+
+static const struct snd_pcm_hw_constraint_list constraints_media_period_size = {
+ .count = ARRAY_SIZE(media_period_size),
+ .list = media_period_size,
+};
+
static int sst_media_open(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -333,6 +343,11 @@ static int sst_media_open(struct snd_pcm_substream *substream,
if (ret_val < 0)
return ret_val;

+ /* Avoid using period size which is not validated */
+ snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
+ &constraints_media_period_size);
+
/* Make sure, that the period size is always even */
snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIODS, 2);
--
2.7.4
\
 
 \ /
  Last update: 2020-07-30 10:19    [W:0.060 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site