diff mbox series

[v2] ASoC: Intel: bxt-da7219-max98357a: support MAX98390 speaker amp

Message ID 1593596211-28344-1-git-send-email-brent.lu@intel.com (mailing list archive)
State Accepted
Commit e1435a1feb18e198155d16d3d6b500d46e0625c0
Headers show
Series [v2] ASoC: Intel: bxt-da7219-max98357a: support MAX98390 speaker amp | expand

Commit Message

Brent Lu July 1, 2020, 9:36 a.m. UTC
Support MAX98390 speaker amplifier on cometlake platform. Driver now
detects amplifier type in the probe function and installs corresponding
controls and DAPM widgets/routes in the late_probe function.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/boards/Kconfig                    |   5 +-
 sound/soc/intel/boards/bxt_da7219_max98357a.c     | 117 ++++++++++++++++++++--
 sound/soc/intel/common/soc-acpi-intel-cml-match.c |  13 +++
 3 files changed, 127 insertions(+), 8 deletions(-)

Comments

Pierre-Louis Bossart July 1, 2020, 3:49 p.m. UTC | #1
On 7/1/20 4:36 AM, Brent Lu wrote:
> Support MAX98390 speaker amplifier on cometlake platform. Driver now
> detects amplifier type in the probe function and installs corresponding
> controls and DAPM widgets/routes in the late_probe function.
> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>

Looks good to me know, thanks Brent

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mark Brown July 1, 2020, 10:23 p.m. UTC | #2
On Wed, 1 Jul 2020 17:36:51 +0800, Brent Lu wrote:
> Support MAX98390 speaker amplifier on cometlake platform. Driver now
> detects amplifier type in the probe function and installs corresponding
> controls and DAPM widgets/routes in the late_probe function.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: Intel: bxt-da7219-max98357a: support MAX98390 speaker amp
      commit: e1435a1feb18e198155d16d3d6b500d46e0625c0

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Dan Carpenter July 7, 2020, 1:22 p.m. UTC | #3
Hi Brent,

url:    https://github.com/0day-ci/linux/commits/Brent-Lu/ASoC-Intel-bxt-da7219-max98357a-support-MAX98390-speaker-amp/20200701-174420
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: i386-randconfig-m021-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
sound/soc/intel/boards/bxt_da7219_max98357a.c:683 bxt_card_late_probe() error: uninitialized symbol 'widgets'.
sound/soc/intel/boards/bxt_da7219_max98357a.c:683 bxt_card_late_probe() error: uninitialized symbol 'num_widgets'.
sound/soc/intel/boards/bxt_da7219_max98357a.c:689 bxt_card_late_probe() error: uninitialized symbol 'controls'.
sound/soc/intel/boards/bxt_da7219_max98357a.c:689 bxt_card_late_probe() error: uninitialized symbol 'num_controls'.
sound/soc/intel/boards/bxt_da7219_max98357a.c:695 bxt_card_late_probe() error: uninitialized symbol 'routes'.
sound/soc/intel/boards/bxt_da7219_max98357a.c:695 bxt_card_late_probe() error: uninitialized symbol 'num_routes'.

# https://github.com/0day-ci/linux/commit/27dccaf17142fa2cfe38b279782b1d72aa6dd041
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 27dccaf17142fa2cfe38b279782b1d72aa6dd041
vim +/widgets +683 sound/soc/intel/boards/bxt_da7219_max98357a.c

