Merge branch 'topic/drm_audio_component' of https://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / sound / soc / intel / skylake / skl.c
index 9c5a701d68acc67a524785dc0cba028ceefbc4ed..dce64948564940ea7383e0f4975de4b4ec7293ec 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/delay.h>
 #include <sound/pcm.h>
 #include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
 #include <sound/hda_register.h>
 #include <sound/hdaudio.h>
 #include <sound/hda_i915.h>
@@ -36,8 +37,6 @@
 #include "skl-sst-dsp.h"
 #include "skl-sst-ipc.h"
 
-static struct skl_machine_pdata skl_dmic_data;
-
 /*
  * initialize the PCI registers
  */
@@ -487,10 +486,12 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
 
        skl->mach = mach;
        skl->fw_name = mach->fw_filename;
-       pdata = skl->mach->pdata;
+       pdata = mach->pdata;
 
-       if (mach->pdata)
+       if (pdata) {
                skl->use_tplg_pcm = pdata->use_tplg_pcm;
+               pdata->dmic_num = skl_get_dmic_geo(skl);
+       }
 
        return 0;
 }
@@ -635,6 +636,8 @@ static int probe_codec(struct hdac_bus *bus, int addr)
        unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
                (AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
        unsigned int res = -1;
+       struct skl *skl = bus_to_skl(bus);
+       struct hdac_device *hdev;
 
        mutex_lock(&bus->cmd_mutex);
        snd_hdac_bus_send_cmd(bus, cmd);
@@ -644,7 +647,11 @@ static int probe_codec(struct hdac_bus *bus, int addr)
                return -EIO;
        dev_dbg(bus->dev, "codec #%d probed OK\n", addr);
 
-       return snd_hdac_ext_bus_device_init(bus, addr);
+       hdev = devm_kzalloc(&skl->pci->dev, sizeof(*hdev), GFP_KERNEL);
+       if (!hdev)
+               return -ENOMEM;
+
+       return snd_hdac_ext_bus_device_init(bus, addr, hdev);
 }
 
 /* Codec initialization */
@@ -797,7 +804,7 @@ static int skl_create(struct pci_dev *pci,
        }
 
        bus = skl_to_bus(skl);
-       snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops);
+       snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, NULL);
        bus->use_posbuf = 1;
        skl->pci = pci;
        INIT_WORK(&skl->probe_work, skl_probe_work);
