Skip to contentSkip to conversation

ASoC: Intel: machine drivers for SOF

PATCH New Pierre-Louis Bossart 1 participant 4 messages Apr 30, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: Intel: machine drivers for SOF

Add support for the two main machine drivers used by SOF (not tested with the Skylake driver due to lack of hardware and/or firmware signature/ missing topology)

The DMIC support for HDaudio-based devices is very much needed for a number of WhiskyLake+ platforms designed for Windows. SOF will be the only Intel driver supporting this configuration. A firmware binary signed with the required production key should be available shortly.

The rt5682 codec is the main validation vehicle of the Intel SOF team, with eval boards connected to the Baytrail MinnowBoard as well as more recent devices. The main difference with traditional Intel machine drivers is that the dai links are added dynamically at probe time to avoid multiple table copy/pastes.

Bard liao (1):
ASoC: Intel: add sof-rt5682 machine driver

Rander Wang (2):
ASoC: Intel: skl_hda_dsp_generic: add DMIC support
ASoC: Intel: skl_hda_dsp_generic:refine code style

 sound/soc/intel/boards/Kconfig                |  16 +
 sound/soc/intel/boards/Makefile               |   2 +
 sound/soc/intel/boards/skl_hda_dsp_common.c   |  22 +-
 sound/soc/intel/boards/skl_hda_dsp_common.h   |   2 +-
 sound/soc/intel/boards/skl_hda_dsp_generic.c  |  19 +-
 sound/soc/intel/boards/sof_rt5682.c           | 563 ++++++++++++++++++
 .../intel/common/soc-acpi-intel-byt-match.c   |   6 +
 .../intel/common/soc-acpi-intel-cht-match.c   |   6 +
 .../intel/common/soc-acpi-intel-cnl-match.c   |  19 +
 .../intel/common/soc-acpi-intel-icl-match.c   |   6 +
 10 files changed, 656 insertions(+), 5 deletions(-)
 create mode 100644 sound/soc/intel/boards/sof_rt5682.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 ASoC: Intel: skl_hda_dsp_generic: add DMIC support

From: Rander Wang <[email protected]>

Add dmic dai links using naming conventions used in previous machine drivers.

Tested on whiskylake & icelake with SOF driver. Due to a missing topology file, the DMIC functionality could not be tested with the Skylake driver but was tested for non-regressions on a GeminiLake platform without DMICs.

---
 sound/soc/intel/boards/skl_hda_dsp_common.c  | 22 ++++++++++++++++++--
 sound/soc/intel/boards/skl_hda_dsp_common.h  |  2 +-
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 17 ++++++++++++++-
 3 files changed, 37 insertions(+), 4 deletions(-)
sound/soc/intel/boards/skl_hda_dsp_common.c +20 -2
index 3fdbf239da74..8b68f41a5b88 100644
@@ -78,7 +78,6 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
 		.platform_name = "0000:00:1f.3",
 		.dpcm_playback = 1,
 		.dpcm_capture = 1,
-		.init = NULL,
 		.no_pcm = 1,
 	},
 	{
@@ -90,7 +89,26 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
 		.platform_name = "0000:00:1f.3",
 		.dpcm_playback = 1,
 		.dpcm_capture = 1,
-		.init = NULL,
+		.no_pcm = 1,
+	},
+	{
+		.name = "dmic01",
+		.id = 6,
+		.cpu_dai_name = "DMIC01 Pin",
+		.codec_name = "dmic-codec",
+		.codec_dai_name = "dmic-hifi",
+		.platform_name = "0000:00:1f.3",
+		.dpcm_capture = 1,
+		.no_pcm = 1,
+	},
+	{
+		.name = "dmic16k",
+		.id = 7,
+		.cpu_dai_name = "DMIC16k Pin",
+		.codec_name = "dmic-codec",
+		.codec_dai_name = "dmic-hifi",
+		.platform_name = "0000:00:1f.3",
+		.dpcm_capture = 1,
 		.no_pcm = 1,
 	},
 };
sound/soc/intel/boards/skl_hda_dsp_common.h +1 -1
index 87c50aff56cd..daa582e513b2 100644
@@ -15,7 +15,7 @@
 #include <sound/core.h>
 #include <sound/jack.h>
 
