Merge remote-tracking branch 'sound-asoc/for-next'
[deliverable/linux.git] / sound / soc / intel / skylake / skl-messages.c
index 44ab595ce21ab111e1a9297858561019aac0abe2..8eb5ba2dae3abc610635363eb9498bec086c2603 100644 (file)
@@ -203,32 +203,35 @@ static const struct skl_dsp_ops dsp_ops[] = {
                .id = 0x9d70,
                .loader_ops = skl_get_loader_ops,
                .init = skl_sst_dsp_init,
+               .init_fw = skl_sst_init_fw,
                .cleanup = skl_sst_dsp_cleanup
        },
        {
                .id = 0x9d71,
                .loader_ops = skl_get_loader_ops,
                .init = skl_sst_dsp_init,
+               .init_fw = skl_sst_init_fw,
                .cleanup = skl_sst_dsp_cleanup
        },
        {
                .id = 0x5a98,
                .loader_ops = bxt_get_loader_ops,
                .init = bxt_sst_dsp_init,
+               .init_fw = bxt_sst_init_fw,
                .cleanup = bxt_sst_dsp_cleanup
        },
 };
 
-static int skl_get_dsp_ops(int pci_id)
+const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
 {
        int i;
 
        for (i = 0; i < ARRAY_SIZE(dsp_ops); i++) {
                if (dsp_ops[i].id == pci_id)
-                       return i;
+                       return &dsp_ops[i];
        }
 
-       return -EINVAL;
+       return NULL;
 }
 
 int skl_init_dsp(struct skl *skl)
@@ -238,7 +241,8 @@ int skl_init_dsp(struct skl *skl)
        struct hdac_bus *bus = ebus_to_hbus(ebus);
        struct skl_dsp_loader_ops loader_ops;
        int irq = bus->irq;
-       int ret, index;
+       const struct skl_dsp_ops *ops;
+       int ret;
 
        /* enable ppcap interrupt */
        snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true);
@@ -251,18 +255,18 @@ int skl_init_dsp(struct skl *skl)
                return -ENXIO;
        }
 
-       index  = skl_get_dsp_ops(skl->pci->device);
-       if (index  < 0)
-               return -EINVAL;
+       ops = skl_get_dsp_ops(skl->pci->device);
+       if (!ops)
+               return -EIO;
 
-       loader_ops = dsp_ops[index].loader_ops();
-       ret = dsp_ops[index].init(bus->dev, mmio_base, irq,
-                       skl->fw_name, loader_ops, &skl->skl_sst);
+       loader_ops = ops->loader_ops();
+       ret = ops->init(bus->dev, mmio_base, irq,
+                               skl->fw_name, loader_ops,
+                               &skl->skl_sst);
 
        if (ret < 0)
                return ret;
 
-       skl_dsp_enable_notification(skl->skl_sst, false);
        dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
 
        return ret;
@@ -273,16 +277,16 @@ int skl_free_dsp(struct skl *skl)
        struct hdac_ext_bus *ebus = &skl->ebus;
        struct hdac_bus *bus = ebus_to_hbus(ebus);
        struct skl_sst *ctx = skl->skl_sst;
-       int index;
+       const struct skl_dsp_ops *ops;
 
        /* disable  ppcap interrupt */
        snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, false);
 
-       index = skl_get_dsp_ops(skl->pci->device);
-       if (index  < 0)
+       ops = skl_get_dsp_ops(skl->pci->device);
+       if (!ops)
                return -EIO;
 
-       dsp_ops[index].cleanup(bus->dev, ctx);
+       ops->cleanup(bus->dev, ctx);
 
        if (ctx->dsp->addr.lpe)
                iounmap(ctx->dsp->addr.lpe);
@@ -296,7 +300,7 @@ int skl_suspend_dsp(struct skl *skl)
        int ret;
 
        /* if ppcap is not supported return 0 */
-       if (!skl->ebus.ppcap)
+       if (!skl->ebus.bus.ppcap)
                return 0;
 
        ret = skl_dsp_sleep(ctx->dsp);
@@ -316,13 +320,17 @@ int skl_resume_dsp(struct skl *skl)
        int ret;
 
        /* if ppcap is not supported return 0 */
-       if (!skl->ebus.ppcap)
+       if (!skl->ebus.bus.ppcap)
                return 0;
 
        /* enable ppcap interrupt */
        snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true);
        snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, true);
 
+       /* check if DSP 1st boot is done */
+       if (skl->skl_sst->is_first_boot == true)
+               return 0;
+
        ret = skl_dsp_wake(ctx->dsp);
        if (ret < 0)
                return ret;
@@ -862,6 +870,7 @@ int skl_init_module(struct skl_sst *ctx,
        msg.ppl_instance_id = mconfig->pipe->ppl_id;
        msg.param_data_size = module_config_size;
        msg.core_id = mconfig->core_id;
+       msg.domain = mconfig->domain;
 
        ret = skl_ipc_init_instance(&ctx->ipc, &msg, param_data);
        if (ret < 0) {
This page took 0.044036 seconds and 5 git commands to generate.