From: Mark Brown Date: Wed, 4 Feb 2015 20:57:17 +0000 (+0000) Subject: Merge remote-tracking branches 'asoc/topic/rockchip', 'asoc/topic/rt5645' and 'asoc... X-Git-Tag: v4.0-rc1~129^2~22^2~4 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=e89817d4af75fed92e03c36427a83357a95dabd3;p=linux.git Merge remote-tracking branches 'asoc/topic/rockchip', 'asoc/topic/rt5645' and 'asoc/topic/rt5677' into asoc-next --- e89817d4af75fed92e03c36427a83357a95dabd3 diff --cc sound/soc/codecs/rt5677.c index 26fc538f03b1,81fe1464d268,81fe1464d268,75d2d73be545..5d0bb8748dd1 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c @@@@@ -923,101 -921,6 -921,6 -924,101 +926,101 @@@@@ static int is_sys_clk_from_pll(struct s return 0; } ++ static int is_using_asrc(struct snd_soc_dapm_widget *source, ++ struct snd_soc_dapm_widget *sink) ++ { - struct snd_soc_codec *codec = source->codec; +++ 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, @@@@@ -2316,50 -2211,9 -2211,9 -2309,48 +2319,50 @@@@@ static int rt5677_vref_event(struct snd 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 */