#include <governor.h>
+#include "nvhost_acm.h"
#include "scale3d.h"
#include "pod_scaling.h"
#include "dev.h"
struct podgov_info_rec *podgov =
container_of(work, struct podgov_info_rec, work);
struct devfreq *df = podgov->power_manager;
+ struct platform_device *pdev = to_platform_device(df->dev.parent);
unsigned long freq;
+ /* make sure the device is alive before doing any scaling */
+ nvhost_module_busy(pdev);
mutex_lock(&df->lock);
- if (!podgov->enable) {
- mutex_unlock(&df->lock);
- return;
- }
- if (podgov->scale == 0) {
- mutex_unlock(&df->lock);
- return;
- }
+ if (!podgov->enable)
+ goto exit_unlock;
+
+ if (podgov->scale == 0)
+ goto exit_unlock;
freq = podgov->scale * (df->previous_freq / 100);
scaling_limit(df, &freq);
update_devfreq(df);
}
+exit_unlock:
mutex_unlock(&df->lock);
+ nvhost_module_idle(pdev);
}
/*******************************************************************************
if (!df)
return;
+ /* make sure the device is alive before doing any scaling */
+ nvhost_module_busy(d);
mutex_lock(&df->lock);
+
podgov = df->data;
trace_podgov_enabled(enable);
podgov->adjustment_type = ADJUSTMENT_LOCAL;
update_devfreq(df);
}
+
mutex_unlock(&df->lock);
+ nvhost_module_idle(d);
if (cancel)
cancel_work_sync(&podgov->work);
if (!df)
return;
+ nvhost_module_busy(d);
mutex_lock(&df->lock);
podgov = df->data;
podgov->p_user = user;
mutex_unlock(&df->lock);
+ nvhost_module_idle(d);
if (cancel)
cancel_work_sync(&podgov->work);
if (!df)
return;
+ nvhost_module_busy(d);
mutex_lock(&df->lock);
+
podgov = df->data;
trace_podgov_set_freq_request(freq_request);
}
mutex_unlock(&df->lock);
+ nvhost_module_idle(d);
}
/*******************************************************************************
container_of(nb, struct podgov_info_rec,
throughput_hint_notifier);
struct devfreq *df;
-
+ struct platform_device *pdev;
int hint = tegra_throughput_get_hint();
long idle;
long curr, target;
if (!df)
return NOTIFY_DONE;
+ pdev = to_platform_device(df->dev.parent);
+
+ /* make sure the device is alive before doing any scaling */
+ nvhost_module_busy(pdev);
mutex_lock(&podgov->power_manager->lock);
podgov->block--;
if (!podgov->enable ||
!podgov->p_use_throughput_hint ||
- podgov->block > 0) {
- mutex_unlock(&podgov->power_manager->lock);
- return NOTIFY_DONE;
- }
+ podgov->block > 0)
+ goto exit_unlock;
trace_podgov_hint(podgov->idle_estimate, hint);
podgov->last_throughput_hint = ktime_get();
trace_podgov_print_target(idle, avg_idle, curr / 1000000, target, hint,
avg_hint);
+exit_unlock:
mutex_unlock(&podgov->power_manager->lock);
+ nvhost_module_idle(pdev);
return NOTIFY_OK;
}