Merge branch 'for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[platform/kernel/linux-rpi.git] / sound / soc / intel / skylake / skl.c
index 1aa8114..63182bf 100644 (file)
@@ -130,6 +130,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
        struct hdac_ext_link *hlink;
        int ret;
 
+       snd_hdac_set_codec_wakeup(bus, true);
        skl_enable_miscbdcge(bus->dev, false);
        ret = snd_hdac_bus_init_chip(bus, full_reset);
 
@@ -138,6 +139,7 @@ static int skl_init_chip(struct hdac_bus *bus, bool full_reset)
                writel(0, hlink->ml_addr + AZX_REG_ML_LOSIDV);
 
        skl_enable_miscbdcge(bus->dev, true);
+       snd_hdac_set_codec_wakeup(bus, false);
 
        return ret;
 }
@@ -481,13 +483,8 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
 static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl,
                                        struct snd_soc_acpi_mach *machines)
 {
-       struct hdac_bus *bus = skl_to_bus(skl);
        struct snd_soc_acpi_mach *mach;
 
-       /* check if we have any codecs detected on bus */
-       if (bus->codec_mask == 0)
-               return NULL;
-
        /* point to common table */
        mach = snd_soc_acpi_intel_hda_machines;
 
@@ -636,6 +633,9 @@ static int skl_clock_device_register(struct skl_dev *skl)
        struct platform_device_info pdevinfo = {NULL};
        struct skl_clk_pdata *clk_pdata;
 
+       if (!skl->nhlt)
+               return 0;
+
        clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
                                                        GFP_KERNEL);
        if (!clk_pdata)
@@ -803,6 +803,9 @@ static void skl_probe_work(struct work_struct *work)
                        return;
        }
 
+       skl_init_pci(skl);
+       skl_dum_set(bus);
+
        err = skl_init_chip(bus, true);
        if (err < 0) {
                dev_err(bus->dev, "Init chip failed with err: %d\n", err);
@@ -918,8 +921,6 @@ static int skl_first_init(struct hdac_bus *bus)
                return -ENXIO;
        }
 
-       snd_hdac_bus_reset_link(bus, true);
-
        snd_hdac_bus_parse_capabilities(bus);
 
        /* check if PPCAP exists */
@@ -967,11 +968,7 @@ static int skl_first_init(struct hdac_bus *bus)
        if (err < 0)
                return err;
 
-       /* initialize chip */
-       skl_init_pci(skl);
-       skl_dum_set(bus);
-
-       return skl_init_chip(bus, true);
+       return 0;
 }
 
 static int skl_probe(struct pci_dev *pci,
@@ -1064,8 +1061,6 @@ static int skl_probe(struct pci_dev *pci,
        if (bus->mlcap)
                snd_hdac_ext_bus_get_ml_capabilities(bus);
 
-       snd_hdac_bus_stop_chip(bus);
-
        /* create device for soc dmic */
        err = skl_dmic_device_register(skl);
        if (err < 0) {
@@ -1082,7 +1077,8 @@ out_dsp_free:
 out_clk_free:
        skl_clock_device_unregister(skl);
 out_nhlt_free:
-       intel_nhlt_free(skl->nhlt);
+       if (skl->nhlt)
+               intel_nhlt_free(skl->nhlt);
 out_free:
        skl_free(bus);
 
@@ -1131,7 +1127,8 @@ static void skl_remove(struct pci_dev *pci)
        skl_dmic_device_unregister(skl);
        skl_clock_device_unregister(skl);
        skl_nhlt_remove_sysfs(skl);
-       intel_nhlt_free(skl->nhlt);
+       if (skl->nhlt)
+               intel_nhlt_free(skl->nhlt);
        skl_free(bus);
        dev_set_drvdata(&pci->dev, NULL);
 }