aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2016-08-12 17:27:51 -0400
committerMark Brown <broonie@kernel.org>2016-08-15 10:14:57 -0400
commitf47088d5ae6bec6d01bb0fd71c7d113aa8eaaa27 (patch)
tree4594a065b5375e32fc879e3dbdd278b86d86e1e4 /sound
parent89b8907ce28fce3e34240e7668c9704880bf3368 (diff)
ASoC: Intel: bytcr_rt56040: additional routing quirks
Allow for all possible combinations of SSP0,SSP2, AIF1, AIF2 combination (only one at a time) Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 6c6f67356c99..4337b5e85921 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -43,6 +43,8 @@ enum {
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#define BYT_RT5640_SSP2_AIF2 BIT(19) /* default is using AIF1 */
46#define BYT_RT5640_SSP0_AIF1 BIT(20)
47#define BYT_RT5640_SSP0_AIF2 BIT(21)
46 48
47static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP | 49static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
48 BYT_RT5640_DMIC_EN; 50 BYT_RT5640_DMIC_EN;
@@ -94,6 +96,22 @@ static const struct snd_soc_dapm_route byt_rt5640_ssp2_aif2_map[] = {
94 {"ssp2 Rx", NULL, "AIF2 Capture"}, 96 {"ssp2 Rx", NULL, "AIF2 Capture"},
95}; 97};
96 98
99static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif1_map[] = {
100 {"ssp0 Tx", NULL, "modem_out"},
101 {"modem_in", NULL, "ssp0 Rx"},
102
103 {"AIF1 Playback", NULL, "ssp0 Tx"},
104 {"ssp0 Rx", NULL, "AIF1 Capture"},
105};
106
107static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] = {
108 {"ssp0 Tx", NULL, "modem_out"},
109 {"modem_in", NULL, "ssp0 Rx"},
110
111 {"AIF2 Playback", NULL, "ssp0 Tx"},
112 {"ssp0 Rx", NULL, "AIF2 Capture"},
113};
114
97static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { 115static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = {
98 {"Speaker", NULL, "SPOLP"}, 116 {"Speaker", NULL, "SPOLP"},
99 {"Speaker", NULL, "SPOLN"}, 117 {"Speaker", NULL, "SPOLN"},
@@ -231,6 +249,14 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
231 ret = snd_soc_dapm_add_routes(&card->dapm, 249 ret = snd_soc_dapm_add_routes(&card->dapm,
232 byt_rt5640_ssp2_aif2_map, 250 byt_rt5640_ssp2_aif2_map,
233 ARRAY_SIZE(byt_rt5640_ssp2_aif2_map)); 251 ARRAY_SIZE(byt_rt5640_ssp2_aif2_map));
252 } else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) {
253 ret = snd_soc_dapm_add_routes(&card->dapm,
254 byt_rt5640_ssp0_aif1_map,
255 ARRAY_SIZE(byt_rt5640_ssp0_aif1_map));
256 } else if (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2) {
257 ret = snd_soc_dapm_add_routes(&card->dapm,
258 byt_rt5640_ssp0_aif2_map,
259 ARRAY_SIZE(byt_rt5640_ssp0_aif2_map));
234 } else { 260 } else {
235 ret = snd_soc_dapm_add_routes(&card->dapm, 261 ret = snd_soc_dapm_add_routes(&card->dapm,
236 byt_rt5640_ssp2_aif1_map, 262 byt_rt5640_ssp2_aif1_map,
@@ -369,7 +395,7 @@ static struct snd_soc_dai_link byt_rt5640_dais[] = {
369 { 395 {
370 .name = "SSP2-Codec", 396 .name = "SSP2-Codec",
371 .id = 1, 397 .id = 1,
372 .cpu_dai_name = "ssp2-port", 398 .cpu_dai_name = "ssp2-port", /* overwritten for ssp0 routing */
373 .platform_name = "sst-mfld-platform", 399 .platform_name = "sst-mfld-platform",
374 .no_pcm = 1, 400 .no_pcm = 1,
375 .codec_dai_name = "rt5640-aif1", /* changed w/ quirk */ 401 .codec_dai_name = "rt5640-aif1", /* changed w/ quirk */
@@ -400,6 +426,7 @@ static struct snd_soc_card byt_rt5640_card = {
400 426
401static char byt_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */ 427static 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]" */ 428static char byt_rt5640_codec_aif_name[12]; /* = "rt5640-aif[1|2]" */
429static char byt_rt5640_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
403 430
404static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) 431static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
405{ 432{
@@ -434,7 +461,8 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
434 /* check quirks before creating card */ 461 /* check quirks before creating card */
435 dmi_check_system(byt_rt5640_quirk_table); 462 dmi_check_system(byt_rt5640_quirk_table);
436 463
437 if (byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) { 464 if ((byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) ||
465 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2)) {
438 466
439 /* fixup codec aif name */ 467 /* fixup codec aif name */
440 snprintf(byt_rt5640_codec_aif_name, 468 snprintf(byt_rt5640_codec_aif_name,
@@ -445,6 +473,18 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
445 byt_rt5640_codec_aif_name; 473 byt_rt5640_codec_aif_name;
446 } 474 }
447 475
476 if ((byt_rt5640_quirk & BYT_RT5640_SSP0_AIF1) ||
477 (byt_rt5640_quirk & BYT_RT5640_SSP0_AIF2)) {
478
479 /* fixup cpu dai name name */
480 snprintf(byt_rt5640_cpu_dai_name,
481 sizeof(byt_rt5640_cpu_dai_name),
482 "%s", "ssp0-port");
483
484 byt_rt5640_dais[dai_index].cpu_dai_name =
485 byt_rt5640_cpu_dai_name;
486 }
487
448 ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card); 488 ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
449 489
450 if (ret_val) { 490 if (ret_val) {