ba210346779464 Jeeja KP              2017-01-24  650  static int bxt_card_late_probe(struct snd_soc_card *card)
ba210346779464 Jeeja KP              2017-01-24  651  {
ba210346779464 Jeeja KP              2017-01-24  652  	struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card);
ba210346779464 Jeeja KP              2017-01-24  653  	struct bxt_hdmi_pcm *pcm;
4510112217116d Kuninori Morimoto     2018-01-29  654  	struct snd_soc_component *component = NULL;
27dccaf17142fa Brent Lu              2020-07-01  655  	const struct snd_kcontrol_new *controls;
27dccaf17142fa Brent Lu              2020-07-01  656  	const struct snd_soc_dapm_widget *widgets;
27dccaf17142fa Brent Lu              2020-07-01  657  	const struct snd_soc_dapm_route *routes;
27dccaf17142fa Brent Lu              2020-07-01  658  	int num_controls, num_widgets, num_routes, err, i = 0;
625de2bf2ed163 Jeeja KP              2017-02-07  659  	char jack_name[NAME_SIZE];
ba210346779464 Jeeja KP              2017-01-24  660  
27dccaf17142fa Brent Lu              2020-07-01  661  	switch (ctx->spkamp) {
27dccaf17142fa Brent Lu              2020-07-01  662  	case SPKAMP_MAX98357A:
27dccaf17142fa Brent Lu              2020-07-01  663  		controls = max98357a_controls;
27dccaf17142fa Brent Lu              2020-07-01  664  		num_controls = ARRAY_SIZE(max98357a_controls);
27dccaf17142fa Brent Lu              2020-07-01  665  		widgets = max98357a_widgets;
27dccaf17142fa Brent Lu              2020-07-01  666  		num_widgets = ARRAY_SIZE(max98357a_widgets);
27dccaf17142fa Brent Lu              2020-07-01  667  		routes = max98357a_routes;
27dccaf17142fa Brent Lu              2020-07-01  668  		num_routes = ARRAY_SIZE(max98357a_routes);
27dccaf17142fa Brent Lu              2020-07-01  669  		break;
27dccaf17142fa Brent Lu              2020-07-01  670  	case SPKAMP_MAX98390:
27dccaf17142fa Brent Lu              2020-07-01  671  		controls = max98390_controls;
27dccaf17142fa Brent Lu              2020-07-01  672  		num_controls = ARRAY_SIZE(max98390_controls);
27dccaf17142fa Brent Lu              2020-07-01  673  		widgets = max98390_widgets;
27dccaf17142fa Brent Lu              2020-07-01  674  		num_widgets = ARRAY_SIZE(max98390_widgets);
27dccaf17142fa Brent Lu              2020-07-01  675  		routes = max98390_routes;
27dccaf17142fa Brent Lu              2020-07-01  676  		num_routes = ARRAY_SIZE(max98390_routes);
27dccaf17142fa Brent Lu              2020-07-01  677  		break;
27dccaf17142fa Brent Lu              2020-07-01  678  	default:
27dccaf17142fa Brent Lu              2020-07-01  679  		dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp);
27dccaf17142fa Brent Lu              2020-07-01  680  		break;

return -EINVAL; ?

