edp: tegra: adding gain factor debug knob
Sivaram Nair [Mon, 4 Mar 2013 23:57:52 +0000 (01:57 +0200)]
Added a gain factor debugfs node to scale the EDP budget that is
allocated to the core client.

Change-Id: Ic8cf6c50b66d8876b23845fcc76bdde3e4305518
Signed-off-by: Sivaram Nair <sivaramn@nvidia.com>
Reviewed-on: http://git-master/r/206097
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>

drivers/edp/tegra_edp.c

index 5fe9083..332eb74 100644 (file)
@@ -34,6 +34,7 @@ struct freqcap {
 
 static unsigned int gpu_high_threshold = 500;
 static unsigned int gpu_window = 2000;
+static unsigned int gain_factor = 100;
 static unsigned int online_cpu_count;
 static bool gpu_busy;
 static unsigned int core_state;
@@ -175,7 +176,7 @@ static void update_cur_corecap(void)
        if (!core_platdata)
                return;
 
-       power = core_edp_states[core_state];
+       power = core_edp_states[core_state] * gain_factor / 100;
        i = core_platdata->corecap_size - 1;
        cap = core_platdata->corecap + i;
 
@@ -279,8 +280,13 @@ static int core_set(void *data, u64 val)
 
        old = *pdata;
        *pdata = val;
-       if (old != *pdata)
+
+       if (old != *pdata) {
+               if (pdata == &gain_factor)
+                       update_cur_corecap();
                do_cap_control();
+       }
+
        return 0;
 }
 
@@ -317,6 +323,7 @@ static __devinit void init_debug(void)
        create_attr("force_gpu", core_client.dentry, &forced_caps.gpu);
        create_attr("force_emc", core_client.dentry, &forced_caps.emc);
        create_attr("gpu_window", core_client.dentry, &gpu_window);
+       create_attr("gain", core_client.dentry, &gain_factor);
 }
 #else
 static inline void init_debug(void) {}