Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] ASoC: rt5670: check if asrc is useable
@ 2014-11-17  7:27 Bard Liao
  2014-11-17  7:27 ` [PATCH v2 2/3] ASoC: rt5670: add DMIC ASRC support Bard Liao
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bard Liao @ 2014-11-17  7:27 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, mengdong.lin, Bard Liao, flove

To use ASRC, the sysclk should be faster than 384 times sample rate of I2S1.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
*Change source->codec to snd_soc_dapm_to_codec(source->dapm)
---
 sound/soc/codecs/rt5670.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index b842be0..fc26742 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -576,6 +576,18 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
 
 }
 
+static int can_use_asrc(struct snd_soc_dapm_widget *source,
+			 struct snd_soc_dapm_widget *sink)
+{
+	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
+	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
+
+	if (rt5670->sysclk > rt5670->lrck[RT5670_AIF1] * 384)
+		return 1;
+
+	return 0;
+}
+
 /* Digital Mixer */
 static const struct snd_kcontrol_new rt5670_sto1_adc_l_mix[] = {
 	SOC_DAPM_SINGLE("ADC1 Switch", RT5670_STO1_ADC_MIXER,
@@ -1639,8 +1651,8 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = {
 	{ "DAC Mono Right Filter", NULL, "DAC MONO R ASRC", is_using_asrc },
 	{ "DAC Stereo1 Filter", NULL, "DAC STO ASRC", is_using_asrc },
 
-	{ "I2S1", NULL, "I2S1 ASRC" },
-	{ "I2S2", NULL, "I2S2 ASRC" },
+	{ "I2S1", NULL, "I2S1 ASRC", can_use_asrc},
+	{ "I2S2", NULL, "I2S2 ASRC", can_use_asrc},
 
 	{ "DMIC1", NULL, "DMIC L1" },
 	{ "DMIC1", NULL, "DMIC R1" },
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-25 12:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17  7:27 [PATCH v2 1/3] ASoC: rt5670: check if asrc is useable Bard Liao
2014-11-17  7:27 ` [PATCH v2 2/3] ASoC: rt5670: add DMIC ASRC support Bard Liao
2014-11-25 12:13   ` Mark Brown
2014-11-17  7:27 ` [PATCH v2 3/3] ASoC: rt5670: add codec irq support Bard Liao
2014-11-17  8:22   ` Lars-Peter Clausen
2014-11-25 12:13 ` [PATCH v2 1/3] ASoC: rt5670: check if asrc is useable Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox