Skip to contentSkip to conversation

ASoc: Intel: glk_rt5682_max98357a: support ALC5682I-VS codec

PATCH Superseded Brent Lu 2 participants 3 messages Oct 28, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Brent Lu

author
#0 lore raw

PATCH 1/1 ASoc: Intel: glk_rt5682_max98357a: support ALC5682I-VS codec

Detect the codec variant in probe function and update DAI link accordingly. Also add an new entry in enumeration table for machine driver enumeration.

---
 sound/soc/intel/boards/Kconfig                |  1 +
 sound/soc/intel/boards/glk_rt5682_max98357a.c | 53 +++++++++++++++----
 .../intel/common/soc-acpi-intel-glk-match.c   |  9 ++++
 3 files changed, 54 insertions(+), 9 deletions(-)
sound/soc/intel/boards/Kconfig +1 -0
index f693383eb6e3..2dd5ff7e35ce 100644
@@ -427,6 +427,7 @@ config SND_SOC_INTEL_GLK_RT5682_MAX98357A_MACH
 	depends on MFD_INTEL_LPSS || COMPILE_TEST
 	depends on SND_HDA_CODEC_HDMI && SND_SOC_SOF_HDA_AUDIO_CODEC
 	select SND_SOC_RT5682_I2C
+	select SND_SOC_RT5682S
 	select SND_SOC_MAX98357A
 	select SND_SOC_DMIC
 	select SND_SOC_HDAC_HDMI
sound/soc/intel/boards/glk_rt5682_max98357a.c +44 -9

108 lines not on this page · raw message

sound/soc/intel/common/soc-acpi-intel-glk-match.c +9 -0
index 32fff9389eb3..4de4add74443 100644
@@ -40,6 +40,15 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
 		.sof_fw_filename = "sof-glk.ri",
 		.sof_tplg_filename = "sof-glk-rt5682.tplg",
 	},
+	{
+		.id = "RTL5682",
+		.drv_name = "glk_rt5682_max98357a",
+		.fw_filename = "intel/dsp_fw_glk.bin",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &glk_codecs,
+		.sof_fw_filename = "sof-glk.ri",
+		.sof_tplg_filename = "sof-glk-rt5682.tplg",
+	},
 	{
 		.id = "10134242",
 		.drv_name = "glk_cs4242_mx98357a",
Signature · 1 line
2.25.1
#1 lore raw
Quoted 21 lines
sound/soc/intel/boards/glk_rt5682_max98357a.c +8 -1
@@ -592,12 +610,29 @@ static int geminilake_audio_probe(struct platform_device *pdev)
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
 	struct snd_soc_card *card;
-	int ret;
+	int ret, i;
 
 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
 	if (!ctx)
 		return -ENOMEM;
 
+	/* Detect the headset codec variant */
+	if (acpi_dev_present("RTL5682", NULL, -1)) {
+		/* ALC5682I-VS is detected */
+		ctx->is_rt5682s = 1;
+
+		for (i = 0; i < glk_audio_card_rt5682_m98357a.num_links; i++) {
+			if (strcmp(geminilake_dais[i].name, "SSP2-Codec"))

sound/soc/intel/boards/glk_rt5682_max98357a.c static int geminilake_audio_probe(struct platform_device *pdev) · line 635

Quoted 10 lines
sound/soc/intel/boards/glk_rt5682_max98357a.c +10 -0
+				continue;
+
+			/* update the dai link to use rt5682s codec */
+			geminilake_dais[i].codecs = ssp2_codec_5682s;
+			geminilake_dais[i].num_codecs = ARRAY_SIZE(ssp2_codec_5682s);
+			break;
+		}
+	} else
+		ctx->is_rt5682s = 0;
+

nit-pick: this branch is not required, the field is already reset with kzalloc().

Quoted 8 lines
sound/soc/intel/boards/glk_rt5682_max98357a.c +0 -0
 	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
 
 	card = &glk_audio_card_rt5682_m98357a;
sound/soc/intel/common/soc-acpi-intel-glk-match.c +0 -0
index 32fff9389eb3..4de4add74443 100644

sound/soc/intel/common/soc-acpi-intel-glk-match.c struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = { · line 46

Quoted 7 lines
sound/soc/intel/common/soc-acpi-intel-glk-match.c +4 -0
@@ -40,6 +40,15 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
 		.sof_fw_filename = "sof-glk.ri",
 		.sof_tplg_filename = "sof-glk-rt5682.tplg",
 	},
+	{
+		.id = "RTL5682",
+		.drv_name = "glk_rt5682_max98357a",
+		.fw_filename = "intel/dsp_fw_glk.bin",

Have you actually tested with this firmware? if not, it's probably better not to list it as an option.

Quoted 9 lines
sound/soc/intel/common/soc-acpi-intel-glk-match.c +5 -0
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &glk_codecs,
+		.sof_fw_filename = "sof-glk.ri",
+		.sof_tplg_filename = "sof-glk-rt5682.tplg",
+	},
 	{
 		.id = "10134242",
 		.drv_name = "glk_cs4242_mx98357a",
author
#2 lore raw
Quoted 3 lines

nit-pick: this branch is not required, the field is already reset with kzalloc().

Will remove it.

Quoted 4 lines

Have you actually tested with this firmware? if not, it's probably better not to list it as an option.

It's validated by ODM on GLK Chromebook. So I think only SOF FW is validated. Will remove this line in V2 patch.