summaryrefslogtreecommitdiff
path: root/drivers/misc/tegra-throughput.c
diff options
context:
space:
mode:
authorIlan Aelion <iaelion@nvidia.com>2012-08-08 12:25:52 -0600
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:31:39 -0700
commit0063b7c922fa00a52131462ead171925d197a779 (patch)
tree310c43d8d4a494b1a1eeb9b68698539d6851f475 /drivers/misc/tegra-throughput.c
parent78c98ff7204d1bc4c3dfe786375bc38180b88259 (diff)
misc: throughput: move client calls to work queue
Perform throughput notifications to clients on work queue rather than synchronously to dc flip notifications. Bug 1028850 Change-Id: Ib9446a4ab87a476230a90a1f23c260bcf98e01dc Signed-off-by: Ilan Aelion <iaelion@nvidia.com> (cherry picked from commit f48bec5168232d7a50ecfb193146a4be214af3d7) Reviewed-on: http://git-master/r/#change,122160 Reviewed-on: http://git-master/r/123102 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Rebase-Id: R5be1166b40d0ce9896a9aa09559596061136a3ba
Diffstat (limited to 'drivers/misc/tegra-throughput.c')
-rw-r--r--drivers/misc/tegra-throughput.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/misc/tegra-throughput.c b/drivers/misc/tegra-throughput.c
index 501cb9267ef4..13b1c47178de 100644
--- a/drivers/misc/tegra-throughput.c
+++ b/drivers/misc/tegra-throughput.c
@@ -35,9 +35,17 @@ static unsigned short target_frame_time;
static unsigned short last_frame_time;
static ktime_t last_flip;
static unsigned int multiple_app_disable;
-
static spinlock_t lock;
+static struct work_struct work;
+static int throughput_hint;
+
+static void set_throughput_hint(struct work_struct *work)
+{
+ /* notify throughput hint clients here */
+ nvhost_scale3d_set_throughput_hint(throughput_hint);
+}
+
static int throughput_flip_notifier(struct notifier_block *nb,
unsigned long val,
void *data)
@@ -48,7 +56,6 @@ static int throughput_flip_notifier(struct notifier_block *nb,
else {
long timediff;
ktime_t now;
- int throughput_hint;
now = ktime_get();
if (last_flip.tv64 != 0) {
@@ -67,8 +74,8 @@ static int throughput_flip_notifier(struct notifier_block *nb,
throughput_hint =
((int) target_frame_time * 100)/last_frame_time;
- /* notify throughput hint clients here */
- nvhost_scale3d_set_throughput_hint(throughput_hint);
+ if (!work_pending(&work))
+ schedule_work(&work);
}
last_flip = now;
}
@@ -226,6 +233,7 @@ int __init throughput_init_miscdev(void)
pr_debug("%s: initializing\n", __func__);
spin_lock_init(&lock);
+ INIT_WORK(&work, set_throughput_hint);
ret = misc_register(&throughput_miscdev);
if (ret) {
@@ -243,6 +251,8 @@ void __exit throughput_exit_miscdev(void)
{
pr_debug("%s: exiting\n", __func__);
+ cancel_work_sync(&work);
+
misc_deregister(&throughput_miscdev);
}