From 548979770b46039b1f42502c18d34bbf1e0a96bb Mon Sep 17 00:00:00 2001 From: Ilan Aelion Date: Wed, 8 Aug 2012 12:25:52 -0600 Subject: 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 (cherry picked from commit f48bec5168232d7a50ecfb193146a4be214af3d7) Reviewed-on: http://git-master/r/#change,122160 Reviewed-on: http://git-master/r/123102 Reviewed-by: Bharat Nihalani Reviewed-by: Automatic_Commit_Validation_User --- drivers/misc/tegra-throughput.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/misc/tegra-throughput.c b/drivers/misc/tegra-throughput.c index bff53235a74c..26573d8afc1a 100644 --- a/drivers/misc/tegra-throughput.c +++ b/drivers/misc/tegra-throughput.c @@ -34,9 +34,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) @@ -47,7 +55,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) { @@ -66,8 +73,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; } @@ -225,6 +232,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) { @@ -242,6 +250,8 @@ void __exit throughput_exit_miscdev(void) { pr_debug("%s: exiting\n", __func__); + cancel_work_sync(&work); + misc_deregister(&throughput_miscdev); } -- cgit v1.2.3