ASoC: Intel: sof_ssp_amp: fix no DMIC BE Link on Chromebooks
[linux-2.6-microblaze.git] / sound / soc / intel / boards / sof_ssp_amp.c
index 02a27aa..675ade8 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/acpi.h>
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <sound/core.h>
@@ -78,6 +79,16 @@ struct sof_card_private {
        bool idisp_codec;
 };
 
+static const struct dmi_system_id chromebook_platforms[] = {
+       {
+               .ident = "Google Chromebooks",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Google"),
+               }
+       },
+       {},
+};
+
 static const struct snd_soc_dapm_widget sof_ssp_amp_dapm_widgets[] = {
        SND_SOC_DAPM_MIC("SoC DMIC", NULL),
 };
@@ -94,7 +105,7 @@ static int sof_card_late_probe(struct snd_soc_card *card)
        char jack_name[NAME_SIZE];
        struct sof_hdmi_pcm *pcm;
        int err;
-       int i = 0;
+       int i;
 
        if (!(sof_ssp_amp_quirk & SOF_HDMI_PLAYBACK_PRESENT))
                return 0;
@@ -113,6 +124,7 @@ static int sof_card_late_probe(struct snd_soc_card *card)
                return hda_dsp_hdmi_build_controls(card, component);
        }
 
+       i = 0;
        list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
                component = pcm->codec_dai->component;
                snprintf(jack_name, sizeof(jack_name),
@@ -370,7 +382,7 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
        struct snd_soc_dai_link *dai_links;
        struct snd_soc_acpi_mach *mach;
        struct sof_card_private *ctx;
-       int dmic_be_num, hdmi_num = 0;
+       int dmic_be_num = 0, hdmi_num = 0;
        int ret, ssp_codec;
 
        ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
@@ -382,7 +394,8 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)
 
        mach = pdev->dev.platform_data;
 
-       dmic_be_num = mach->mach_params.dmic_num;
+       if (dmi_check_system(chromebook_platforms) || mach->mach_params.dmic_num > 0)
+               dmic_be_num = 2;
 
        ssp_codec = sof_ssp_amp_quirk & SOF_AMPLIFIER_SSP_MASK;