Skip to contentSkip to conversation

ASoC: Intel: boards: Add Cometlake machine driver support

PATCH Superseded [email protected] 3 participants 6 messages Aug 8, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Intel: boards: Add Cometlake machine driver support

From: Mac Chiang <[email protected]>

reuse and add Cometlake support with:
SSP0 for DA7219 headphone codec
SSP1 for MAX98357a speaker amp codec

---
 sound/soc/intel/boards/Kconfig                    | 15 +++++++++
 sound/soc/intel/boards/bxt_da7219_max98357a.c     | 37 ++++++++++++++++++++++-
 sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 12 ++++++++
 sound/soc/intel/common/soc-intel-quirks.h         |  5 +++
 4 files changed, 68 insertions(+), 1 deletion(-)
sound/soc/intel/boards/Kconfig +15 -0
index 50bf149..617d63c 100644
@@ -256,6 +256,21 @@ config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH
 
 endif ## SND_SOC_INTEL_SKL
 
+config SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+	tristate
+	select SND_SOC_DA7219
+	select SND_SOC_MAX98357A
+	select SND_SOC_DMIC
+	select SND_SOC_HDAC_HDMI
+
+if SND_SOC_SOF_COMETLAKE_LP
+config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH
+	tristate "CML_LP with DA7219 and MAX98357A in I2S Mode"
+	depends on I2C && ACPI
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+endif
+
 if SND_SOC_INTEL_APL
 
 config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH
sound/soc/intel/boards/bxt_da7219_max98357a.c +36 -1
index c0d865a..e5941ff 100644
@@ -24,6 +24,8 @@
 
 #define BXT_DIALOG_CODEC_DAI	"da7219-hifi"
 #define BXT_MAXIM_CODEC_DAI	"HiFi"
+#define MCLK_19M	19200000
+#define MCLK_24M	24576000
 #define DUAL_CHANNEL		2
 #define QUAD_CHANNEL		4
 
@@ -181,8 +183,13 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_component *component = rtd->codec_dai->component;
 
 	/* Configure sysclk for codec */
-	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 19200000,
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, MCLK_19M,
 				     SND_SOC_CLOCK_IN);
+#else
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, MCLK_24M,
+				     SND_SOC_CLOCK_IN);
+#endif
 	if (ret) {
 		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
 		return ret;
@@ -224,7 +231,11 @@ static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 	if (!pcm)
 		return -ENOMEM;
 
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
 	pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
+#else
+	pcm->device = dai->id;
+#endif
 	pcm->codec_dai = dai;
 
 	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
@@ -683,6 +694,27 @@ static int broxton_audio_probe(struct platform_device *pdev)
 				broxton_dais[i].cpus->dai_name = "SSP2 Pin";
 			}
 		}
+	} else if (soc_intel_is_cml()) {
+		unsigned int i;
+
+		broxton_audio_card.name = "cmlda7219max";
+
+		for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
+			/* MAXIM_CODEC is connected to SSP1. */
+			if (!strcmp(broxton_dais[i].codecs->dai_name,
+					BXT_MAXIM_CODEC_DAI)) {
+				broxton_dais[i].id = 1;
+				broxton_dais[i].name = "SSP1-Codec";
+				broxton_dais[i].cpus->dai_name = "SSP1 Pin";
+			}
+			/* DIALOG_CODEC is connected to SSP0 */
+			else if (!strcmp(broxton_dais[i].codecs->dai_name,
+					BXT_DIALOG_CODEC_DAI)) {
+				broxton_dais[i].id = 0;
+				broxton_dais[i].name = "SSP0-Codec";
+				broxton_dais[i].cpus->dai_name = "SSP0 Pin";
+			}
+		}
 	}
 
 	/* override plaform name, if required */
@@ -700,6 +732,7 @@ static int broxton_audio_probe(struct platform_device *pdev)
 static const struct platform_device_id bxt_board_ids[] = {
 	{ .name = "bxt_da7219_max98357a" },
 	{ .name = "glk_da7219_max98357a" },
+	{ .name = "cml_da7219_max98357a" },
 	{ }
 };
 
