aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2016-08-12 17:27:50 -0400
committerMark Brown <broonie@kernel.org>2016-08-15 10:14:57 -0400
commit89b8907ce28fce3e34240e7668c9704880bf3368 (patch)
treef3edc5f6880a674512e47961e081664b4353aad4 /sound/soc/intel
parenta3f10de1843ab6a37d34d1601cc520498c5d3bc9 (diff)
ASoC: Intel: bytcr_rt5640: add SSP2_AIF2 routing
Add quirk to model routing on Baytrail-CR devices Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel')
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c54
1 files changed, 46 insertions, 8 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 085e57f95fb2..6c6f67356c99 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -42,6 +42,7 @@ enum {
42#define BYT_RT5640_DMIC_EN BIT(16) 42#define BYT_RT5640_DMIC_EN BIT(16)
43#define BYT_RT5640_MONO_SPEAKER BIT(17) 43#define BYT_RT5640_MONO_SPEAKER BIT(17)
44#define BYT_RT5640_DIFF_MIC BIT(18) /* defaut is single-ended */ 44#define BYT_RT5640_DIFF_MIC BIT(18) /* defaut is single-ended */
45#define BYT_RT5640_SSP2_AIF2 BIT(19) /* default is using AIF1 */
45 46
46static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP | 47static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
47 BYT_RT5640_DMIC_EN; 48 BYT_RT5640_DMIC_EN;
@@ -54,13 +55,6 @@ static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
54}; 55};
55 56
56static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { 57static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = {
57 {"AIF1 Playback", NULL, "ssp2 Tx"},
58 {"ssp2 Tx", NULL, "codec_out0"},
59 {"ssp2 Tx", NULL, "codec_out1"},
60 {"codec_in0", NULL, "ssp2 Rx"},
61 {"codec_in1", NULL, "ssp2 Rx"},
62 {"ssp2 Rx", NULL, "AIF1 Capture"},
63
64 {"Headset Mic", NULL, "MICBIAS1"}, 58 {"Headset Mic", NULL, "MICBIAS1"},
65 {"IN2P", NULL, "Headset Mic"}, 59 {"IN2P", NULL, "Headset Mic"},
66 {"Headphone", NULL, "HPOL"}, 60 {"Headphone", NULL, "HPOL"},
@@ -80,6 +74,26 @@ static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = {
80 {"IN1P", NULL, "Internal Mic"}, 74 {"IN1P", NULL, "Internal Mic"},
81}; 75};
82 76
77static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif1_map[] = {
78 {"ssp2 Tx", NULL, "codec_out0"},
79 {"ssp2 Tx", NULL, "codec_out1"},
80 {"codec_in0", NULL, "ssp2 Rx"},
81 {"codec_in1", NULL, "ssp2 Rx"},
82
83 {"AIF1 Playback", NULL, "ssp2 Tx"},
84 {"ssp2 Rx", NULL, "AIF1 Capture"},
85};
86
87static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif2_map[] = {
88 {"ssp2 Tx", NULL, "codec_out0"},
89 {"ssp2 Tx", NULL, "codec_out1"},
90 {"codec_in0", NULL, "ssp2 Rx"},
91 {"codec_in1", NULL, "ssp2 Rx"},
92
93 {"AIF2 Playback", NULL, "ssp2 Tx"},
94 {"ssp2 Rx", NULL, "AIF2 Capture"},
95};
96
83static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { 97static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = {
84 {"Speaker", NULL, "SPOLP"}, 98 {"Speaker", NULL, "SPOLP"},
85 {"Speaker", NULL, "SPOLN"}, 99 {"Speaker", NULL, "SPOLN"},
@@ -213,6 +227,18 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
213 if (ret) 227 if (ret)
214 return ret; 228 return ret;
215 229
230 if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
231 ret = snd_soc_dapm_add_routes(&card->dapm,
232 byt_rt5640_ssp2_aif2_map,
233 ARRAY_SIZE(byt_rt5640_ssp2_aif2_map));
234 } else {
235 ret = snd_soc_dapm_add_routes(&card->dapm,
236 byt_rt5640_ssp2_aif1_map,
237 ARRAY_SIZE(byt_rt5640_ssp2_aif1_map));
238 }
239 if (ret)
240 return ret;
241
216 if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) { 242 if (byt_rt5640_quirk & BYT_RT5640_MONO_SPEAKER) {
217 ret = snd_soc_dapm_add_routes(&card->dapm, 243 ret = snd_soc_dapm_add_routes(&card->dapm,
218 byt_rt5640_mono_spk_map, 244 byt_rt5640_mono_spk_map,
@@ -346,7 +372,7 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = {
346 .cpu_dai_name = "ssp2-port", 372 .cpu_dai_name = "ssp2-port",
347 .platform_name = "sst-mfld-platform", 373 .platform_name = "sst-mfld-platform",
348 .no_pcm = 1, 374 .no_pcm = 1,
349 .codec_dai_name = "rt5640-aif1", 375 .codec_dai_name = "rt5640-aif1", /* changed w/ quirk */
350 .codec_name = "i2c-10EC5640:00", /* overwritten with HID */ 376 .codec_name = "i2c-10EC5640:00", /* overwritten with HID */
351 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 377 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
352 | SND_SOC_DAIFMT_CBS_CFS, 378 | SND_SOC_DAIFMT_CBS_CFS,
@@ -373,6 +399,7 @@ static struct snd_soc_card byt_rt5640_card = {
373}; 399};
374 400
375static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 401static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
402static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
376 403
377static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) 404static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
378{ 405{
@@ -407,6 +434,17 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
407 /* check quirks before creating card */ 434 /* check quirks before creating card */
408 dmi_check_system(byt_rt5640_quirk_table); 435 dmi_check_system(byt_rt5640_quirk_table);
409 436
437 if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) {
438
439 /* fixup codec aif name */
440 snprintf(byt_rt5640_codec_aif_name,
441 sizeof(byt_rt5640_codec_aif_name),
442 "%s", "rt5640-aif2");
443
444 byt_rt5640_dais[dai_index].codec_dai_name =
445 byt_rt5640_codec_aif_name;
446 }
447
410 ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card); 448 ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
411 449
412 if (ret_val) { 450 if (ret_val) {