27dccaf17142fa Brent Lu              2020-07-01  681  	}
27dccaf17142fa Brent Lu              2020-07-01  682  
27dccaf17142fa Brent Lu              2020-07-01 @683  	err = snd_soc_dapm_new_controls(&card->dapm, widgets, num_widgets);
27dccaf17142fa Brent Lu              2020-07-01  684  	if (err) {
27dccaf17142fa Brent Lu              2020-07-01  685  		dev_err(card->dev, "Fail to new widgets\n");
27dccaf17142fa Brent Lu              2020-07-01  686  		return err;
27dccaf17142fa Brent Lu              2020-07-01  687  	}
27dccaf17142fa Brent Lu              2020-07-01  688  
27dccaf17142fa Brent Lu              2020-07-01 @689  	err = snd_soc_add_card_controls(card, controls, num_controls);
27dccaf17142fa Brent Lu              2020-07-01  690  	if (err) {
27dccaf17142fa Brent Lu              2020-07-01  691  		dev_err(card->dev, "Fail to add controls\n");
27dccaf17142fa Brent Lu              2020-07-01  692  		return err;
27dccaf17142fa Brent Lu              2020-07-01  693  	}
27dccaf17142fa Brent Lu              2020-07-01  694  
27dccaf17142fa Brent Lu              2020-07-01 @695  	err = snd_soc_dapm_add_routes(&card->dapm, routes, num_routes);
27dccaf17142fa Brent Lu              2020-07-01  696  	if (err) {
27dccaf17142fa Brent Lu              2020-07-01  697  		dev_err(card->dev, "Fail to add routes\n");
27dccaf17142fa Brent Lu              2020-07-01  698  		return err;
27dccaf17142fa Brent Lu              2020-07-01  699  	}
27dccaf17142fa Brent Lu              2020-07-01  700  
536cfd2f375d36 Pierre-Louis Bossart  2019-05-30  701  	if (soc_intel_is_glk())
c011245a197017 Yong Zhi              2019-02-13  702  		snd_soc_dapm_add_routes(&card->dapm, gemini_map,
c011245a197017 Yong Zhi              2019-02-13  703  					ARRAY_SIZE(gemini_map));
c011245a197017 Yong Zhi              2019-02-13  704  	else
c011245a197017 Yong Zhi              2019-02-13  705  		snd_soc_dapm_add_routes(&card->dapm, broxton_map,
c011245a197017 Yong Zhi              2019-02-13  706  					ARRAY_SIZE(broxton_map));
c011245a197017 Yong Zhi              2019-02-13  707  
98ff5c262f27aa Guennadi Liakhovetski 2020-01-24  708  	if (list_empty(&ctx->hdmi_pcm_list))
98ff5c262f27aa Guennadi Liakhovetski 2020-01-24  709  		return -EINVAL;
98ff5c262f27aa Guennadi Liakhovetski 2020-01-24  710  
98ff5c262f27aa Guennadi Liakhovetski 2020-01-24  711  	if (ctx->common_hdmi_codec_drv) {
57ad18906f2427 Kai Vehmanen          2019-10-29  712  		pcm = list_first_entry(&ctx->hdmi_pcm_list, struct bxt_hdmi_pcm,
57ad18906f2427 Kai Vehmanen          2019-10-29  713  				       head);
57ad18906f2427 Kai Vehmanen          2019-10-29  714  		component = pcm->codec_dai->component;
57ad18906f2427 Kai Vehmanen          2019-10-29  715  		return hda_dsp_hdmi_build_controls(card, component);
98ff5c262f27aa Guennadi Liakhovetski 2020-01-24  716  	}
57ad18906f2427 Kai Vehmanen          2019-10-29  717  
ba210346779464 Jeeja KP              2017-01-24  718  	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
4510112217116d Kuninori Morimoto     2018-01-29  719  		component = pcm->codec_dai->component;
625de2bf2ed163 Jeeja KP              2017-02-07  720  		snprintf(jack_name, sizeof(jack_name),
625de2bf2ed163 Jeeja KP              2017-02-07  721  			"HDMI/DP, pcm=%d Jack", pcm->device);
625de2bf2ed163 Jeeja KP              2017-02-07  722  		err = snd_soc_card_jack_new(card, jack_name,
625de2bf2ed163 Jeeja KP              2017-02-07  723  					SND_JACK_AVOUT, &broxton_hdmi[i],
625de2bf2ed163 Jeeja KP              2017-02-07  724  					NULL, 0);
625de2bf2ed163 Jeeja KP              2017-02-07  725  
625de2bf2ed163 Jeeja KP              2017-02-07  726  		if (err)
625de2bf2ed163 Jeeja KP              2017-02-07  727  			return err;
625de2bf2ed163 Jeeja KP              2017-02-07  728  
625de2bf2ed163 Jeeja KP              2017-02-07  729  		err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device,
625de2bf2ed163 Jeeja KP              2017-02-07  730  						&broxton_hdmi[i]);
ba210346779464 Jeeja KP              2017-01-24  731  		if (err < 0)
ba210346779464 Jeeja KP              2017-01-24  732  			return err;
625de2bf2ed163 Jeeja KP              2017-02-07  733  
625de2bf2ed163 Jeeja KP              2017-02-07  734  		i++;
ba210346779464 Jeeja KP              2017-01-24  735  	}
ba210346779464 Jeeja KP              2017-01-24  736  
4510112217116d Kuninori Morimoto     2018-01-29  737  	return hdac_hdmi_jack_port_init(component, &card->dapm);
ba210346779464 Jeeja KP              2017-01-24  738  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Pierre-Louis Bossart July 7, 2020, 3:57 p.m. UTC | #4
> 27dccaf17142fa Brent Lu              2020-07-01  678  	default:
> 27dccaf17142fa Brent Lu              2020-07-01  679  		dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp);
> 27dccaf17142fa Brent Lu              2020-07-01  680  		break;
> 
> return -EINVAL; ?