@@ -720,6 +753,8 @@ MODULE_AUTHOR("Rohit Ainapure <[email protected]>");
 MODULE_AUTHOR("Harsha Priya <[email protected]>");
 MODULE_AUTHOR("Conrad Cooke <[email protected]>");
 MODULE_AUTHOR("Naveen Manohar <[email protected]>");
+MODULE_AUTHOR("Mac Chiang <[email protected]>");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:bxt_da7219_max98357a");
 MODULE_ALIAS("platform:glk_da7219_max98357a");
+MODULE_ALIAS("platform:cml_da7219_max98357a");
sound/soc/intel/common/soc-acpi-intel-cnl-match.c +12 -0
index c36c0aa..4ea32b2 100644
@@ -19,6 +19,11 @@ static struct snd_soc_acpi_codecs cml_codecs = {
 	.codecs = {"10EC5682"}
 };
 
+static struct snd_soc_acpi_codecs cml_spk_codecs = {
+	.num_codecs = 1,
+	.codecs = {"MX98357A"}
+};
+
 struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 	{
 		.id = "INT34C2",
@@ -29,6 +34,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 		.sof_tplg_filename = "sof-cnl-rt274.tplg",
 	},
 	{
+		.id = "DLGS7219",
+		.drv_name = "cml_da7219_max98357a",
+		.quirk_data = &cml_spk_codecs,
+		.sof_fw_filename = "sof-cnl.ri",
+		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
+	},
+	{
 		.id = "MX98357A",
 		.drv_name = "sof_rt5682",
 		.quirk_data = &cml_codecs,
sound/soc/intel/common/soc-intel-quirks.h +5 -0
index 4718fd3..e6357d3 100644
@@ -36,6 +36,7 @@ SOC_INTEL_IS_CPU(byt, INTEL_FAM6_ATOM_SILVERMONT);
 SOC_INTEL_IS_CPU(cht, INTEL_FAM6_ATOM_AIRMONT);
 SOC_INTEL_IS_CPU(apl, INTEL_FAM6_ATOM_GOLDMONT);
 SOC_INTEL_IS_CPU(glk, INTEL_FAM6_ATOM_GOLDMONT_PLUS);
+SOC_INTEL_IS_CPU(cml, INTEL_FAM6_KABYLAKE_MOBILE);
 
 static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
 {
@@ -110,6 +111,10 @@ static inline bool soc_intel_is_glk(void)
 	return false;
 }
 
+static inline bool soc_intel_is_cml(void)
+{
+	return false;
+}
 #endif
 
  #endif /* _SND_SOC_INTEL_QUIRKS_H */
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · On 8/8/19 2:58 AM, [email protected] wrote:

From: Mac Chiang <[email protected]>

reuse and add Cometlake support with:
SSP0 for DA7219 headphone codec
SSP1 for MAX98357a speaker amp codec

Thanks, this is a good improvement compared to the previous version, but there are a couple of fixes needed, see comments below. -Pierre

Quoted 14 lines
---
  sound/soc/intel/boards/Kconfig                    | 15 +++++++++
  sound/soc/intel/boards/bxt_da7219_max98357a.c     | 37 ++++++++++++++++++++++-
  sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 12 ++++++++
  sound/soc/intel/common/soc-intel-quirks.h         |  5 +++
  4 files changed, 68 insertions(+), 1 deletion(-)
sound/soc/intel/boards/Kconfig +0 -0
index 50bf149..617d63c 100644

sound/soc/intel/boards/Kconfig config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH · line 264

Quoted 9 lines
sound/soc/intel/boards/Kconfig +6 -0
@@ -256,6 +256,21 @@ config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH
 
  endif ## SND_SOC_INTEL_SKL
 
+config SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+	tristate
+	select SND_SOC_DA7219
+	select SND_SOC_MAX98357A
+	select SND_SOC_DMIC
+	select SND_SOC_HDAC_HDMI

This should be used in the other cases as well.

sound/soc/intel/boards/Kconfig config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH · line 266

Quoted 2 lines
sound/soc/intel/boards/Kconfig +2 -0
+
+if SND_SOC_SOF_COMETLAKE_LP

we probably need to check that the HDA link is enabled as done for APL

Also try to put CML after GLK/CNL, we try to have a semi-historical platform order, and there is no good reason to show CML before APL.

Quoted 15 lines
sound/soc/intel/boards/Kconfig +7 -0
+config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH
+	tristate "CML_LP with DA7219 and MAX98357A in I2S Mode"
+	depends on I2C && ACPI
+	depends on MFD_INTEL_LPSS || COMPILE_TEST
+	select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+endif
+
  if SND_SOC_INTEL_APL
 
  config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH
sound/soc/intel/boards/bxt_da7219_max98357a.c +0 -0
index c0d865a..e5941ff 100644

sound/soc/intel/boards/bxt_da7219_max98357a.c line 28

Quoted 5 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +2 -0
@@ -24,6 +24,8 @@
 
  #define BXT_DIALOG_CODEC_DAI	"da7219-hifi"
  #define BXT_MAXIM_CODEC_DAI	"HiFi"
+#define MCLK_19M	19200000
+#define MCLK_24M	24576000

Oh, this is suspicious. If this is the oscillator frequency, then this is 24.0 MHz.

Quoted 5 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +0 -0
  #define DUAL_CHANNEL		2
  #define QUAD_CHANNEL		4
 
@@ -181,8 +183,13 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
  	struct snd_soc_component *component = rtd->codec_dai->component;

sound/soc/intel/boards/bxt_da7219_max98357a.c static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) · line 192

