Merge tag 'asoc-v5.5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[linux-2.6-block.git] / sound / soc / sof / sof-pci-dev.c
index 3a9e0e2a150d31fc8f1fe910fb76ded1314301a0..3b58b91e7b9e57e0da29ee568427afee537de0f4 100644 (file)
@@ -30,6 +30,12 @@ static char *tplg_path;
 module_param(tplg_path, charp, 0444);
 MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
 
+static int sof_pci_debug;
+module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
+MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
+
+#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
+
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
 static const struct sof_dev_desc bxt_desc = {
        .machines               = snd_soc_acpi_intel_bxt_machines,
@@ -168,42 +174,6 @@ static const struct sof_dev_desc icl_desc = {
 };
 #endif
 
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE)
-static const struct sof_dev_desc skl_desc = {
-       .machines               = snd_soc_acpi_intel_skl_machines,
-       .resindex_lpe_base      = 0,
-       .resindex_pcicfg_base   = -1,
-       .resindex_imr_base      = -1,
-       .irqindex_host_ipc      = -1,
-       .resindex_dma_base      = -1,
-       .chip_info = &skl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
-       .nocodec_fw_filename = "sof-skl.ri",
-       .nocodec_tplg_filename = "sof-skl-nocodec.tplg",
-       .ops = &sof_skl_ops,
-       .arch_ops = &sof_xtensa_arch_ops
-};
-#endif
-
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE)
-static const struct sof_dev_desc kbl_desc = {
-       .machines               = snd_soc_acpi_intel_kbl_machines,
-       .resindex_lpe_base      = 0,
-       .resindex_pcicfg_base   = -1,
-       .resindex_imr_base      = -1,
-       .irqindex_host_ipc      = -1,
-       .resindex_dma_base      = -1,
-       .chip_info = &skl_chip_info,
-       .default_fw_path = "intel/sof",
-       .default_tplg_path = "intel/sof-tplg",
-       .nocodec_fw_filename = "sof-kbl.ri",
-       .nocodec_tplg_filename = "sof-kbl-nocodec.tplg",
-       .ops = &sof_skl_ops,
-       .arch_ops = &sof_xtensa_arch_ops
-};
-#endif
-
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE)
 static const struct sof_dev_desc tgl_desc = {
        .machines               = snd_soc_acpi_intel_tgl_machines,
@@ -240,7 +210,27 @@ static const struct sof_dev_desc ehl_desc = {
 };
 #endif
 
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
+static const struct sof_dev_desc jsl_desc = {
+       .machines               = snd_soc_acpi_intel_jsl_machines,
+       .resindex_lpe_base      = 0,
+       .resindex_pcicfg_base   = -1,
+       .resindex_imr_base      = -1,
+       .irqindex_host_ipc      = -1,
+       .resindex_dma_base      = -1,
+       .chip_info = &jsl_chip_info,
+       .default_fw_path = "intel/sof",
+       .default_tplg_path = "intel/sof-tplg",
+       .nocodec_fw_filename = "sof-jsl.ri",
+       .nocodec_tplg_filename = "sof-jsl-nocodec.tplg",
+       .ops = &sof_cnl_ops,
+       .arch_ops = &sof_xtensa_arch_ops
+};
+#endif
+
 static const struct dev_pm_ops sof_pci_pm = {
+       .prepare = snd_sof_prepare,
+       .complete = snd_sof_complete,
        SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
        SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
                           snd_sof_runtime_idle)
@@ -250,6 +240,9 @@ static void sof_pci_probe_complete(struct device *dev)
 {
        dev_dbg(dev, "Completing SOF PCI probe");
 
+       if (sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME)
+               return;
+
        /* allow runtime_pm */
        pm_runtime_set_autosuspend_delay(dev, SND_SOF_SUSPEND_DELAY_MS);
        pm_runtime_use_autosuspend(dev);
@@ -376,7 +369,8 @@ static void sof_pci_remove(struct pci_dev *pci)
        snd_sof_device_remove(&pci->dev);
 
        /* follow recommendation in pci-driver.c to increment usage counter */
-       pm_runtime_get_noresume(&pci->dev);
+       if (!(sof_pci_debug & SOF_PCI_DISABLE_PM_RUNTIME))
+               pm_runtime_get_noresume(&pci->dev);
 
        /* release pci regions and disable device */
        pci_release_regions(pci);
@@ -407,18 +401,14 @@ static const struct pci_device_id sof_pci_ids[] = {
        { PCI_DEVICE(0x8086, 0xa348),
                .driver_data = (unsigned long)&cfl_desc},
 #endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_KABYLAKE)
-       { PCI_DEVICE(0x8086, 0x9d71),
-               .driver_data = (unsigned long)&kbl_desc},
-#endif
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_SKYLAKE)
-       { PCI_DEVICE(0x8086, 0x9d70),
-               .driver_data = (unsigned long)&skl_desc},
-#endif
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_ICELAKE)
        { PCI_DEVICE(0x8086, 0x34C8),
                .driver_data = (unsigned long)&icl_desc},
 #endif
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
+       { PCI_DEVICE(0x8086, 0x38c8),
+               .driver_data = (unsigned long)&jsl_desc},
+#endif
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMETLAKE_LP)
        { PCI_DEVICE(0x8086, 0x02c8),
                .driver_data = (unsigned long)&cml_desc},