yes, this was fixed by Colin King on July 2

[PATCH][next] ASoC: Intel: bxt-da7219-max98357a: return -EINVAL on 
unrecognized speaker amplifier
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/Kconfig b/sound/soc/intel/boards/Kconfig
index 3d820e1..f176df2 100644
--- a/sound/soc/intel/boards/Kconfig
+++ b/sound/soc/intel/boards/Kconfig
@@ -288,6 +288,7 @@  config SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
 	tristate
 	select SND_SOC_DA7219
 	select SND_SOC_MAX98357A
+	select SND_SOC_MAX98390
 	select SND_SOC_DMIC
 	select SND_SOC_HDAC_HDMI
 
@@ -298,14 +299,14 @@  config SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON
 if SND_SOC_INTEL_APL
 
 config SND_SOC_INTEL_BXT_DA7219_MAX98357A_MACH
-	tristate "Broxton with DA7219 and MAX98357A in I2S Mode"
+	tristate "Broxton with DA7219 and MAX98357A/MAX98390 in I2S Mode"
 	depends on I2C && ACPI && GPIOLIB
 	depends on MFD_INTEL_LPSS || COMPILE_TEST
 	depends on SND_HDA_CODEC_HDMI
 	select SND_SOC_INTEL_BXT_DA7219_MAX98357A_COMMON
 	help
 	   This adds support for ASoC machine driver for Broxton-P platforms
-	   with DA7219 + MAX98357A I2S audio codec.
+	   with DA7219 + MAX98357A/MAX98390 I2S audio codec.
 	   Say Y or m if you have such a device. This is a recommended option.
 	   If unsure select "N".
 
diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c
index 44016c1..4d39253 100644
--- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
+++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
@@ -25,9 +25,14 @@ 
 
 #define BXT_DIALOG_CODEC_DAI	"da7219-hifi"
 #define BXT_MAXIM_CODEC_DAI	"HiFi"
+#define MAX98390_DEV0_NAME	"i2c-MX98390:00"
+#define MAX98390_DEV1_NAME	"i2c-MX98390:01"
 #define DUAL_CHANNEL		2
 #define QUAD_CHANNEL		4
 
+#define SPKAMP_MAX98357A	1
+#define SPKAMP_MAX98390	2
+
 static struct snd_soc_jack broxton_headset;
 static struct snd_soc_jack broxton_hdmi[3];
 
@@ -40,6 +45,7 @@  struct bxt_hdmi_pcm {
 struct bxt_card_private {
 	struct list_head hdmi_pcm_list;
 	bool common_hdmi_codec_drv;
+	int spkamp;
 };
 
 enum {
@@ -85,13 +91,20 @@  static int platform_clock_control(struct snd_soc_dapm_widget *w,
 static const struct snd_kcontrol_new broxton_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone Jack"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
+};
+
+static const struct snd_kcontrol_new max98357a_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Spk"),
 };
 
+static const struct snd_kcontrol_new max98390_controls[] = {
+	SOC_DAPM_PIN_SWITCH("Left Spk"),
+	SOC_DAPM_PIN_SWITCH("Right Spk"),
+};
+
 static const struct snd_soc_dapm_widget broxton_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone Jack", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
-	SND_SOC_DAPM_SPK("Spk", NULL),
 	SND_SOC_DAPM_MIC("SoC DMIC", NULL),
 	SND_SOC_DAPM_SPK("HDMI1", NULL),
 	SND_SOC_DAPM_SPK("HDMI2", NULL),
@@ -100,14 +113,20 @@  static const struct snd_soc_dapm_widget broxton_widgets[] = {
 			platform_clock_control,	SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU),
 };
 