Quoted 10 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +6 -1
 
  	/* Configure sysclk for codec */
-	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, 19200000,
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, MCLK_19M,
  				     SND_SOC_CLOCK_IN);
+#else
+	ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK, MCLK_24M,
+				     SND_SOC_CLOCK_IN);
+#endif

No, this needs to be a dynamic selection based on the platform, not a preprocessor define that will be evaluated at build time. Otherwise if we have a distribution that compiles support for BXT/GLK/CML_H then it will select 24M even for BXT/GLK.

sound/soc/intel/boards/bxt_da7219_max98357a.c static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd) · line 238

Quoted 12 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +4 -0
  	if (ret) {
  		dev_err(rtd->dev, "can't set codec sysclk configuration\n");
  		return ret;
@@ -224,7 +231,11 @@ static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
  	if (!pcm)
  		return -ENOMEM;
 
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
  	pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
+#else
+	pcm->device = dai->id;
+#endif

same here, this needs to be based on a quirk evaluated at run-time. I actually don't know why there should be any difference here?

Quoted 91 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +24 -0
  	pcm->codec_dai = dai;
 
  	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
@@ -683,6 +694,27 @@ static int broxton_audio_probe(struct platform_device *pdev)
  				broxton_dais[i].cpus->dai_name = "SSP2 Pin";
  			}
  		}
+	} else if (soc_intel_is_cml()) {
+		unsigned int i;
+
+		broxton_audio_card.name = "cmlda7219max";
+
+		for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
+			/* MAXIM_CODEC is connected to SSP1. */
+			if (!strcmp(broxton_dais[i].codecs->dai_name,
+					BXT_MAXIM_CODEC_DAI)) {
+				broxton_dais[i].id = 1;
+				broxton_dais[i].name = "SSP1-Codec";
+				broxton_dais[i].cpus->dai_name = "SSP1 Pin";
+			}
+			/* DIALOG_CODEC is connected to SSP0 */
+			else if (!strcmp(broxton_dais[i].codecs->dai_name,
+					BXT_DIALOG_CODEC_DAI)) {
+				broxton_dais[i].id = 0;
+				broxton_dais[i].name = "SSP0-Codec";
+				broxton_dais[i].cpus->dai_name = "SSP0 Pin";
+			}
+		}
  	}
 
  	/* override plaform name, if required */
