ASoC: Intel: cht-bsw-rt5645: select ASRC source based on routing quirk
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 26 Jan 2017 20:09:44 +0000 (14:09 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 31 Jan 2017 20:14:07 +0000 (20:14 +0000)
Some platforms use AIF2, use routing information to set ASRC as needed

Suggested-by: Bard Liao <bardliao@realtek.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=95681
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/cht_bsw_rt5645.c

index 24b07601fb8119f1be6af79c4e9e57794f7d7d34..b175eee5d416db212de233475f93278afee0f47d 100644 (file)
@@ -265,13 +265,24 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
        struct snd_soc_dai *codec_dai = runtime->codec_dai;
        struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
 
-       /* Select clk_i2s1_asrc as ASRC clock source */
-       rt5645_sel_asrc_clk_src(codec,
-                               RT5645_DA_STEREO_FILTER |
-                               RT5645_DA_MONO_L_FILTER |
-                               RT5645_DA_MONO_R_FILTER |
-                               RT5645_AD_STEREO_FILTER,
-                               RT5645_CLK_SEL_I2S1_ASRC);
+       if ((cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) ||
+           (cht_rt5645_quirk & CHT_RT5645_SSP0_AIF2)) {
+               /* Select clk_i2s2_asrc as ASRC clock source */
+               rt5645_sel_asrc_clk_src(codec,
+                                       RT5645_DA_STEREO_FILTER |
+                                       RT5645_DA_MONO_L_FILTER |
+                                       RT5645_DA_MONO_R_FILTER |
+                                       RT5645_AD_STEREO_FILTER,
+                                       RT5645_CLK_SEL_I2S2_ASRC);
+       } else {
+               /* Select clk_i2s1_asrc as ASRC clock source */
+               rt5645_sel_asrc_clk_src(codec,
+                                       RT5645_DA_STEREO_FILTER |
+                                       RT5645_DA_MONO_L_FILTER |
+                                       RT5645_DA_MONO_R_FILTER |
+                                       RT5645_AD_STEREO_FILTER,
+                                       RT5645_CLK_SEL_I2S1_ASRC);
+       }
 
        if (cht_rt5645_quirk & CHT_RT5645_SSP2_AIF2) {
                ret = snd_soc_dapm_add_routes(&card->dapm,