From: Brent Lu <brent.lu@intel.com>
To: alsa-devel@alsa-project.org
Cc: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
Jie Yang <yang.jie@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Sam McNally <sammc@chromium.org>, Mark Brown <broonie@kernel.org>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Yu-Hsuan Hsu <yuhsuan@chromium.org>,
Daniel Stuart <daniel.stuart14@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Brent Lu <brent.lu@intel.com>,
Damian van Soelen <dj.vsoelen@gmail.com>
Subject: [PATCH 1/2] ASoC: intel: atom: Add period size constraint
Date: Wed, 29 Jul 2020 19:03:04 +0800 [thread overview]
Message-ID: <1596020585-11517-2-git-send-email-brent.lu@intel.com> (raw)
In-Reply-To: <1596020585-11517-1-git-send-email-brent.lu@intel.com>
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..f614651 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
next prev parent reply other threads:[~2020-07-29 11:10 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 11:03 [PATCH 0/2] Add period size constraint for Atom Chromebook Brent Lu
2020-07-29 11:03 ` Brent Lu [this message]
2020-07-29 11:19 ` [PATCH 1/2] ASoC: intel: atom: Add period size constraint Andy Shevchenko
2020-07-29 11:03 ` [PATCH 2/2] ASoC: Intel: Add period size constraint on strago board Brent Lu
2020-07-29 14:08 ` Pierre-Louis Bossart
2020-07-30 8:02 ` Lu, Brent
2020-07-30 15:27 ` Pierre-Louis Bossart
2020-07-30 15:44 ` Pierre-Louis Bossart
2020-07-30 16:17 ` Lu, Brent
2020-07-30 16:56 ` Takashi Iwai
2020-07-31 12:28 ` Lu, Brent
2020-07-29 11:20 ` [PATCH 0/2] Add period size constraint for Atom Chromebook Andy Shevchenko
2020-07-31 12:26 ` [PATCH v3 " Brent Lu
2020-07-31 12:26 ` [PATCH v3 1/2] ASoC: intel: atom: Add period size constraint Brent Lu
2020-07-31 12:26 ` [PATCH v3 2/2] ASoC: Intel: Add period size constraint on strago board Brent Lu
2020-07-31 13:34 ` Takashi Iwai
2020-08-01 8:58 ` Lu, Brent
2020-08-01 9:26 ` Takashi Iwai
2020-08-03 13:00 ` Lu, Brent
2020-08-03 15:13 ` Pierre-Louis Bossart
2020-08-03 16:45 ` Lu, Brent
2020-08-03 16:56 ` Takashi Iwai
2020-08-04 4:33 ` Lu, Brent
2020-08-04 14:24 ` Pierre-Louis Bossart
2020-08-06 16:41 ` Lu, Brent
2020-08-10 15:03 ` Pierre-Louis Bossart
2020-08-10 17:38 ` Yu-Hsuan Hsu
2020-08-11 2:16 ` Lu, Brent
2020-08-11 2:29 ` Yu-Hsuan Hsu
2020-08-11 7:43 ` Takashi Iwai
2020-08-11 8:25 ` Yu-Hsuan Hsu
2020-08-11 8:39 ` Takashi Iwai
2020-08-11 9:35 ` Yu-Hsuan Hsu
2020-08-11 14:53 ` Mark Brown
2020-08-11 16:54 ` Pierre-Louis Bossart
2020-08-11 17:22 ` Mark Brown
2020-08-12 3:09 ` Yu-Hsuan Hsu
2020-08-12 6:13 ` Takashi Iwai
2020-08-12 6:53 ` Yu-Hsuan Hsu
2020-08-12 6:58 ` Takashi Iwai
2020-08-12 7:43 ` Yu-Hsuan Hsu
2020-08-12 7:47 ` Takashi Iwai
2020-08-12 14:46 ` Pierre-Louis Bossart
2020-08-12 14:55 ` Takashi Iwai
2020-08-12 15:54 ` Pierre-Louis Bossart
2020-08-12 16:08 ` Lu, Brent
2020-08-12 16:38 ` Pierre-Louis Bossart
2020-08-13 6:24 ` Yu-Hsuan Hsu
2020-08-13 7:55 ` Lu, Brent
2020-08-13 8:36 ` Yu-Hsuan Hsu
2020-08-13 8:45 ` Takashi Iwai
2020-08-13 12:57 ` Pierre-Louis Bossart
2020-08-13 17:15 ` Yu-Hsuan Hsu
2020-08-21 16:40 ` [PATCH v3 0/2] Add period size constraint for Atom Chromebook Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1596020585-11517-2-git-send-email-brent.lu@intel.com \
--to=brent.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=daniel.stuart14@gmail.com \
--cc=dj.vsoelen@gmail.com \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sammc@chromium.org \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.com \
--cc=yuhsuan@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).