@@ -700,6 +732,7 @@ static int broxton_audio_probe(struct platform_device *pdev)
  static const struct platform_device_id bxt_board_ids[] = {
  	{ .name = "bxt_da7219_max98357a" },
  	{ .name = "glk_da7219_max98357a" },
+	{ .name = "cml_da7219_max98357a" },
  	{ }
  };
 
@@ -720,6 +753,8 @@ MODULE_AUTHOR("Rohit Ainapure <[email protected]>");
  MODULE_AUTHOR("Harsha Priya <[email protected]>");
  MODULE_AUTHOR("Conrad Cooke <[email protected]>");
  MODULE_AUTHOR("Naveen Manohar <[email protected]>");
+MODULE_AUTHOR("Mac Chiang <[email protected]>");
  MODULE_LICENSE("GPL v2");
  MODULE_ALIAS("platform:bxt_da7219_max98357a");
  MODULE_ALIAS("platform:glk_da7219_max98357a");
+MODULE_ALIAS("platform:cml_da7219_max98357a");
sound/soc/intel/common/soc-acpi-intel-cnl-match.c +12 -0
index c36c0aa..4ea32b2 100644
@@ -19,6 +19,11 @@ static struct snd_soc_acpi_codecs cml_codecs = {
  	.codecs = {"10EC5682"}
  };
 
