summaryrefslogtreecommitdiff
path: root/drivers/video/mxsfb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/mxsfb.c')
-rw-r--r--drivers/video/mxsfb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index c9fcd8d0af0d..079da2c43f58 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -56,6 +56,7 @@
#include <linux/regulator/consumer.h>
#include <video/of_display_timing.h>
#include <video/videomode.h>
+#include <linux/uaccess.h>
#include "mxc/mxc_dispdrv.h"
@@ -203,6 +204,7 @@ struct mxsfb_info {
struct regulator *reg_lcd;
bool wait4vsync;
struct completion vsync_complete;
+ ktime_t vsync_nf_timestamp;
struct semaphore flip_sem;
int cur_blank;
int restore_blank;
@@ -373,6 +375,7 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *dev_id)
writel(CTRL1_VSYNC_EDGE_IRQ_EN,
host->base + LCDC_CTRL1 + REG_CLR);
host->wait4vsync = 0;
+ host->vsync_nf_timestamp = ktime_get();
complete(&host->vsync_complete);
}
@@ -786,7 +789,16 @@ static int mxsfb_ioctl(struct fb_info *fb_info, unsigned int cmd,
switch (cmd) {
case MXCFB_WAIT_FOR_VSYNC:
- ret = mxsfb_wait_for_vsync(fb_info);
+ {
+ long long timestamp;
+ struct mxsfb_info *host = to_imxfb_host(fb_info);
+ ret = mxsfb_wait_for_vsync(fb_info);
+ timestamp = ktime_to_ns(host->vsync_nf_timestamp);
+ if ((ret == 0) && copy_to_user((void *)arg,
+ &timestamp, sizeof(timestamp))) {
+ ret = -EFAULT;
+ }
+ }
break;
default:
break;