devfreq: Use devfreq_update_stats for gpu governors
This is the recommended way of using the devfreq api from within governors. The devfreq_update_stats() will utilize the devfreq.last_status to get the target device status so we no longer need to declare a local variable to get the target status. Change-Id: I5d80e39468e3eb90e55dcb0a813cb846a65ee8a5 Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
@@ -53,7 +53,7 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
|
|||||||
(df->profile),
|
(df->profile),
|
||||||
struct msm_busmon_extended_profile,
|
struct msm_busmon_extended_profile,
|
||||||
profile);
|
profile);
|
||||||
struct devfreq_dev_status stats;
|
struct devfreq_dev_status *stats = &df->last_status;
|
||||||
struct xstats b;
|
struct xstats b;
|
||||||
int result;
|
int result;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
@@ -73,18 +73,18 @@ static int devfreq_gpubw_get_target(struct devfreq *df,
|
|||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
stats.private_data = &b;
|
stats->private_data = &b;
|
||||||
|
|
||||||
result = df->profile->get_dev_status(df->dev.parent, &stats);
|
result = devfreq_update_stats(df);
|
||||||
|
|
||||||
*freq = stats.current_frequency;
|
*freq = stats->current_frequency;
|
||||||
|
|
||||||
priv->bus.total_time += stats.total_time;
|
priv->bus.total_time += stats->total_time;
|
||||||
priv->bus.gpu_time += stats.busy_time;
|
priv->bus.gpu_time += stats->busy_time;
|
||||||
priv->bus.ram_time += b.ram_time;
|
priv->bus.ram_time += b.ram_time;
|
||||||
priv->bus.ram_wait += b.ram_wait;
|
priv->bus.ram_wait += b.ram_wait;
|
||||||
|
|
||||||
level = devfreq_get_freq_level(df, stats.current_frequency);
|
level = devfreq_get_freq_level(df, stats->current_frequency);
|
||||||
|
|
||||||
if (priv->bus.total_time < LONG_FLOOR)
|
if (priv->bus.total_time < LONG_FLOOR)
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -361,42 +361,42 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct devfreq_msm_adreno_tz_data *priv = devfreq->data;
|
struct devfreq_msm_adreno_tz_data *priv = devfreq->data;
|
||||||
struct devfreq_dev_status stats;
|
struct devfreq_dev_status *stats = &devfreq->last_status;
|
||||||
int val, level = 0;
|
int val, level = 0;
|
||||||
unsigned int scm_data[4];
|
unsigned int scm_data[4];
|
||||||
int context_count = 0;
|
int context_count = 0;
|
||||||
|
|
||||||
/* keeps stats.private_data == NULL */
|
/* keeps stats.private_data == NULL */
|
||||||
result = devfreq->profile->get_dev_status(devfreq->dev.parent, &stats);
|
result = devfreq_update_stats(devfreq);
|
||||||
if (result) {
|
if (result) {
|
||||||
pr_err(TAG "get_status failed %d\n", result);
|
pr_err(TAG "get_status failed %d\n", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*freq = stats.current_frequency;
|
*freq = stats->current_frequency;
|
||||||
priv->bin.total_time += stats.total_time;
|
priv->bin.total_time += stats->total_time;
|
||||||
priv->bin.busy_time += stats.busy_time;
|
priv->bin.busy_time += stats->busy_time;
|
||||||
|
|
||||||
if (stats.private_data)
|
if (stats->private_data)
|
||||||
context_count = *((int *)stats.private_data);
|
context_count = *((int *)stats->private_data);
|
||||||
|
|
||||||
/* Update the GPU load statistics */
|
/* Update the GPU load statistics */
|
||||||
compute_work_load(&stats, priv, devfreq);
|
compute_work_load(stats, priv, devfreq);
|
||||||
/*
|
/*
|
||||||
* Do not waste CPU cycles running this algorithm if
|
* Do not waste CPU cycles running this algorithm if
|
||||||
* the GPU just started, or if less than FLOOR time
|
* the GPU just started, or if less than FLOOR time
|
||||||
* has passed since the last run or the gpu hasn't been
|
* has passed since the last run or the gpu hasn't been
|
||||||
* busier than MIN_BUSY.
|
* busier than MIN_BUSY.
|
||||||
*/
|
*/
|
||||||
if ((stats.total_time == 0) ||
|
if ((stats->total_time == 0) ||
|
||||||
(priv->bin.total_time < FLOOR) ||
|
(priv->bin.total_time < FLOOR) ||
|
||||||
(unsigned int) priv->bin.busy_time < MIN_BUSY) {
|
(unsigned int) priv->bin.busy_time < MIN_BUSY) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
level = devfreq_get_freq_level(devfreq, stats.current_frequency);
|
level = devfreq_get_freq_level(devfreq, stats->current_frequency);
|
||||||
if (level < 0) {
|
if (level < 0) {
|
||||||
pr_err(TAG "bad freq %ld\n", stats.current_frequency);
|
pr_err(TAG "bad freq %ld\n", stats->current_frequency);
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user