[PATCH] ASoc: Intel: glk_rt5682_max98357a: support ALC5682I-VS codec

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Oct 28 15:58:00 CEST 2021




> @@ -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"))
> +				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().

>  	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
>  
>  	card = &glk_audio_card_rt5682_m98357a;
> diff --git a/sound/soc/intel/common/soc-acpi-intel-glk-match.c b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> index 32fff9389eb3..4de4add74443 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> @@ -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.

> +		.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",
> 


More information about the Alsa-devel mailing list