]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - sound/soc/intel/skylake/skl-messages.c
Merge remote-tracking branches 'asoc/topic/wm8904', 'asoc/topic/wm8955' and 'asoc...
[karo-tx-linux.git] / sound / soc / intel / skylake / skl-messages.c
index 826d4fd8930a5ca802f07bef5542bc26c199ffdf..50a109503a3fefbe41b1c153b8c96f975a4a6d1f 100644 (file)
@@ -54,6 +54,24 @@ static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
        return 0;
 }
 
+#define NOTIFICATION_PARAM_ID 3
+#define NOTIFICATION_MASK 0xf
+
+/* disable notfication for underruns/overruns from firmware module */
+static void skl_dsp_enable_notification(struct skl_sst *ctx, bool enable)
+{
+       struct notification_mask mask;
+       struct skl_ipc_large_config_msg msg = {0};
+
+       mask.notify = NOTIFICATION_MASK;
+       mask.enable = enable;
+
+       msg.large_param_id = NOTIFICATION_PARAM_ID;
+       msg.param_data_size = sizeof(mask);
+
+       skl_ipc_set_large_config(&ctx->ipc, &msg, (u32 *)&mask);
+}
+
 int skl_init_dsp(struct skl *skl)
 {
        void __iomem *mmio_base;
@@ -79,7 +97,10 @@ int skl_init_dsp(struct skl *skl)
 
        ret = skl_sst_dsp_init(bus->dev, mmio_base, irq,
                        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;
@@ -122,6 +143,7 @@ int skl_suspend_dsp(struct skl *skl)
 int skl_resume_dsp(struct skl *skl)
 {
        struct skl_sst *ctx = skl->skl_sst;
+       int ret;
 
        /* if ppcap is not supported return 0 */
        if (!skl->ebus.ppcap)
@@ -131,7 +153,12 @@ int skl_resume_dsp(struct skl *skl)
        snd_hdac_ext_bus_ppcap_enable(&skl->ebus, true);
        snd_hdac_ext_bus_ppcap_int_enable(&skl->ebus, true);
 
-       return skl_dsp_wake(ctx->dsp);
+       ret = skl_dsp_wake(ctx->dsp);
+       if (ret < 0)
+               return ret;
+
+       skl_dsp_enable_notification(skl->skl_sst, false);
+       return ret;
 }
 
 enum skl_bitdepth skl_get_bit_depth(int params)
@@ -294,6 +321,7 @@ static void skl_copy_copier_caps(struct skl_module_cfg *mconfig,
                        (mconfig->formats_config.caps_size) / 4;
 }
 
+#define SKL_NON_GATEWAY_CPR_NODE_ID 0xFFFFFFFF
 /*
  * Calculate the gatewat settings required for copier module, type of
  * gateway and index of gateway to use
@@ -303,6 +331,7 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
                        struct skl_cpr_cfg *cpr_mconfig)
 {
        union skl_connector_node_id node_id = {0};
+       union skl_ssp_dma_node ssp_node  = {0};
        struct skl_pipe_params *params = mconfig->pipe->p_params;
 
        switch (mconfig->dev_type) {
@@ -320,9 +349,9 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
                        (SKL_CONN_SOURCE == mconfig->hw_conn_type) ?
                        SKL_DMA_I2S_LINK_OUTPUT_CLASS :
                        SKL_DMA_I2S_LINK_INPUT_CLASS;
-               node_id.node.vindex = params->host_dma_id +
-                                        (mconfig->time_slot << 1) +
-                                        (mconfig->vbus_id << 3);
+               ssp_node.dma_node.time_slot_index = mconfig->time_slot;
+               ssp_node.dma_node.i2s_instance = mconfig->vbus_id;
+               node_id.node.vindex = ssp_node.val;
                break;
 
        case SKL_DEVICE_DMIC:
@@ -339,13 +368,18 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
                node_id.node.vindex = params->link_dma_id;
                break;
 
-       default:
+       case SKL_DEVICE_HDAHOST:
                node_id.node.dma_type =
                        (SKL_CONN_SOURCE == mconfig->hw_conn_type) ?
                        SKL_DMA_HDA_HOST_OUTPUT_CLASS :
                        SKL_DMA_HDA_HOST_INPUT_CLASS;
                node_id.node.vindex = params->host_dma_id;
                break;
+
+       default:
+               cpr_mconfig->gtw_cfg.node_id = SKL_NON_GATEWAY_CPR_NODE_ID;
+               cpr_mconfig->cpr_feature_mask = 0;
+               return;
        }
 
        cpr_mconfig->gtw_cfg.node_id = node_id.val;