+static const struct snd_soc_dapm_widget max98357a_widgets[] = {
+	SND_SOC_DAPM_SPK("Spk", NULL),
+};
+
+static const struct snd_soc_dapm_widget max98390_widgets[] = {
+	SND_SOC_DAPM_SPK("Left Spk", NULL),
+	SND_SOC_DAPM_SPK("Right Spk", NULL),
+};
+
 static const struct snd_soc_dapm_route audio_map[] = {
 	/* HP jack connectors - unknown if we have jack detection */
 	{"Headphone Jack", NULL, "HPL"},
 	{"Headphone Jack", NULL, "HPR"},
 
-	/* speaker */
-	{"Spk", NULL, "Speaker"},
-
 	/* other jacks */
 	{"MIC", NULL, "Headset Mic"},
 
@@ -134,6 +153,17 @@  static const struct snd_soc_dapm_route audio_map[] = {
 	{ "Headset Mic", NULL, "Platform Clock" },
 };
 
+static const struct snd_soc_dapm_route max98357a_routes[] = {
+	/* speaker */
+	{"Spk", NULL, "Speaker"},
+};
+
+static const struct snd_soc_dapm_route max98390_routes[] = {
+	/* Speaker */
+	{"Left Spk", NULL, "Left BE_OUT"},
+	{"Right Spk", NULL, "Right BE_OUT"},
+};
+
 static const struct snd_soc_dapm_route broxton_map[] = {
 	{"HiFi Playback", NULL, "ssp5 Tx"},
 	{"ssp5 Tx", NULL, "codec0_out"},
@@ -404,6 +434,10 @@  SND_SOC_DAILINK_DEF(ssp5_pin,
 SND_SOC_DAILINK_DEF(ssp5_codec,
 	DAILINK_COMP_ARRAY(COMP_CODEC("MX98357A:00",
 				      BXT_MAXIM_CODEC_DAI)));
+SND_SOC_DAILINK_DEF(max98390_codec,
+	DAILINK_COMP_ARRAY(
+	/* Left */	COMP_CODEC(MAX98390_DEV0_NAME, "max98390-aif1"),
+	/* Right */	COMP_CODEC(MAX98390_DEV1_NAME, "max98390-aif1")));
 
 SND_SOC_DAILINK_DEF(ssp1_pin,
 	DAILINK_COMP_ARRAY(COMP_CPU("SSP1 Pin")));
@@ -601,15 +635,69 @@  static struct snd_soc_dai_link broxton_dais[] = {
 	},
 };
 
+static struct snd_soc_codec_conf max98390_codec_confs[] = {
+	{
+		.dlc = COMP_CODEC_CONF(MAX98390_DEV0_NAME),
+		.name_prefix = "Left",
+	},
+	{
+		.dlc = COMP_CODEC_CONF(MAX98390_DEV1_NAME),
+		.name_prefix = "Right",
+	},
+};
+
 #define NAME_SIZE	32
 static int bxt_card_late_probe(struct snd_soc_card *card)
 {
 	struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card);
 	struct bxt_hdmi_pcm *pcm;
 	struct snd_soc_component *component = NULL;
-	int err, i = 0;
+	const struct snd_kcontrol_new *controls;
+	const struct snd_soc_dapm_widget *widgets;
+	const struct snd_soc_dapm_route *routes;
+	int num_controls, num_widgets, num_routes, err, i = 0;
 	char jack_name[NAME_SIZE];
 
+	switch (ctx->spkamp) {
+	case SPKAMP_MAX98357A:
+		controls = max98357a_controls;
+		num_controls = ARRAY_SIZE(max98357a_controls);
+		widgets = max98357a_widgets;
+		num_widgets = ARRAY_SIZE(max98357a_widgets);
+		routes = max98357a_routes;
+		num_routes = ARRAY_SIZE(max98357a_routes);
+		break;
+	case SPKAMP_MAX98390:
+		controls = max98390_controls;
+		num_controls = ARRAY_SIZE(max98390_controls);
+		widgets = max98390_widgets;
+		num_widgets = ARRAY_SIZE(max98390_widgets);
+		routes = max98390_routes;
+		num_routes = ARRAY_SIZE(max98390_routes);
+		break;
+	default:
+		dev_err(card->dev, "Invalid speaker amplifier %d\n", ctx->spkamp);
+		break;
+	}
+
+	err = snd_soc_dapm_new_controls(&card->dapm, widgets, num_widgets);
+	if (err) {
+		dev_err(card->dev, "Fail to new widgets\n");
+		return err;
+	}
+
+	err = snd_soc_add_card_controls(card, controls, num_controls);
+	if (err) {
+		dev_err(card->dev, "Fail to add controls\n");
+		return err;
+	}
+
+	err = snd_soc_dapm_add_routes(&card->dapm, routes, num_routes);
+	if (err) {
+		dev_err(card->dev, "Fail to add routes\n");
+		return err;
+	}
+
 	if (soc_intel_is_glk())
 		snd_soc_dapm_add_routes(&card->dapm, gemini_map,
 					ARRAY_SIZE(gemini_map));
@@ -678,6 +766,11 @@  static int broxton_audio_probe(struct platform_device *pdev)
 
 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
 
+	if (acpi_dev_present("MX98390", NULL, -1))
+		ctx->spkamp = SPKAMP_MAX98390;
+	else
+		ctx->spkamp = SPKAMP_MAX98357A;
+
 	broxton_audio_card.dev = &pdev->dev;
 	snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
 	if (soc_intel_is_glk()) {
@@ -702,7 +795,13 @@  static int broxton_audio_probe(struct platform_device *pdev)
 	} else if (soc_intel_is_cml()) {
 		unsigned int i;
 
-		broxton_audio_card.name = "cmlda7219max";
+		if (ctx->spkamp == SPKAMP_MAX98390) {
+			broxton_audio_card.name = "cml_max98390_da7219";
+
+			broxton_audio_card.codec_conf = max98390_codec_confs;
+			broxton_audio_card.num_configs = ARRAY_SIZE(max98390_codec_confs);
+		} else
+			broxton_audio_card.name = "cmlda7219max";
 
 		for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
 			/* MAXIM_CODEC is connected to SSP1. */
@@ -710,6 +809,11 @@  static int broxton_audio_probe(struct platform_device *pdev)
 					BXT_MAXIM_CODEC_DAI)) {
 				broxton_dais[i].name = "SSP1-Codec";
 				broxton_dais[i].cpus->dai_name = "SSP1 Pin";
+
+				if (ctx->spkamp == SPKAMP_MAX98390) {
+					broxton_dais[i].codecs = max98390_codec;
+					broxton_dais[i].num_codecs = ARRAY_SIZE(max98390_codec);
+				}
 			}
 			/* DIALOG_CODEC is connected to SSP0 */
 			else if (!strcmp(broxton_dais[i].codecs->dai_name,
@@ -759,6 +863,7 @@  MODULE_AUTHOR("Harsha Priya <harshapriya.n@intel.com>");
 MODULE_AUTHOR("Conrad Cooke <conrad.cooke@intel.com>");
 MODULE_AUTHOR("Naveen Manohar <naveen.m@intel.com>");
 MODULE_AUTHOR("Mac Chiang <mac.chiang@intel.com>");
+MODULE_AUTHOR("Brent Lu <brent.lu@intel.com>");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:bxt_da7219_max98357a");
 MODULE_ALIAS("platform:glk_da7219_max98357a");
diff --git a/sound/soc/intel/common/soc-acpi-intel-cml-match.c b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
index cdea0c0..dee1f0f 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cml-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
@@ -19,6 +19,11 @@  static struct snd_soc_acpi_codecs max98357a_spk_codecs = {
 	.codecs = {"MX98357A"}
 };
 
+static struct snd_soc_acpi_codecs max98390_spk_codecs = {
+	.num_codecs = 1,
+	.codecs = {"MX98390"}
+};
+
 /*
  * The order of the three entries with .id = "10EC5682" matters
  * here, because DSDT tables expose an ACPI HID for the MAX98357A
@@ -55,6 +60,14 @@  struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
 		.sof_fw_filename = "sof-cml.ri",
 		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
 	},
+	{
+		.id = "DLGS7219",
+		.drv_name = "cml_da7219_max98357a",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &max98390_spk_codecs,
+		.sof_fw_filename = "sof-cml.ri",
+		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
+	},
 	{},
 };
 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);