Skip to content

Commit

Permalink
ASoC: rt5670: check if asrc is useable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bard Liao authored and Mark Brown committed Nov 25, 2014
1 parent 044b724 commit e50334d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sound/soc/codecs/rt5670.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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" },
Expand Down

0 comments on commit e50334d

Please sign in to comment.