+static struct snd_soc_acpi_codecs cml_spk_codecs = {
+	.num_codecs = 1,
+	.codecs = {"MX98357A"}
+};
+
  struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
  	{
  		.id = "INT34C2",
@@ -29,6 +34,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
  		.sof_tplg_filename = "sof-cnl-rt274.tplg",
  	},
  	{
+		.id = "DLGS7219",
+		.drv_name = "cml_da7219_max98357a",
+		.quirk_data = &cml_spk_codecs,
+		.sof_fw_filename = "sof-cnl.ri",
+		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
+	},
+	{
  		.id = "MX98357A",
  		.drv_name = "sof_rt5682",
  		.quirk_data = &cml_codecs,
sound/soc/intel/common/soc-intel-quirks.h +1 -0
index 4718fd3..e6357d3 100644
@@ -36,6 +36,7 @@ SOC_INTEL_IS_CPU(byt, INTEL_FAM6_ATOM_SILVERMONT);
  SOC_INTEL_IS_CPU(cht, INTEL_FAM6_ATOM_AIRMONT);
  SOC_INTEL_IS_CPU(apl, INTEL_FAM6_ATOM_GOLDMONT);
  SOC_INTEL_IS_CPU(glk, INTEL_FAM6_ATOM_GOLDMONT_PLUS);
+SOC_INTEL_IS_CPU(cml, INTEL_FAM6_KABYLAKE_MOBILE);
 
  static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
  {

sound/soc/intel/common/soc-intel-quirks.h static inline bool soc_intel_is_glk(void) · line 120

Quoted 10 lines
sound/soc/intel/common/soc-intel-quirks.h +4 -0
@@ -110,6 +111,10 @@ static inline bool soc_intel_is_glk(void)
  	return false;
  }
 
+static inline bool soc_intel_is_cml(void)
+{
+	return false;
+}
  #endif
 
   #endif /* _SND_SOC_INTEL_QUIRKS_H */

Humm, which branch does this apply against? It's not in Mark's tree nor in the SOF tree, so how did you test this?

I remember submitting this quirk suggestion but it was not approved upstream, or needed more work (this was before I dropped everything to work on SoundWire). You may have to do this manually for now with the cpu_id method, and we'll replace it later with a better solution.

#2 lore raw
Quoted 24 lines
Quoted 13 lines
sound/soc/intel/common/soc-intel-quirks.h +1 -0
index 4718fd3..e6357d3 100644
@@ -36,6 +36,7 @@ SOC_INTEL_IS_CPU(byt, INTEL_FAM6_ATOM_SILVERMONT);
   SOC_INTEL_IS_CPU(cht, INTEL_FAM6_ATOM_AIRMONT);
   SOC_INTEL_IS_CPU(apl, INTEL_FAM6_ATOM_GOLDMONT);
   SOC_INTEL_IS_CPU(glk, INTEL_FAM6_ATOM_GOLDMONT_PLUS);
+SOC_INTEL_IS_CPU(cml, INTEL_FAM6_KABYLAKE_MOBILE);
   static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
   {

sound/soc/intel/common/soc-intel-quirks.h static inline bool soc_intel_is_glk(void) · line 118

Quoted 8 lines
sound/soc/intel/common/soc-intel-quirks.h +4 -0
@@ -110,6 +111,10 @@ static inline bool soc_intel_is_glk(void)
       return false;
   }
+static inline bool soc_intel_is_cml(void)
+{
+    return false;
+}
   #endif
    #endif /* _SND_SOC_INTEL_QUIRKS_H */

Humm, which branch does this apply against? It's not in Mark's tree nor in the SOF tree, so how did you test this?

Quoted 1 line

I remember submitting this quirk suggestion but it was not approved upstream, or needed more work (this was before I dropped everything to work on SoundWire). You may have to do this manually for now with the cpu_id method, and we'll replace it later with a better solution.

Please ignore this last comment, I need more coffee before reviewing. The code was indeed merged...
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
In reply to [email protected]
Quoted 117 lines · On Thu, Aug 8, 2019 at 1:00 AM <[email protected]> wrote:

From: Mac Chiang <[email protected]>

reuse and add Cometlake support with:
SSP0 for DA7219 headphone codec
SSP1 for MAX98357a speaker amp codec

---
 sound/soc/intel/boards/Kconfig                    | 15 +++++++++
 sound/soc/intel/boards/bxt_da7219_max98357a.c     | 37
++++++++++++++++++++++-
 sound/soc/intel/common/soc-acpi-intel-cnl-match.c | 12 ++++++++
 sound/soc/intel/common/soc-intel-quirks.h         |  5 +++
 4 files changed, 68 insertions(+), 1 deletion(-)
sound/soc/intel/boards/Kconfig +15 -0
index 50bf149..617d63c 100644
@@ -256,6 +256,21 @@ config SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH
 
 endif ## SND_SOC_INTEL_SKL
 
+config SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+       tristate
+       select SND_SOC_DA7219
+       select SND_SOC_MAX98357A
+       select SND_SOC_DMIC
+       select SND_SOC_HDAC_HDMI
+
+if SND_SOC_SOF_COMETLAKE_LP
+config SND_SOC_INTEL_CML_LP_DA7219_MAX98357A_MACH
+       tristate "CML_LP with DA7219 and MAX98357A in I2S Mode"
+       depends on I2C && ACPI
+       depends on MFD_INTEL_LPSS || COMPILE_TEST
+       select SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
+endif
+
 if SND_SOC_INTEL_APL
 
 config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH
sound/soc/intel/boards/bxt_da7219_max98357a.c +6 -1
index c0d865a..e5941ff 100644
@@ -24,6 +24,8 @@
 
 #define BXT_DIALOG_CODEC_DAI   "da7219-hifi"
 #define BXT_MAXIM_CODEC_DAI    "HiFi"
+#define MCLK_19M       19200000
+#define MCLK_24M       24576000
 #define DUAL_CHANNEL           2
 #define QUAD_CHANNEL           4
 
@@ -181,8 +183,13 @@ static int broxton_da7219_codec_init(struct
 snd_soc_pcm_runtime *rtd)
        struct snd_soc_component *component = rtd->codec_dai->component;
 
        /* Configure sysclk for codec */
-       ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,
 19200000,
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
+       ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,
 MCLK_19M,
                                     SND_SOC_CLOCK_IN);