-#define HDA_DSP_MAX_BE_DAI_LINKS 5
+#define HDA_DSP_MAX_BE_DAI_LINKS 7
 
 struct skl_hda_hdmi_pcm {
 	struct list_head head;
sound/soc/intel/boards/skl_hda_dsp_generic.c +16 -1
index b9a21e64ead2..e69dc36b6600 100644
@@ -97,6 +97,9 @@ static struct snd_soc_card hda_soc_card = {
 };
 
 #define IDISP_DAI_COUNT		3
+#define HDAC_DAI_COUNT		2
+#define DMIC_DAI_COUNT		2
+
 /* there are two routes per iDisp output */
 #define IDISP_ROUTE_COUNT	(IDISP_DAI_COUNT * 2)
 #define IDISP_CODEC_MASK	0x4
@@ -112,8 +115,20 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
 	codec_count = hweight_long(codec_mask);
 
 	if (codec_count == 1 && codec_mask & IDISP_CODEC_MASK) {
-		num_links = IDISP_DAI_COUNT;
+		num_links = IDISP_DAI_COUNT + DMIC_DAI_COUNT;
 		num_route = IDISP_ROUTE_COUNT;
+
+		/*
+		 * rearrange the dai link array and make the
+		 * dmic dai links follow idsp dai links for only
+		 * num_links of dai links need to be registered
+		 * to ASoC.
+		 */
+		for (i = 0; i < DMIC_DAI_COUNT; i++) {
+			skl_hda_be_dai_links[IDISP_DAI_COUNT + i] =
+				skl_hda_be_dai_links[IDISP_DAI_COUNT +
+					HDAC_DAI_COUNT + i];
+		}
 	} else if (codec_count == 2 && codec_mask & IDISP_CODEC_MASK) {
 		num_links = ARRAY_SIZE(skl_hda_be_dai_links);
 		num_route = ARRAY_SIZE(skl_hda_map),
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 ASoC: Intel: skl_hda_dsp_generic:refine code style

In reply to Pierre-Louis Bossart

From: Rander Wang <[email protected]>

Semicolon is better than comma.

---
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/skl_hda_dsp_generic.c +1 -1
index e69dc36b6600..fc52d3a32354 100644
@@ -131,7 +131,7 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
 		}
 	} else if (codec_count == 2 && codec_mask & IDISP_CODEC_MASK) {
 		num_links = ARRAY_SIZE(skl_hda_be_dai_links);
-		num_route = ARRAY_SIZE(skl_hda_map),
+		num_route = ARRAY_SIZE(skl_hda_map);
 		card->dapm_widgets = skl_hda_widgets;
 		card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
 	} else {
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 ASoC: Intel: add sof-rt5682 machine driver

In reply to Pierre-Louis Bossart

From: Bard liao <[email protected]>

The machine driver is a generic machine driver for SOF with rt5682 codec. it currently supports BYT/CHT/ICL/CML. Depending on the SOC hdmi/speaker and DMIC support are added dynamically.

Only add information related to SOF since the machine driver was only tested with SOF.

---
 sound/soc/intel/boards/Kconfig                |  16 +
 sound/soc/intel/boards/Makefile               |   2 +
 sound/soc/intel/boards/sof_rt5682.c           | 563 ++++++++++++++++++
 .../intel/common/soc-acpi-intel-byt-match.c   |   6 +
 .../intel/common/soc-acpi-intel-cht-match.c   |   6 +
 .../intel/common/soc-acpi-intel-cnl-match.c   |  19 +
 .../intel/common/soc-acpi-intel-icl-match.c   |   6 +
 7 files changed, 618 insertions(+)
 create mode 100644 sound/soc/intel/boards/sof_rt5682.c
sound/soc/intel/boards/Kconfig +16 -0
index bf6d7a11f94a..61cb398d544f 100644
@@ -354,4 +354,20 @@ config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
 
 endif ## SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC || SND_SOC_SOF_HDA_AUDIO_CODEC
 
+if SND_SOC_SOF_HDA_COMMON || SND_SOC_SOF_BAYTRAIL
+config SND_SOC_INTEL_SOF_RT5682_MACH
+	tristate "SOF with rt5682 codec in I2S Mode"
+	depends on I2C && ACPI
+	depends on (SND_SOC_SOF_HDA_COMMON && MFD_INTEL_LPSS) ||\
+		   (SND_SOC_SOF_BAYTRAIL && X86_INTEL_LPSS)
+	select SND_SOC_RT5682
+	select SND_SOC_DMIC
+	select SND_SOC_HDAC_HDMI if SND_SOC_SOF_HDA_COMMON
+	help
+	   This adds support for ASoC machine driver for SOF platforms
+	   with rt5682 codec.
+	   Say Y if you have such a device.
+	   If unsure select "N".
+endif ## SND_SOC_SOF_HDA_COMMON || SND_SOC_SOF_BAYTRAIL
+
 endif ## SND_SOC_INTEL_MACH
sound/soc/intel/boards/Makefile +2 -0
index bf072ea299b7..451b3bd7d9c5 100644
@@ -16,6 +16,7 @@ snd-soc-sst-cht-bsw-nau8824-objs := cht_bsw_nau8824.o
 snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o
 snd-soc-sst-byt-cht-es8316-objs := bytcht_es8316.o
 snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o
+snd-soc-sof_rt5682-objs := sof_rt5682.o
 snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
 snd-soc-kbl_da7219_max98927-objs := kbl_da7219_max98927.o
 snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o
@@ -26,6 +27,7 @@ snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o
 snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
 snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
 
+obj-$(CONFIG_SND_SOC_INTEL_SOF_RT5682_MACH) += snd-soc-sof_rt5682.o
 obj-$(CONFIG_SND_SOC_INTEL_HASWELL_MACH) += snd-soc-sst-haswell.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_RT5640_MACH) += snd-soc-sst-byt-rt5640-mach.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_MAX98090_MACH) += snd-soc-sst-byt-max98090-mach.o
