mmrm-driver: Update delta current correctly
Update delta current correctly after client was throttled. Change-Id: I3b51f8eb7f94d3659dea5dde6e16537fbc0de87d Signed-off-by: Mahesh Kumar Sharma <smahesh@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
aa373d648a
commit
b5fa8d8109
@@ -490,7 +490,7 @@ err_invalid_level:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int mmrm_sw_throttle_low_priority_client(
|
static int mmrm_sw_throttle_low_priority_client(
|
||||||
struct mmrm_sw_clk_mgr_info *sinfo, u32 *delta_cur)
|
struct mmrm_sw_clk_mgr_info *sinfo, int *delta_cur)
|
||||||
{
|
{
|
||||||
int rc = 0, i;
|
int rc = 0, i;
|
||||||
bool found_client_throttle = false;
|
bool found_client_throttle = false;
|
||||||
@@ -557,31 +557,34 @@ static int mmrm_sw_throttle_low_priority_client(
|
|||||||
goto err_clk_set_fail;
|
goto err_clk_set_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = clk_set_rate(tbl_entry_throttle_client->clk,
|
if (tbl_entry_throttle_client->reserve == false) {
|
||||||
tbl_entry_throttle_client->freq[clk_min_level]);
|
rc = clk_set_rate(tbl_entry_throttle_client->clk,
|
||||||
if (rc) {
|
tbl_entry_throttle_client->freq[clk_min_level]);
|
||||||
d_mpr_e("%s: Failed to throttle the clk csid(%d)\n",
|
if (rc) {
|
||||||
|
d_mpr_e("%s: Failed to throttle the clk csid(%d)\n",
|
||||||
__func__, tbl_entry_throttle_client->clk_src_id);
|
__func__, tbl_entry_throttle_client->clk_src_id);
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto err_clk_set_fail;
|
goto err_clk_set_fail;
|
||||||
} else {
|
}
|
||||||
d_mpr_h("%s: %s throttled to %llu\n",
|
}
|
||||||
|
|
||||||
|
d_mpr_h("%s: %s throttled to %llu\n",
|
||||||
__func__, tbl_entry_throttle_client->name,
|
__func__, tbl_entry_throttle_client->name,
|
||||||
tbl_entry_throttle_client->freq[clk_min_level]);
|
tbl_entry_throttle_client->freq[clk_min_level]);
|
||||||
*delta_cur = now_cur_ma - min_cur_ma;
|
*delta_cur -= now_cur_ma - min_cur_ma;
|
||||||
|
|
||||||
/* Store this client for bookkeeping */
|
/* Store this client for bookkeeping */
|
||||||
tc_data = kzalloc(sizeof(*tc_data), GFP_KERNEL);
|
tc_data = kzalloc(sizeof(*tc_data), GFP_KERNEL);
|
||||||
if (IS_ERR_OR_NULL(tc_data)) {
|
if (IS_ERR_OR_NULL(tc_data)) {
|
||||||
d_mpr_e("%s: Failed to allocate memory\n", __func__);
|
d_mpr_e("%s: Failed to allocate memory\n", __func__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
tc_data->table_id = i;
|
|
||||||
tc_data->delta_cu_ma = now_cur_ma - min_cur_ma;
|
|
||||||
tc_data->prev_vdd_level = tbl_entry_throttle_client->vdd_level;
|
|
||||||
// Add throttled client to list to access it later
|
|
||||||
list_add_tail(&tc_data->list, &sinfo->throttled_clients);
|
|
||||||
}
|
}
|
||||||
|
tc_data->table_id = i;
|
||||||
|
tc_data->delta_cu_ma = now_cur_ma - min_cur_ma;
|
||||||
|
tc_data->prev_vdd_level = tbl_entry_throttle_client->vdd_level;
|
||||||
|
// Add throttled client to list to access it later
|
||||||
|
list_add_tail(&tc_data->list, &sinfo->throttled_clients);
|
||||||
|
|
||||||
/* Store the throttled clock rate of client */
|
/* Store the throttled clock rate of client */
|
||||||
tbl_entry_throttle_client->clk_rate =
|
tbl_entry_throttle_client->clk_rate =
|
||||||
tbl_entry_throttle_client->freq[clk_min_level];
|
tbl_entry_throttle_client->freq[clk_min_level];
|
||||||
@@ -590,7 +593,7 @@ static int mmrm_sw_throttle_low_priority_client(
|
|||||||
tbl_entry_throttle_client->vdd_level = clk_min_level;
|
tbl_entry_throttle_client->vdd_level = clk_min_level;
|
||||||
|
|
||||||
/* Clearing the reserve flag */
|
/* Clearing the reserve flag */
|
||||||
tbl_entry_throttle_client->reserve = tbl_entry_throttle_client->reserve & 0;
|
tbl_entry_throttle_client->reserve = false;
|
||||||
}
|
}
|
||||||
err_clk_set_fail:
|
err_clk_set_fail:
|
||||||
return rc;
|
return rc;
|
||||||
|
Reference in New Issue
Block a user