diff options
Diffstat (limited to 'drivers/video/pxafb.c')
| -rw-r--r-- | drivers/video/pxafb.c | 32 |
1 files changed, 32 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 | */ | ||
| 474 | static 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 | |||
| 488 | unsigned 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 | } | ||
| 498 | EXPORT_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; |