@@ -911,8 +918,6 @@ static int skl_probe(struct pci_dev *pci,
 
        pci_set_drvdata(skl->pci, bus);
 
-       skl_dmic_data.dmic_num = skl_get_dmic_geo(skl);
-
        /* check if dsp is there */
        if (bus->ppcap) {
                /* create device for dsp clk */
@@ -1006,172 +1011,23 @@ static void skl_remove(struct pci_dev *pci)
        dev_set_drvdata(&pci->dev, NULL);
 }
 
-static struct snd_soc_acpi_codecs skl_codecs = {
-       .num_codecs = 1,
-       .codecs = {"10508825"}
-};
-
-static struct snd_soc_acpi_codecs kbl_codecs = {
-       .num_codecs = 1,
-       .codecs = {"10508825"}
-};
-
-static struct snd_soc_acpi_codecs bxt_codecs = {
-       .num_codecs = 1,
-       .codecs = {"MX98357A"}
-};
-
-static struct snd_soc_acpi_codecs kbl_poppy_codecs = {
-       .num_codecs = 1,
-       .codecs = {"10EC5663"}
-};
-
-static struct snd_soc_acpi_codecs kbl_5663_5514_codecs = {
-       .num_codecs = 2,
-       .codecs = {"10EC5663", "10EC5514"}
-};
-
-static struct snd_soc_acpi_codecs kbl_7219_98357_codecs = {
-       .num_codecs = 1,
-       .codecs = {"MX98357A"}
-};
-
-static struct skl_machine_pdata cnl_pdata = {
-       .use_tplg_pcm = true,
-};
-
-static struct snd_soc_acpi_mach sst_skl_devdata[] = {
-       {
-               .id = "INT343A",
-               .drv_name = "skl_alc286s_i2s",
-               .fw_filename = "intel/dsp_fw_release.bin",
-       },
-       {
-               .id = "INT343B",
-               .drv_name = "skl_n88l25_s4567",
-               .fw_filename = "intel/dsp_fw_release.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &skl_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {
-               .id = "MX98357A",
-               .drv_name = "skl_n88l25_m98357a",
-               .fw_filename = "intel/dsp_fw_release.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &skl_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {}
-};
-
-static struct snd_soc_acpi_mach sst_bxtp_devdata[] = {
-       {
-               .id = "INT343A",
-               .drv_name = "bxt_alc298s_i2s",
-               .fw_filename = "intel/dsp_fw_bxtn.bin",
-       },
-       {
-               .id = "DLGS7219",
-               .drv_name = "bxt_da7219_max98357a_i2s",
-               .fw_filename = "intel/dsp_fw_bxtn.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &bxt_codecs,
-       },
-       {}
-};
-
-static struct snd_soc_acpi_mach sst_kbl_devdata[] = {
-       {
-               .id = "INT343A",
-               .drv_name = "kbl_alc286s_i2s",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-       },
-       {
-               .id = "INT343B",
-               .drv_name = "kbl_n88l25_s4567",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &kbl_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {
-               .id = "MX98357A",
-               .drv_name = "kbl_n88l25_m98357a",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &kbl_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {
-               .id = "MX98927",
-               .drv_name = "kbl_r5514_5663_max",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &kbl_5663_5514_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {
-               .id = "MX98927",
-               .drv_name = "kbl_rt5663_m98927",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &kbl_poppy_codecs,
-               .pdata = &skl_dmic_data
-       },
-       {
-               .id = "10EC5663",
-               .drv_name = "kbl_rt5663",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-       },
-       {
-               .id = "DLGS7219",
-               .drv_name = "kbl_da7219_max98357a",
-               .fw_filename = "intel/dsp_fw_kbl.bin",
-               .machine_quirk = snd_soc_acpi_codec_list,
-               .quirk_data = &kbl_7219_98357_codecs,
-               .pdata = &skl_dmic_data
-       },
-
-       {}
-};
-
-static struct snd_soc_acpi_mach sst_glk_devdata[] = {
-       {
-               .id = "INT343A",
-               .drv_name = "glk_alc298s_i2s",
-               .fw_filename = "intel/dsp_fw_glk.bin",
-       },
-       {}
-};
-
-static const struct snd_soc_acpi_mach sst_cnl_devdata[] = {
-       {
-               .id = "INT34C2",
-               .drv_name = "cnl_rt274",
-               .fw_filename = "intel/dsp_fw_cnl.bin",
-               .pdata = &cnl_pdata,
-       },
-       {}
-};
-
 /* PCI IDs */
 static const struct pci_device_id skl_ids[] = {
        /* Sunrise Point-LP */
        { PCI_DEVICE(0x8086, 0x9d70),
-               .driver_data = (unsigned long)&sst_skl_devdata},
+               .driver_data = (unsigned long)&snd_soc_acpi_intel_skl_machines},
        /* BXT-P */
        { PCI_DEVICE(0x8086, 0x5a98),
-               .driver_data = (unsigned long)&sst_bxtp_devdata},
+               .driver_data = (unsigned long)&snd_soc_acpi_intel_bxt_machines},
        /* KBL */
        { PCI_DEVICE(0x8086, 0x9D71),
-               .driver_data = (unsigned long)&sst_kbl_devdata},
+               .driver_data = (unsigned long)&snd_soc_acpi_intel_kbl_machines},
        /* GLK */
        { PCI_DEVICE(0x8086, 0x3198),
-               .driver_data = (unsigned long)&sst_glk_devdata},
+               .driver_data = (unsigned long)&snd_soc_acpi_intel_glk_machines},
        /* CNL */
        { PCI_DEVICE(0x8086, 0x9dc8),
-               .driver_data = (unsigned long)&sst_cnl_devdata},
+               .driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, skl_ids);