+#else
+       ret = snd_soc_dai_set_sysclk(codec_dai, DA7219_CLKSRC_MCLK,

MCLK_24M,

sound/soc/intel/boards/bxt_da7219_max98357a.c +2 -0
+                                    SND_SOC_CLOCK_IN);
+#endif
        if (ret) {
                dev_err(rtd->dev, "can't set codec sysclk
configuration\n");
                return ret;
sound/soc/intel/boards/bxt_da7219_max98357a.c +4 -0
@@ -224,7 +231,11 @@ static int broxton_hdmi_init(struct
 snd_soc_pcm_runtime *rtd)
        if (!pcm)
                return -ENOMEM;
 
+#if !IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
        pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
+#else
+       pcm->device = dai->id;
+#endif
        pcm->codec_dai = dai;
 
        list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
sound/soc/intel/boards/bxt_da7219_max98357a.c +19 -0
@@ -683,6 +694,27 @@ static int broxton_audio_probe(struct platform_device
 *pdev)
                                broxton_dais[i].cpus->dai_name = "SSP2
 Pin";
                        }
                }
+       } else if (soc_intel_is_cml()) {
+               unsigned int i;
+
+               broxton_audio_card.name = "cmlda7219max";
+
+               for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
+                       /* MAXIM_CODEC is connected to SSP1. */
+                       if (!strcmp(broxton_dais[i].codecs->dai_name,
+                                       BXT_MAXIM_CODEC_DAI)) {
+                               broxton_dais[i].id = 1;
+                               broxton_dais[i].name = "SSP1-Codec";
+                               broxton_dais[i].cpus->dai_name = "SSP1
 Pin";
+                       }
+                       /* DIALOG_CODEC is connected to SSP0 */
+                       else if (!strcmp(broxton_dais[i].codecs->dai_name,
+                                       BXT_DIALOG_CODEC_DAI)) {
+                               broxton_dais[i].id = 0;
+                               broxton_dais[i].name = "SSP0-Codec";
+                               broxton_dais[i].cpus->dai_name = "SSP0

Pin";

sound/soc/intel/boards/bxt_da7219_max98357a.c static int broxton_audio_probe(struct platform_device *pdev) · line 718

Quoted 3 lines
sound/soc/intel/boards/bxt_da7219_max98357a.c +2 -0
+                       }
+               }
        }

Would it be possible to keep the ID's unchanged? Its quite confusing with so many platforms reusing the machine driver so it would help if the changes are minimal.
I understand why you want to change the ID's but it would be simpler to just use the existing ID's in topology I think.

Thanks,
Ranjani

#4 lore raw
Quoted 28 lines
    +       } else if (soc_intel_is_cml()) {
    +               unsigned int i;
    +
    + broxton_audio_card.name <http://broxton_audio_card.name> =
    "cmlda7219max";
    +
    +               for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
    +                       /* MAXIM_CODEC is connected to SSP1. */
    +                       if (!strcmp(broxton_dais[i].codecs->dai_name,
    +                                       BXT_MAXIM_CODEC_DAI)) {
    +                               broxton_dais[i].id = 1;
    +                               broxton_dais[i].name = "SSP1-Codec";
    +                               broxton_dais[i].cpus->dai_name =
    "SSP1 Pin";
    +                       }
    +                       /* DIALOG_CODEC is connected to SSP0 */
    +                       else if
    (!strcmp(broxton_dais[i].codecs->dai_name,
    +                                       BXT_DIALOG_CODEC_DAI)) {
    +                               broxton_dais[i].id = 0;
    +                               broxton_dais[i].name = "SSP0-Codec";
    +                               broxton_dais[i].cpus->dai_name =
    "SSP0 Pin";
    +                       }
    +               }
             }
Quoted 2 lines

