aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/pxafb.c32
-rw-r--r--drivers/video/pxafb.h2
-rw-r--r--include/asm-arm/arch-pxa/pxafb.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 30112816420c..34d4dcc0320a 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -468,6 +468,36 @@ static inline unsigned int get_pcd(unsigned int pixclock)
468} 468}
469 469
470/* 470/*
471 * Some touchscreens need hsync information from the video driver to
472 * function correctly. We export it here.
473 */
474static inline void set_hsync_time(struct pxafb_info *fbi, unsigned int pcd)
475{
476 unsigned long long htime;
477
478 if ((pcd == 0) || (fbi->fb.var.hsync_len == 0)) {
479 fbi->hsync_time=0;
480 return;
481 }
482
483 htime = (unsigned long long)get_lcdclk_frequency_10khz() * 10000;
484 do_div(htime, pcd * fbi->fb.var.hsync_len);
485 fbi->hsync_time = htime;
486}
487
488unsigned long pxafb_get_hsync_time(struct device *dev)
489{
490 struct pxafb_info *fbi = dev_get_drvdata(dev);
491
492 /* If display is blanked/suspended, hsync isn't active */
493 if (!fbi || (fbi->state != C_ENABLE))
494 return 0;
495
496 return fbi->hsync_time;
497}
498EXPORT_SYMBOL(pxafb_get_hsync_time);
499
500/*
471 * pxafb_activate_var(): 501 * pxafb_activate_var():
472 * Configures LCD Controller based on entries in var parameter. Settings are 502 * Configures LCD Controller based on entries in var parameter. Settings are
473 * only written to the controller if changes were made. 503 * only written to the controller if changes were made.
@@ -631,6 +661,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info *
631 fbi->reg_lccr1 = new_regs.lccr1; 661 fbi->reg_lccr1 = new_regs.lccr1;
632 fbi->reg_lccr2 = new_regs.lccr2; 662 fbi->reg_lccr2 = new_regs.lccr2;
633 fbi->reg_lccr3 = new_regs.lccr3; 663 fbi->reg_lccr3 = new_regs.lccr3;
664 set_hsync_time(fbi, pcd);
634 local_irq_restore(flags); 665 local_irq_restore(flags);
635 666
636 /* 667 /*
@@ -907,6 +938,7 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data)
907 938
908 case CPUFREQ_POSTCHANGE: 939 case CPUFREQ_POSTCHANGE:
909 pcd = get_pcd(fbi->fb.var.pixclock); 940 pcd = get_pcd(fbi->fb.var.pixclock);
941 set_hsync_time(fbi, pcd);
910 fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd); 942 fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd);
911 set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE); 943 set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE);
912 break; 944 break;
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h
index de15fec5f82f..22c00be786a8 100644
--- a/drivers/video/pxafb.h
+++ b/drivers/video/pxafb.h
@@ -83,6 +83,8 @@ struct pxafb_info {
83 u_int reg_lccr2; 83 u_int reg_lccr2;
84 u_int reg_lccr3; 84 u_int reg_lccr3;
85 85
86 unsigned long hsync_time;
87
86 volatile u_char state; 88 volatile u_char state;
87 volatile u_char task_state; 89 volatile u_char task_state;
88 struct semaphore ctrlr_sem; 90 struct semaphore ctrlr_sem;
diff --git a/include/asm-arm/arch-pxa/pxafb.h b/include/asm-arm/arch-pxa/pxafb.h
index 27d71e9d413b..21c0e16dce5f 100644
--- a/include/asm-arm/arch-pxa/pxafb.h
+++ b/include/asm-arm/arch-pxa/pxafb.h
@@ -66,3 +66,4 @@ struct pxafb_mach_info {
66 66
67}; 67};
68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 68void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
69unsigned long pxafb_get_hsync_time(struct device *dev);