Skip to content

Commit

Permalink
adrenoboost: finetuning algorithm - scale it a bit down
Browse files Browse the repository at this point in the history
Values range from 0-3, 0 off, 3 most aggressive.
Scales back nicely in 2d to 133mhz.
Only scale up and count if MIN_VALUE crossed
  • Loading branch information
tbalden authored and acuicultor committed May 14, 2021
1 parent f58c1a7 commit 0be8317
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions drivers/devfreq/governor_msm_adreno_tz.c
Expand Up @@ -52,7 +52,10 @@ static DEFINE_SPINLOCK(suspend_lock);

#define TAG "msm_adreno_tz: "

static unsigned int adrenoboost = 10000;
#if 1
static unsigned int adrenoboost = 1;
#endif

static u64 suspend_time;
static u64 suspend_start;
static unsigned long acc_total, acc_relative_busy;
Expand Down Expand Up @@ -83,6 +86,7 @@ u64 suspend_time_ms(void)
return time_diff;
}

#if 1
static ssize_t adrenoboost_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand All @@ -97,15 +101,15 @@ static ssize_t adrenoboost_save(struct device *dev,
{
int input;
sscanf(buf, "%d ", &input);
if (input < 0 || input > 50000) {
if (input < 0 || input > 3) {
adrenoboost = 0;
} else {
adrenoboost = input;
}

return count;
}

#endif

static ssize_t gpu_load_show(struct device *dev,
struct device_attribute *attr,
Expand Down Expand Up @@ -153,8 +157,10 @@ static ssize_t suspend_time_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%llu\n", time_diff);
}

#if 1
static DEVICE_ATTR(adrenoboost, 0644,
adrenoboost_show, adrenoboost_save);
#endif

static DEVICE_ATTR_RO(gpu_load);

Expand All @@ -163,7 +169,9 @@ static DEVICE_ATTR_RO(suspend_time);
static const struct device_attribute *adreno_tz_attr_list[] = {
&dev_attr_gpu_load,
&dev_attr_suspend_time,
#if 1
&dev_attr_adrenoboost,
#endif
NULL
};

Expand Down Expand Up @@ -409,7 +417,16 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq)

*freq = stats->current_frequency;
priv->bin.total_time += stats->total_time;
#if 1
// scale busy time up based on adrenoboost parameter, only if MIN_BUSY exceeded...
if ((unsigned int)(priv->bin.busy_time + stats.busy_time) >= MIN_BUSY) {
priv->bin.busy_time += stats.busy_time * (1 + (adrenoboost*3)/2);
} else {
priv->bin.busy_time += stats.busy_time;
}
#else
priv->bin.busy_time += stats->busy_time;
#endif

if (stats->private_data)
context_count = *((int *)stats->private_data);
Expand Down Expand Up @@ -445,7 +462,7 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq)

scm_data[0] = level;
scm_data[1] = priv->bin.total_time;
scm_data[2] = priv->bin.busy_time + (level * adrenoboost);
scm_data[2] = priv->bin.busy_time;
scm_data[3] = context_count;
__secure_tz_update_entry3(scm_data, sizeof(scm_data),
&val, sizeof(val), priv);
Expand Down

0 comments on commit 0be8317

Please sign in to comment.