summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMahesh Kumar Sharma <smahesh@codeaurora.org>2021-06-30 11:53:45 -0700
committerMahesh Kumar Sharma <smahesh@codeaurora.org>2021-07-01 11:43:29 -0700
commite1ade39ea41042ae7636b5aefa5dc3ffd1590bfb (patch)
treeb2d05028936b46942c4943f8ec85e1bcd26872c5
parente653ade3120f6e3a672ceaf1399786857a8ad84f (diff)
downloadmmrm-e1ade39ea41042ae7636b5aefa5dc3ffd1590bfb.tar.gz
msm-mmrm: Control throttling feature via debugfs
Enable or disable throttling feature by writing correct value to msm_mmrm debugfs. Change-Id: If2b06e061ddd102c42d0f5517d3c0be4fc9f6669 Signed-off-by: Mahesh Kumar Sharma <smahesh@codeaurora.org>
-rw-r--r--driver/src/mmrm_clk_rsrc_mgr.h2
-rw-r--r--driver/src/mmrm_clk_rsrc_mgr_sw.c4
-rw-r--r--driver/src/mmrm_debug.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/driver/src/mmrm_clk_rsrc_mgr.h b/driver/src/mmrm_clk_rsrc_mgr.h
index e1251d0..57acc3c 100644
--- a/driver/src/mmrm_clk_rsrc_mgr.h
+++ b/driver/src/mmrm_clk_rsrc_mgr.h
@@ -30,7 +30,7 @@ static int mmrm_sw_vdd_corner[] = {
};
#define MMRM_SW_CLIENTS_NUM_MAX 35
-
+extern msm_mmrm_enable_throttle_feature;
typedef int (*notifier_callback_fn_t)(
struct mmrm_client_notifier_data *notifier_data);
diff --git a/driver/src/mmrm_clk_rsrc_mgr_sw.c b/driver/src/mmrm_clk_rsrc_mgr_sw.c
index d3c0105..e3bbbb6 100644
--- a/driver/src/mmrm_clk_rsrc_mgr_sw.c
+++ b/driver/src/mmrm_clk_rsrc_mgr_sw.c
@@ -591,7 +591,8 @@ static int mmrm_sw_check_peak_current(struct mmrm_sw_clk_mgr_info *sinfo,
/* peak overshoot, do not update peak data */
if ((signed)peak_cur + delta_cur >= peak_data->threshold) {
/* Find low prority client and throttle it*/
- if (tbl_entry->pri == MMRM_CLIENT_PRIOR_HIGH) {
+ if ((tbl_entry->pri == MMRM_CLIENT_PRIOR_HIGH)
+ && (msm_mmrm_enable_throttle_feature > 0)) {
rc = mmrm_sw_throttle_low_priority_client(sinfo, &delta_cur);
if (rc != 0) {
d_mpr_e("%s: Failed to throttle the low priority client\n",
@@ -604,7 +605,6 @@ static int mmrm_sw_check_peak_current(struct mmrm_sw_clk_mgr_info *sinfo,
rc = -EINVAL;
goto err_peak_overshoot;
}
-
}
/* update peak data */
peak_data->aggreg_val = peak_cur + delta_cur;
diff --git a/driver/src/mmrm_debug.c b/driver/src/mmrm_debug.c
index d34c64d..5c4e1ae 100644
--- a/driver/src/mmrm_debug.c
+++ b/driver/src/mmrm_debug.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
@@ -8,8 +8,11 @@
#include "mmrm_debug.h"
int msm_mmrm_debug = MMRM_ERR | MMRM_WARN | MMRM_PRINTK;
+u8 msm_mmrm_enable_throttle_feature = 0;
u8 msm_mmrm_allow_multiple_register = 0;
+
+
#define MAX_DBG_BUF_SIZE 4096
static ssize_t msm_mmrm_debugfs_info_read(
@@ -61,6 +64,7 @@ struct dentry *msm_mmrm_debugfs_init(void)
/* add other params here */
debugfs_create_u32("debug_level", 0644, dir, &msm_mmrm_debug);
debugfs_create_u8("allow_multiple_register", 0644, dir, &msm_mmrm_allow_multiple_register);
+ debugfs_create_u8("enable_throttle_feature", 0644, dir, &msm_mmrm_enable_throttle_feature);
d_mpr_h("%s: exiting\n", __func__);
return dir;