Эх сурвалжийг харах

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 <[email protected]>
Mahesh Kumar Sharma 4 жил өмнө
parent
commit
e1ade39ea4

+ 1 - 1
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);
 

+ 2 - 2
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;

+ 5 - 1
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;