return 0;
}
- struct snd_soc_codec *codec = source->codec;
++ static int is_using_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 rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
++ unsigned int reg, shift, val;
++
++ if (source->reg == RT5677_ASRC_1) {
++ switch (source->shift) {
++ case 12:
++ reg = RT5677_ASRC_4;
++ shift = 0;
++ break;
++ case 13:
++ reg = RT5677_ASRC_4;
++ shift = 4;
++ break;
++ case 14:
++ reg = RT5677_ASRC_4;
++ shift = 8;
++ break;
++ case 15:
++ reg = RT5677_ASRC_4;
++ shift = 12;
++ break;
++ default:
++ return 0;
++ }
++ } else {
++ switch (source->shift) {
++ case 0:
++ reg = RT5677_ASRC_6;
++ shift = 8;
++ break;
++ case 1:
++ reg = RT5677_ASRC_6;
++ shift = 12;
++ break;
++ case 2:
++ reg = RT5677_ASRC_5;
++ shift = 0;
++ break;
++ case 3:
++ reg = RT5677_ASRC_5;
++ shift = 4;
++ break;
++ case 4:
++ reg = RT5677_ASRC_5;
++ shift = 8;
++ break;
++ case 5:
++ reg = RT5677_ASRC_5;
++ shift = 12;
++ break;
++ case 12:
++ reg = RT5677_ASRC_3;
++ shift = 0;
++ break;
++ case 13:
++ reg = RT5677_ASRC_3;
++ shift = 4;
++ break;
++ case 14:
++ reg = RT5677_ASRC_3;
++ shift = 12;
++ break;
++ default:
++ return 0;
++ }
++ }
++
++ regmap_read(rt5677->regmap, reg, &val);
++ val = (val >> shift) & 0xf;
++
++ switch (val) {
++ case 1 ... 6:
++ return 1;
++ default:
++ return 0;
++ }
++
++ }
++
++ 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 rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
++
++ if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384)
++ return 1;
++
++ return 0;
++ }
++
/* Digital Mixer */
static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = {
SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER,
static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT,
--- 0, rt5677_set_pll1_event, SND_SOC_DAPM_POST_PMU),
+++ 0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU |
+++ SND_SOC_DAPM_POST_PMU),
SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT,
--- 0, rt5677_set_pll2_event, SND_SOC_DAPM_POST_PMU),
+++ 0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU |
+++ SND_SOC_DAPM_POST_PMU),
++
++ /* ASRC */
++ SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5677_ASRC_1, 1, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("I2S3 ASRC", 1, RT5677_ASRC_1, 2, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("I2S4 ASRC", 1, RT5677_ASRC_1, 3, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC STO ASRC", 1, RT5677_ASRC_2, 14, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO2 L ASRC", 1, RT5677_ASRC_2, 13, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO2 R ASRC", 1, RT5677_ASRC_2, 12, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO3 L ASRC", 1, RT5677_ASRC_1, 15, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO3 R ASRC", 1, RT5677_ASRC_1, 14, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO4 L ASRC", 1, RT5677_ASRC_1, 13, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DAC MONO4 R ASRC", 1, RT5677_ASRC_1, 12, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC STO1 ASRC", 1, RT5677_ASRC_2, 11, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC STO2 ASRC", 1, RT5677_ASRC_2, 10, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC STO3 ASRC", 1, RT5677_ASRC_2, 9, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC STO4 ASRC", 1, RT5677_ASRC_2, 8, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC MONO L ASRC", 1, RT5677_ASRC_2, 7, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("DMIC MONO R ASRC", 1, RT5677_ASRC_2, 6, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC STO1 ASRC", 1, RT5677_ASRC_2, 5, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC STO2 ASRC", 1, RT5677_ASRC_2, 4, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC STO3 ASRC", 1, RT5677_ASRC_2, 3, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC STO4 ASRC", 1, RT5677_ASRC_2, 2, 0, NULL, 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC MONO L ASRC", 1, RT5677_ASRC_2, 1, 0, NULL,
++ 0),
++ SND_SOC_DAPM_SUPPLY_S("ADC MONO R ASRC", 1, RT5677_ASRC_2, 0, 0, NULL,
++ 0),
/* Input Side */
/* micbias */