summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorYong Zhi <yong.zhi@intel.com>2019-02-13 18:08:52 -0500
committerMark Brown <broonie@kernel.org>2019-02-19 10:42:16 -0500
commitc011245a197017f8e9e9d140b658bdb2b702a0c5 (patch)
treeb4d3c57c9fb6caa1a24b947f5690222e619ae948 /sound
parent9dd9b210f8c6104690ba48a630bbe9af2f32c292 (diff)
ASoC: Intel: Add Geminilake Dialog Maxim machine driver
This patch enables support for GeminiLake with the DA7219 codec and MAX98357A amplifier. To avoid duplicating code, the existing machine driver for ApolloLake is reused with only changes in hardware connectivity (SSP2 for DA7219 and SSP1 for MAX98357A). The dailinks are directly modified in this patch. Using a helper would be nicer, but it'll be done in a follow-up step with validation done across multiple machine drivers. Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Yong Zhi <yong.zhi@intel.com> Signed-off-by: Naveen Manohar <naveen.m@intel.com> Signed-off-by: Harsha Priya <harshapriya.n@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/boards/bxt_da7219_max98357a.c79
1 files changed, 67 insertions, 12 deletions
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c
index 30311b81a543..407b0cfc5167 100644
--- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
+++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
@@ -16,6 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 */ 17 */
18 18
19#include <asm/cpu_device_id.h>
19#include <linux/input.h> 20#include <linux/input.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
@@ -104,7 +105,7 @@ static const struct snd_soc_dapm_widget broxton_widgets[] = {
104 platform_clock_control, SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU), 105 platform_clock_control, SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU),
105}; 106};
106 107
107static const struct snd_soc_dapm_route broxton_map[] = { 108static const struct snd_soc_dapm_route audio_map[] = {
108 /* HP jack connectors - unknown if we have jack detection */ 109 /* HP jack connectors - unknown if we have jack detection */
109 {"Headphone Jack", NULL, "HPL"}, 110 {"Headphone Jack", NULL, "HPL"},
110 {"Headphone Jack", NULL, "HPR"}, 111 {"Headphone Jack", NULL, "HPR"},
@@ -119,15 +120,6 @@ static const struct snd_soc_dapm_route broxton_map[] = {
119 {"DMic", NULL, "SoC DMIC"}, 120 {"DMic", NULL, "SoC DMIC"},
120 121
121 /* CODEC BE connections */ 122 /* CODEC BE connections */
122 {"HiFi Playback", NULL, "ssp5 Tx"},
123 {"ssp5 Tx", NULL, "codec0_out"},
124
125 {"Playback", NULL, "ssp1 Tx"},
126 {"ssp1 Tx", NULL, "codec1_out"},
127
128 {"codec0_in", NULL, "ssp1 Rx"},
129 {"ssp1 Rx", NULL, "Capture"},
130
131 {"HDMI1", NULL, "hif5-0 Output"}, 123 {"HDMI1", NULL, "hif5-0 Output"},
132 {"HDMI2", NULL, "hif6-0 Output"}, 124 {"HDMI2", NULL, "hif6-0 Output"},
133 {"HDMI2", NULL, "hif7-0 Output"}, 125 {"HDMI2", NULL, "hif7-0 Output"},
@@ -147,6 +139,28 @@ static const struct snd_soc_dapm_route broxton_map[] = {
147 { "Headset Mic", NULL, "Platform Clock" }, 139 { "Headset Mic", NULL, "Platform Clock" },
148}; 140};
149 141
142static const struct snd_soc_dapm_route broxton_map[] = {
143 {"HiFi Playback", NULL, "ssp5 Tx"},
144 {"ssp5 Tx", NULL, "codec0_out"},
145
146 {"Playback", NULL, "ssp1 Tx"},
147 {"ssp1 Tx", NULL, "codec1_out"},
148
149 {"codec0_in", NULL, "ssp1 Rx"},
150 {"ssp1 Rx", NULL, "Capture"},
151};
152
153static const struct snd_soc_dapm_route gemini_map[] = {
154 {"HiFi Playback", NULL, "ssp1 Tx"},
155 {"ssp1 Tx", NULL, "codec0_out"},
156
157 {"Playback", NULL, "ssp2 Tx"},
158 {"ssp2 Tx", NULL, "codec1_out"},
159
160 {"codec0_in", NULL, "ssp2 Rx"},
161 {"ssp2 Rx", NULL, "Capture"},
162};
163
150static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd, 164static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
151 struct snd_pcm_hw_params *params) 165 struct snd_pcm_hw_params *params)
152{ 166{
@@ -539,6 +553,11 @@ static struct snd_soc_dai_link broxton_dais[] = {
539 }, 553 },
540}; 554};
541 555
556static const struct x86_cpu_id glk_ids[] = {
557 { X86_VENDOR_INTEL, 6, 0x7A }, /* Geminilake CPU_ID */
558 {}
559};
560
542#define NAME_SIZE 32 561#define NAME_SIZE 32
543static int bxt_card_late_probe(struct snd_soc_card *card) 562static int bxt_card_late_probe(struct snd_soc_card *card)
544{ 563{
@@ -548,6 +567,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card)
548 int err, i = 0; 567 int err, i = 0;
549 char jack_name[NAME_SIZE]; 568 char jack_name[NAME_SIZE];
550 569
570 if (x86_match_cpu(glk_ids))
571 snd_soc_dapm_add_routes(&card->dapm, gemini_map,
572 ARRAY_SIZE(gemini_map));
573 else
574 snd_soc_dapm_add_routes(&card->dapm, broxton_map,
575 ARRAY_SIZE(broxton_map));
576
551 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { 577 list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
552 component = pcm->codec_dai->component; 578 component = pcm->codec_dai->component;
553 snprintf(jack_name, sizeof(jack_name), 579 snprintf(jack_name, sizeof(jack_name),
@@ -583,8 +609,8 @@ static struct snd_soc_card broxton_audio_card = {
583 .num_controls = ARRAY_SIZE(broxton_controls), 609 .num_controls = ARRAY_SIZE(broxton_controls),
584 .dapm_widgets = broxton_widgets, 610 .dapm_widgets = broxton_widgets,
585 .num_dapm_widgets = ARRAY_SIZE(broxton_widgets), 611 .num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
586 .dapm_routes = broxton_map, 612 .dapm_routes = audio_map,
587 .num_dapm_routes = ARRAY_SIZE(broxton_map), 613 .num_dapm_routes = ARRAY_SIZE(audio_map),
588 .fully_routed = true, 614 .fully_routed = true,
589 .late_probe = bxt_card_late_probe, 615 .late_probe = bxt_card_late_probe,
590}; 616};
@@ -604,6 +630,26 @@ static int broxton_audio_probe(struct platform_device *pdev)
604 630
605 broxton_audio_card.dev = &pdev->dev; 631 broxton_audio_card.dev = &pdev->dev;
606 snd_soc_card_set_drvdata(&broxton_audio_card, ctx); 632 snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
633 if (x86_match_cpu(glk_ids)) {
634 unsigned int i;
635
636 broxton_audio_card.name = "glkda7219max";
637 /* Fixup the SSP entries for geminilake */
638 for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
639 /* MAXIM_CODEC is connected to SSP1. */
640 if (!strcmp(broxton_dais[i].codec_dai_name,
641 BXT_MAXIM_CODEC_DAI)) {
642 broxton_dais[i].name = "SSP1-Codec";
643 broxton_dais[i].cpu_dai_name = "SSP1 Pin";
644 }
645 /* DIALOG_CODE is connected to SSP2 */
646 else if (!strcmp(broxton_dais[i].codec_dai_name,
647 BXT_DIALOG_CODEC_DAI)) {
648 broxton_dais[i].name = "SSP2-Codec";
649 broxton_dais[i].cpu_dai_name = "SSP2 Pin";
650 }
651 }
652 }
607 653
608 /* override plaform name, if required */ 654 /* override plaform name, if required */
609 mach = (&pdev->dev)->platform_data; 655 mach = (&pdev->dev)->platform_data;
@@ -617,12 +663,19 @@ static int broxton_audio_probe(struct platform_device *pdev)
617 return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card); 663 return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
618} 664}
619 665
666static const struct platform_device_id bxt_board_ids[] = {
667 { .name = "bxt_da7219_max98357a" },
668 { .name = "glk_da7219_max98357a" },
669 { }
670};
671
620static struct platform_driver broxton_audio = { 672static struct platform_driver broxton_audio = {
621 .probe = broxton_audio_probe, 673 .probe = broxton_audio_probe,
622 .driver = { 674 .driver = {
623 .name = "bxt_da7219_max98357a", 675 .name = "bxt_da7219_max98357a",
624 .pm = &snd_soc_pm_ops, 676 .pm = &snd_soc_pm_ops,
625 }, 677 },
678 .id_table = bxt_board_ids,
626}; 679};
627module_platform_driver(broxton_audio) 680module_platform_driver(broxton_audio)
628 681
@@ -632,5 +685,7 @@ MODULE_AUTHOR("Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>");
632MODULE_AUTHOR("Rohit Ainapure <rohit.m.ainapure@intel.com>"); 685MODULE_AUTHOR("Rohit Ainapure <rohit.m.ainapure@intel.com>");
633MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>"); 686MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
634MODULE_AUTHOR("Conrad Cooke <conrad.cooke@intel.com>"); 687MODULE_AUTHOR("Conrad Cooke <conrad.cooke@intel.com>");
688MODULE_AUTHOR("Naveen Manohar <naveen.m@intel.com>");
635MODULE_LICENSE("GPL v2"); 689MODULE_LICENSE("GPL v2");
636MODULE_ALIAS("platform:bxt_da7219_max98357a"); 690MODULE_ALIAS("platform:bxt_da7219_max98357a");
691MODULE_ALIAS("platform:glk_da7219_max98357a");