]> git.itanic.dy.fi Git - linux-stable/commitdiff
ASoC: Intel: soc-acpi-cht: Add Lenovo Yoga Tab 3 Pro YT3-X90 quirk
authorHans de Goede <hdegoede@redhat.com>
Sat, 21 Oct 2023 21:15:28 +0000 (23:15 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 24 Oct 2023 17:03:11 +0000 (18:03 +0100)
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: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231021211534.114991-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/common/soc-acpi-intel-cht-match.c

index cdcbf04b8832ff0f78bb8ec78d91d75817dfc41f..5e2ec60e2954b2c2c2f1e438fd1b3a5070ae69fa 100644 (file)
@@ -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)
        /*