Unverified Commit 2cb54788 authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown
Browse files

ASoC: Intel: soc-acpi-cht: Add Lenovo Yoga Tab 3 Pro YT3-X90 quirk



The Lenovo Yoga Tab 3 Pro YT3-X90 x86 tablet, which ships with Android with
a custom kernel as factory OS, does not list the used WM5102 codec inside
its DSDT.

Workaround this with a new snd_soc_acpi_intel_baytrail_machines[] entry
which matches on the SST id instead of the codec id like nocodec does,
combined with using a machine_quirk callback which returns NULL on
other machines to skip the new entry on other machines.

Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231021211534.114991-1-hdegoede@redhat.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2e2a1613
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -75,6 +75,39 @@ static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg)
	return arg;
}

/*
 * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS has a buggy DSDT
 * with the coded not being listed at all.
 */
static const struct dmi_system_id lenovo_yoga_tab3_x90[] = {
	{
		/* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
			DMI_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
		},
	},
	{ }
};

static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = {
	.id = "10WM5102",
	.drv_name = "bytcr_wm5102",
	.fw_filename = "intel/fw_sst_22a8.bin",
	.board = "bytcr_wm5102",
	.sof_tplg_filename = "sof-cht-wm5102.tplg",
};

static struct snd_soc_acpi_mach *lenovo_yt3_x90_quirk(void *arg)
{
	if (dmi_check_system(lenovo_yoga_tab3_x90))
		return &cht_lenovo_yoga_tab3_x90_mach;

	/* Skip wildcard match snd_soc_acpi_intel_cherrytrail_machines[] entry */
	return NULL;
}

static const struct snd_soc_acpi_codecs rt5640_comp_ids = {
	.num_codecs = 2,
	.codecs = { "10EC5640", "10EC3276" },
@@ -175,6 +208,16 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = {
		.drv_name = "sof_pcm512x",
		.sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg",
	},
	/*
	 * Special case for the Lenovo Yoga Tab 3 Pro YT3-X90 where the DSDT
	 * misses the codec. Match on the SST id instead, lenovo_yt3_x90_quirk()
	 * will return a YT3 specific mach or NULL when called on other hw,
	 * skipping this entry.
	 */
	{
		.id = "808622A8",
		.machine_quirk = lenovo_yt3_x90_quirk,
	},

#if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
	/*