Would it be possible to keep the ID's unchanged? Its quite confusing with so many platforms reusing the machine driver so it would help if the changes are minimal. I understand why you want to change the ID's but it would be simpler to just use the existing ID's in topology I think.

Ranjani, just to avoid confusion here, what 'ID' are you referring to?

I can see that in the existing GLK code (copied below) the .id field is not touched, only the name and dai_name are changed, is this what you were hinting at?

	if (soc_intel_is_glk()) {
		unsigned int i;

		broxton_audio_card.name = "glkda7219max";
		/* Fixup the SSP entries for geminilake */
		for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
			/* MAXIM_CODEC is connected to SSP1. */
			if (!strcmp(broxton_dais[i].codecs->dai_name,
				    BXT_MAXIM_CODEC_DAI)) {
				broxton_dais[i].name = "SSP1-Codec";
				broxton_dais[i].cpus->dai_name = "SSP1 Pin";
			}
			/* DIALOG_CODE is connected to SSP2 */
			else if (!strcmp(broxton_dais[i].codecs->dai_name,
					 BXT_DIALOG_CODEC_DAI)) {
				broxton_dais[i].name = "SSP2-Codec";
				broxton_dais[i].cpus->dai_name = "SSP2 Pin";
			}
		}
	}

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw
Quoted 34 lines · Pierre-Louis Bossart
Quoted 28 lines

+ } else if (soc_intel_is_cml()) {
+ unsigned int i;
+
+ broxton_audio_card.name <http://broxton_audio_card.name> = "cmlda7219max";
+
+ for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
+ /* MAXIM_CODEC is connected to SSP1. */
+ if (!strcmp(broxton_dais[i].codecs->dai_name,
+ BXT_MAXIM_CODEC_DAI)) {
+ broxton_dais[i].id = 1;
+ broxton_dais[i].name = "SSP1-Codec";
+ broxton_dais[i].cpus->dai_name =
"SSP1 Pin";
+ }
+ /* DIALOG_CODEC is connected to SSP0 */
+ else if
(!strcmp(broxton_dais[i].codecs->dai_name,
+ BXT_DIALOG_CODEC_DAI)) {
+ broxton_dais[i].id = 0;
+ broxton_dais[i].name = "SSP0-Codec";
+ broxton_dais[i].cpus->dai_name =
"SSP0 Pin";
+ }
+ }
}

Quoted 5 lines

Would it be possible to keep the ID's unchanged? Its quite confusing with so many platforms reusing the machine driver so it would help if the changes are minimal.
I understand why you want to change the ID's but it would be simpler to just use the existing ID's in topology I think.

Quoted 7 lines

Ranjani, just to avoid confusion here, what 'ID' are you referring to?

I can see that in the existing GLK code (copied below) the .id field is not touched, only the name and dai_name are changed, is this what you were hinting at?

Yes, Pierre. The DAI link ID's as defined in broxton_dais[]. I guess Mac's intention was to keep them ordered for by SSP port numbers but it is not really necessary to do that. The ID in the topology can be changed to match the ID in the machine driver.

Thanks,
Ranjani

Quoted 25 lines
        if (soc_intel_is_glk()) {
                unsigned int i;

                broxton_audio_card.name = "glkda7219max";
                /* Fixup the SSP entries for geminilake */
                for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
                        /* MAXIM_CODEC is connected to SSP1. */
                        if (!strcmp(broxton_dais[i].codecs->dai_name,
                                    BXT_MAXIM_CODEC_DAI)) {
                                broxton_dais[i].name = "SSP1-Codec";
                                broxton_dais[i].cpus->dai_name = "SSP1
Pin";
                        }
                        /* DIALOG_CODE is connected to SSP2 */
                        else if (!strcmp(broxton_dais[i].codecs->dai_name,
                                         BXT_DIALOG_CODEC_DAI)) {
                                broxton_dais[i].name = "SSP2-Codec";
                                broxton_dais[i].cpus->dai_name = "SSP2
Pin";
                        }
                }
        }