[alsa-devel] [PATCH 2/2] ASoC: speyside: Constrain the CPU link to 8kHz based rates

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Mar 14 21:36:34 CET 2012


While the CODEC now supports other rates we're only clocking it for 8kHz
based rates. In future we'll probably want to take advantage of the extra
flexibility but this ensures userspace doesn't use the wrong rates for now.

Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>
---
 sound/soc/samsung/speyside.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index ce5af12..fafffd9 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -126,6 +126,28 @@ static void speyside_set_polarity(struct snd_soc_codec *codec,
 	snd_soc_dapm_sync(&codec->dapm);
 }
 
+static const unsigned int speyside_cpu_constraints[] = {
+	8000, 16000, 32000, 48000,
+};
+
+static struct snd_pcm_hw_constraint_list speyside_cpu_constraints_list = {
+	.count	= ARRAY_SIZE(speyside_cpu_constraints),
+	.list	= speyside_cpu_constraints,
+};
+
+static int speyside_cpu_startup(struct snd_pcm_substream *substream)
+{
+	snd_pcm_hw_constraint_list(substream->runtime, 0,
+				   SNDRV_PCM_HW_PARAM_RATE,
+				   &speyside_cpu_constraints_list);
+
+	return 0;
+}
+
+static struct snd_soc_ops speyside_cpu_ops = {
+	.startup = speyside_cpu_startup,
+};
+
 static int speyside_wm8996_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_dai *dai = rtd->codec_dai;
@@ -183,6 +205,7 @@ static struct snd_soc_dai_link speyside_dai[] = {
 		.init = speyside_wm8996_init,
 		.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 				| SND_SOC_DAIFMT_CBM_CFM,
+		.ops = &speyside_cpu_ops,
 	},
 	{
 		.name = "Baseband",
-- 
1.7.9.1



More information about the Alsa-devel mailing list