ASoC: Intel: Baytrail: add quirk for Lenovo Thinkpad 10
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 26 Jan 2017 20:09:35 +0000 (14:09 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 31 Jan 2017 20:12:31 +0000 (20:12 +0000)
the BIOS reports this codec as RT5640 but it's a rt5670. Use the
quirk mechanism to use the cht_bsw_rt5672 machine driver

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/atom/sst/sst_acpi.c

index 4c0b89ec42e082186e87fb3abbf7f10c97e909ea..8cc30dfbf87d30878655fcc9f1b3791c5ae6ada3 100644 (file)
@@ -400,6 +400,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
 static unsigned long cht_machine_id;
 
 #define CHT_SURFACE_MACH 1
+#define BYT_THINKPAD_10  2
 
 static int cht_surface_quirk_cb(const struct dmi_system_id *id)
 {
@@ -407,6 +408,23 @@ static int cht_surface_quirk_cb(const struct dmi_system_id *id)
        return 1;
 }
 
+static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
+{
+       cht_machine_id = BYT_THINKPAD_10;
+       return 1;
+}
+
+
+static const struct dmi_system_id byt_table[] = {
+       {
+               .callback = byt_thinkpad10_quirk_cb,
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "20C3001VHH"),
+               },
+       },
+       { }
+};
 
 static const struct dmi_system_id cht_table[] = {
        {
@@ -424,6 +442,10 @@ static struct sst_acpi_mach cht_surface_mach = {
        "10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
                                                                &chv_platform_data };
 
+static struct sst_acpi_mach byt_thinkpad_10 = {
+       "10EC5640", "cht-bsw-rt5672", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
+                                                               &byt_rvp_platform_data };
+
 static struct sst_acpi_mach *cht_quirk(void *arg)
 {
        struct sst_acpi_mach *mach = arg;
@@ -436,8 +458,21 @@ static struct sst_acpi_mach *cht_quirk(void *arg)
                return mach;
 }
 
+static struct sst_acpi_mach *byt_quirk(void *arg)
+{
+       struct sst_acpi_mach *mach = arg;
+
+       dmi_check_system(byt_table);
+
+       if (cht_machine_id == BYT_THINKPAD_10)
+               return &byt_thinkpad_10;
+       else
+               return mach;
+}
+
+
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
-       {"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
+       {"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", byt_quirk,
                                                &byt_rvp_platform_data },
        {"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
                                                &byt_rvp_platform_data },