static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx, struct skl_module_cfg *mconfig, struct skl_cpr_cfg *cpr_mconfig) { cpr_mconfig->gtw_cfg.node_id = skl_get_node_id(ctx, mconfig); if (cpr_mconfig->gtw_cfg.node_id == SKL_NON_GATEWAY_CPR_NODE_ID) { cpr_mconfig->cpr_feature_mask = 0; return; } if (SKL_CONN_SOURCE == mconfig->hw_conn_type) cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs; else cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs; cpr_mconfig->cpr_feature_mask = 0; cpr_mconfig->gtw_cfg.config_length = 0; skl_copy_copier_caps(mconfig, cpr_mconfig); }
static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx, struct skl_module_cfg *mconfig, struct skl_cpr_cfg *cpr_mconfig) { u32 dma_io_buf; struct skl_module_res *res; int res_idx = mconfig->res_idx; struct skl *skl = get_skl_ctx(ctx->dev); cpr_mconfig->gtw_cfg.node_id = skl_get_node_id(ctx, mconfig); if (cpr_mconfig->gtw_cfg.node_id == SKL_NON_GATEWAY_CPR_NODE_ID) { cpr_mconfig->cpr_feature_mask = 0; return; } if (skl->nr_modules) { res = &mconfig->module->resources[mconfig->res_idx]; cpr_mconfig->gtw_cfg.dma_buffer_size = res->dma_buffer_size; goto skip_buf_size_calc; } else { res = &mconfig->module->resources[res_idx]; } switch (mconfig->hw_conn_type) { case SKL_CONN_SOURCE: if (mconfig->dev_type == SKL_DEVICE_HDAHOST) dma_io_buf = res->ibs; else dma_io_buf = res->obs; break; case SKL_CONN_SINK: if (mconfig->dev_type == SKL_DEVICE_HDAHOST) dma_io_buf = res->obs; else dma_io_buf = res->ibs; break; default: dev_warn(ctx->dev, "wrong connection type: %d\n", mconfig->hw_conn_type); return; } cpr_mconfig->gtw_cfg.dma_buffer_size = mconfig->dma_buffer_size * dma_io_buf; /* fallback to 2ms default value */ if (!cpr_mconfig->gtw_cfg.dma_buffer_size) { if (mconfig->hw_conn_type == SKL_CONN_SOURCE) cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * res->obs; else cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * res->ibs; } skip_buf_size_calc: cpr_mconfig->cpr_feature_mask = 0; cpr_mconfig->gtw_cfg.config_length = 0; skl_copy_copier_caps(mconfig, cpr_mconfig); }
/* * Calculate the gatewat settings required for copier module, type of * gateway and index of gateway to use */ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx, struct skl_module_cfg *mconfig, 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) { case SKL_DEVICE_BT: node_id.node.dma_type = (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->vbus_id << 3); break; case SKL_DEVICE_I2S: node_id.node.dma_type = (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? SKL_DMA_I2S_LINK_OUTPUT_CLASS : SKL_DMA_I2S_LINK_INPUT_CLASS; 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: node_id.node.dma_type = SKL_DMA_DMIC_LINK_INPUT_CLASS; node_id.node.vindex = mconfig->vbus_id + (mconfig->time_slot); break; case SKL_DEVICE_HDALINK: node_id.node.dma_type = (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? SKL_DMA_HDA_LINK_OUTPUT_CLASS : SKL_DMA_HDA_LINK_INPUT_CLASS; node_id.node.vindex = params->link_dma_id; break; 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; if (SKL_CONN_SOURCE == mconfig->hw_conn_type) cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs; else cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs; cpr_mconfig->cpr_feature_mask = 0; cpr_mconfig->gtw_cfg.config_length = 0; skl_copy_copier_caps(mconfig, cpr_mconfig); }