sound/soc/intel/boards/sof_rt5682.c new file +563 -0

563 lines not on this page · raw message

sound/soc/intel/common/soc-acpi-intel-byt-match.c +6 -0
index fe812a909db4..0cfab247876a 100644
@@ -185,6 +185,12 @@ struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
 		.sof_fw_filename = "sof-byt.ri",
 		.sof_tplg_filename = "sof-byt-es8316.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "sof_rt5682",
+		.sof_fw_filename = "sof-byt.ri",
+		.sof_tplg_filename = "sof-byt-rt5682.tplg",
+	},
 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
 	{
 		.id = "10EC5645",
sound/soc/intel/common/soc-acpi-intel-cht-match.c +6 -0
index deafd87cc764..ff9c31a39ad4 100644
@@ -160,6 +160,12 @@ struct snd_soc_acpi_mach  snd_soc_acpi_intel_cherrytrail_machines[] = {
 		.sof_fw_filename = "sof-cht.ri",
 		.sof_tplg_filename = "sof-cht-rt5640.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "sof_rt5682",
+		.sof_fw_filename = "sof-cht.ri",
+		.sof_tplg_filename = "sof-cht-rt5682.tplg",
+	},
 	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
 	{
 		.id = "10EC5651",
sound/soc/intel/common/soc-acpi-intel-cnl-match.c +19 -0
index a914dd238d0a..df7c52cad5c3 100644
@@ -14,6 +14,11 @@ static struct skl_machine_pdata cnl_pdata = {
 	.use_tplg_pcm = true,
 };
 
+static struct snd_soc_acpi_codecs cml_codecs = {
+	.num_codecs = 1,
+	.codecs = {"10EC5682"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 	{
 		.id = "INT34C2",
@@ -23,6 +28,20 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 		.sof_fw_filename = "sof-cnl.ri",
 		.sof_tplg_filename = "sof-cnl-rt274.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "sof_rt5682",
+		.sof_fw_filename = "sof-cnl.ri",
+		.sof_tplg_filename = "sof-cml-rt5682.tplg",
+	},
+	{
+		.id = "MX98357A",
+		.drv_name = "sof_rt5682",
+		.quirk_data = &cml_codecs,
+		.sof_fw_filename = "sof-cnl.ri",
+		.sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg",
+	},
+
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cnl_machines);
sound/soc/intel/common/soc-acpi-intel-icl-match.c +6 -0
index e5a6be5bc0ee..0b430b9b3673 100644
@@ -23,6 +23,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[] = {
 		.sof_fw_filename = "sof-icl.ri",
 		.sof_tplg_filename = "sof-icl-rt274.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "sof_rt5682",
+		.sof_fw_filename = "sof-icl.ri",
+		.sof_tplg_filename = "sof-icl-rt5682.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_machines);
Signature · 1 line
2.17.1