diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2005-09-09 16:10:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:40 -0400 |
commit | ba44cd2d8abc3271a608b42cdbf55e1e575e2ba5 (patch) | |
tree | 7416f8acd8a76e5b7beddda61d03cd2a16b5bd03 /drivers | |
parent | 61ab7903b8cd772d3bfb28bc26d02c599cfb0e5b (diff) |
[PATCH] pxafb: Add hsync time reporting hook
To solve touchscreen interference problems devices like the Sharp Zaurus
SL-C3000 need to know the length of the horitzontal sync pulses. This patch
adds a hook to pxafb so the touchscreen driver can function correctly.
Signed-Off-By: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/pxafb.c | 32 | ||||
-rw-r--r-- | drivers/video/pxafb.h | 2 |
2 files changed, 34 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; |
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; |