summaryrefslogtreecommitdiff
path: root/drivers/misc/tegra-throughput.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/tegra-throughput.c')
-rw-r--r--drivers/misc/tegra-throughput.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/drivers/misc/tegra-throughput.c b/drivers/misc/tegra-throughput.c
index 26573d8afc1a..366b0ecc10e6 100644
--- a/drivers/misc/tegra-throughput.c
+++ b/drivers/misc/tegra-throughput.c
@@ -19,7 +19,6 @@
#include <linux/kthread.h>
#include <linux/ktime.h>
-#include <linux/notifier.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/init.h>
@@ -45,12 +44,10 @@ static void set_throughput_hint(struct work_struct *work)
nvhost_scale3d_set_throughput_hint(throughput_hint);
}
-static int throughput_flip_notifier(struct notifier_block *nb,
- unsigned long val,
- void *data)
+static int throughput_flip_callback(void)
{
- /* only register flips when a single display is active */
- if (val != 1 || multiple_app_disable)
+ /* only register flips when a single app is active */
+ if (multiple_app_disable)
return NOTIFY_DONE;
else {
long timediff;
@@ -65,7 +62,7 @@ static int throughput_flip_notifier(struct notifier_block *nb,
last_frame_time = (unsigned short) timediff;
if (last_frame_time == 0) {
- pr_warn("%s: notifications %lld nsec apart\n",
+ pr_warn("%s: flips %lld nsec apart\n",
__func__, now.tv64 - last_flip.tv64);
return NOTIFY_DONE;
}
@@ -82,10 +79,6 @@ static int throughput_flip_notifier(struct notifier_block *nb,
return NOTIFY_OK;
}
-static struct notifier_block throughput_flip_nb = {
- .notifier_call = throughput_flip_notifier,
-};
-
static int sync_rate;
static int throughput_active_app_count;
@@ -104,17 +97,15 @@ static void reset_target_frame_time(void)
__func__, sync_rate, target_frame_time);
}
-static int notifier_initialized;
+static int callback_initialized;
static int throughput_open(struct inode *inode, struct file *file)
{
- int need_init = 0;
-
spin_lock(&lock);
- if (!notifier_initialized) {
- notifier_initialized = 1;
- need_init = 1;
+ if (!callback_initialized) {
+ callback_initialized = 1;
+ tegra_dc_set_flip_callback(throughput_flip_callback);
}
throughput_active_app_count++;
@@ -123,8 +114,6 @@ static int throughput_open(struct inode *inode, struct file *file)
spin_unlock(&lock);
- if (need_init)
- tegra_dc_register_flip_notifier(&throughput_flip_nb);
pr_debug("throughput_open node %p file %p\n", inode, file);
@@ -133,23 +122,18 @@ static int throughput_open(struct inode *inode, struct file *file)
static int throughput_release(struct inode *inode, struct file *file)
{
- int need_deinit = 0;
-
spin_lock(&lock);
throughput_active_app_count--;
if (throughput_active_app_count == 0) {
reset_target_frame_time();
multiple_app_disable = 0;
- notifier_initialized = 0;
- need_deinit = 1;
+ callback_initialized = 0;
+ tegra_dc_unset_flip_callback();
}
spin_unlock(&lock);
- if (need_deinit)
- tegra_dc_unregister_flip_notifier(&throughput_flip_nb);
-
pr_debug("throughput_release node %p file %p\n", inode, file);
return 0;