|
@@ -982,6 +982,46 @@ unlock_tree:
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int cam_cpas_util_apply_default_axi_vote(
|
|
|
|
+ struct cam_hw_info *cpas_hw, bool enable)
|
|
|
|
+{
|
|
|
|
+ struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info;
|
|
|
|
+ struct cam_cpas_axi_port *axi_port = NULL;
|
|
|
|
+ uint64_t mnoc_ab_bw = 0, mnoc_ib_bw = 0;
|
|
|
|
+ int rc = 0, i = 0;
|
|
|
|
+
|
|
|
|
+ mutex_lock(&cpas_core->tree_lock);
|
|
|
|
+ for (i = 0; i < cpas_core->num_axi_ports; i++) {
|
|
|
|
+ if (!cpas_core->axi_port[i].ab_bw ||
|
|
|
|
+ !cpas_core->axi_port[i].ib_bw)
|
|
|
|
+ axi_port = &cpas_core->axi_port[i];
|
|
|
|
+ else
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ if (enable)
|
|
|
|
+ mnoc_ib_bw = CAM_CPAS_DEFAULT_AXI_BW;
|
|
|
|
+ else
|
|
|
|
+ mnoc_ib_bw = 0;
|
|
|
|
+
|
|
|
|
+ CAM_DBG(CAM_CPAS, "Port=[%s] :ab[%llu] ib[%llu]",
|
|
|
|
+ axi_port->axi_port_name, mnoc_ab_bw, mnoc_ib_bw);
|
|
|
|
+
|
|
|
|
+ rc = cam_cpas_util_vote_bus_client_bw(&axi_port->bus_client,
|
|
|
|
+ mnoc_ab_bw, mnoc_ib_bw, false, &axi_port->applied_ab_bw,
|
|
|
|
+ &axi_port->applied_ib_bw);
|
|
|
|
+ if (rc) {
|
|
|
|
+ CAM_ERR(CAM_CPAS,
|
|
|
|
+ "Failed in mnoc vote ab[%llu] ib[%llu] rc=%d",
|
|
|
|
+ mnoc_ab_bw, mnoc_ib_bw, rc);
|
|
|
|
+ goto unlock_tree;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+unlock_tree:
|
|
|
|
+ mutex_unlock(&cpas_core->tree_lock);
|
|
|
|
+ return rc;
|
|
|
|
+}
|
|
|
|
+
|
|
static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
|
|
static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
|
|
uint32_t client_handle, struct cam_axi_vote *client_axi_vote)
|
|
uint32_t client_handle, struct cam_axi_vote *client_axi_vote)
|
|
{
|
|
{
|
|
@@ -1364,6 +1404,10 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
|
|
goto remove_ahb_vote;
|
|
goto remove_ahb_vote;
|
|
|
|
|
|
if (cpas_core->streamon_clients == 0) {
|
|
if (cpas_core->streamon_clients == 0) {
|
|
|
|
+ rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, true);
|
|
|
|
+ if (rc)
|
|
|
|
+ goto remove_ahb_vote;
|
|
|
|
+
|
|
atomic_set(&cpas_core->irq_count, 1);
|
|
atomic_set(&cpas_core->irq_count, 1);
|
|
rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info,
|
|
rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info,
|
|
applied_level);
|
|
applied_level);
|
|
@@ -1543,6 +1587,11 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,
|
|
|
|
|
|
rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
|
|
rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
|
|
cpas_client, &axi_vote);
|
|
cpas_client, &axi_vote);
|
|
|
|
+ if (rc)
|
|
|
|
+ goto done;
|
|
|
|
+
|
|
|
|
+ if (cpas_core->streamon_clients == 0)
|
|
|
|
+ rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, false);
|
|
done:
|
|
done:
|
|
mutex_unlock(&cpas_core->client_mutex[client_indx]);
|
|
mutex_unlock(&cpas_core->client_mutex[client_indx]);
|
|
mutex_unlock(&cpas_hw->hw_mutex);
|
|
mutex_unlock(&cpas_hw->hw_mutex);
|