aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBard Liao <bardliao@realtek.com>2014-11-17 02:27:21 -0500
committerMark Brown <broonie@kernel.org>2014-11-25 07:12:53 -0500
commite50334d4e1c3bacfeb3bb1530f73a419d4ec6832 (patch)
tree3df3591386bef3b3c4fc441258cd99ebf8e27eba
parent044b724ada4448174f3f7510b791df0bdcb834ee (diff)
ASoC: rt5670: check if asrc is useable
To use ASRC, the sysclk should be faster than 384 times sample rate of I2S1. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/rt5670.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index 5e54ac957e47..3ddb34ef77d7 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,
576 576
577} 577}
578 578
579static int can_use_asrc(struct snd_soc_dapm_widget *source,
580 struct snd_soc_dapm_widget *sink)
581{
582 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm);
583 struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
584
585 if (rt5670->sysclk > rt5670->lrck[RT5670_AIF1] * 384)
586 return 1;
587
588 return 0;
589}
590
579/* Digital Mixer */ 591/* Digital Mixer */
580static const struct snd_kcontrol_new rt5670_sto1_adc_l_mix[] = { 592static const struct snd_kcontrol_new rt5670_sto1_adc_l_mix[] = {
581 SOC_DAPM_SINGLE("ADC1 Switch", RT5670_STO1_ADC_MIXER, 593 SOC_DAPM_SINGLE("ADC1 Switch", RT5670_STO1_ADC_MIXER,
@@ -1639,8 +1651,8 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = {
1639 { "DAC Mono Right Filter", NULL, "DAC MONO R ASRC", is_using_asrc }, 1651 { "DAC Mono Right Filter", NULL, "DAC MONO R ASRC", is_using_asrc },
1640 { "DAC Stereo1 Filter", NULL, "DAC STO ASRC", is_using_asrc }, 1652 { "DAC Stereo1 Filter", NULL, "DAC STO ASRC", is_using_asrc },
1641 1653
1642 { "I2S1", NULL, "I2S1 ASRC" }, 1654 { "I2S1", NULL, "I2S1 ASRC", can_use_asrc},
1643 { "I2S2", NULL, "I2S2 ASRC" }, 1655 { "I2S2", NULL, "I2S2 ASRC", can_use_asrc},
1644 1656
1645 { "DMIC1", NULL, "DMIC L1" }, 1657 { "DMIC1", NULL, "DMIC L1" },
1646 { "DMIC1", NULL, "DMIC R1" }, 1658 { "DMIC1", NULL, "DMIC R1" },