0343-video-da8xx-fb-Add-API-to-register-wait-for-vsync-ca.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From 9a1a810516ae9cb3259b898b6879901c5b44fa90 Mon Sep 17 00:00:00 2001
  2. From: Prathap M S <msprathap@ti.com>
  3. Date: Mon, 2 Sep 2013 12:05:23 +0530
  4. Subject: [PATCH 343/752] video: da8xx-fb: Add API to register wait for vsync
  5. callback
  6. This patch adds APIs to register and unregister wait for vsync callback.
  7. This is derived from commit id 2d44302545da24fd22912d964102bc31a7489e97
  8. This commit id was part of 3.2 kernel sources.
  9. Signed-off-by: Prathap M S <msprathap@ti.com>
  10. ---
  11. drivers/video/fbdev/da8xx-fb.c | 33 +++++++++++++++++++++++++++++++++
  12. include/video/da8xx-fb.h | 4 ++++
  13. 2 files changed, 37 insertions(+)
  14. --- a/drivers/video/fbdev/da8xx-fb.c
  15. +++ b/drivers/video/fbdev/da8xx-fb.c
  16. @@ -197,6 +197,9 @@ static struct fb_fix_screeninfo da8xx_fb
  17. .accel = FB_ACCEL_NONE
  18. };
  19. +static vsync_callback_t vsync_cb_handler;
  20. +static void *vsync_cb_arg;
  21. +
  22. static struct fb_videomode known_lcd_panels[] = {
  23. /* Sharp LCD035Q3DG01 */
  24. [0] = {
  25. @@ -831,6 +834,32 @@ static int lcd_init(struct da8xx_fb_par
  26. return 0;
  27. }
  28. +int register_vsync_cb(vsync_callback_t handler, void *arg, int idx)
  29. +{
  30. + if ((vsync_cb_handler == NULL) && (vsync_cb_arg == NULL)) {
  31. + vsync_cb_arg = arg;
  32. + vsync_cb_handler = handler;
  33. + } else {
  34. + return -EEXIST;
  35. + }
  36. +
  37. + return 0;
  38. +}
  39. +EXPORT_SYMBOL(register_vsync_cb);
  40. +
  41. +int unregister_vsync_cb(vsync_callback_t handler, void *arg, int idx)
  42. +{
  43. + if ((vsync_cb_handler == handler) && (vsync_cb_arg == arg)) {
  44. + vsync_cb_handler = NULL;
  45. + vsync_cb_arg = NULL;
  46. + } else {
  47. + return -ENXIO;
  48. + }
  49. +
  50. + return 0;
  51. +}
  52. +EXPORT_SYMBOL(unregister_vsync_cb);
  53. +
  54. /* IRQ handler for version 2 of LCDC */
  55. static irqreturn_t lcdc_irq_handler_rev02(int irq, void *arg)
  56. {
  57. @@ -868,6 +897,8 @@ static irqreturn_t lcdc_irq_handler_rev0
  58. LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG);
  59. par->vsync_flag = 1;
  60. wake_up_interruptible(&par->vsync_wait);
  61. + if (vsync_cb_handler)
  62. + vsync_cb_handler(vsync_cb_arg);
  63. }
  64. if (stat & LCD_END_OF_FRAME1) {
  65. @@ -943,6 +974,8 @@ static irqreturn_t lcdc_irq_handler_rev0
  66. LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG);
  67. par->vsync_flag = 1;
  68. wake_up_interruptible(&par->vsync_wait);
  69. + if (vsync_cb_handler)
  70. + vsync_cb_handler(vsync_cb_arg);
  71. }
  72. }
  73. --- a/include/video/da8xx-fb.h
  74. +++ b/include/video/da8xx-fb.h
  75. @@ -91,5 +91,9 @@ struct lcd_sync_arg {
  76. /* Proprietary FB_SYNC_ flags */
  77. #define FB_SYNC_CLK_INVERT 0x40000000
  78. +typedef void (*vsync_callback_t)(void *arg);
  79. +int register_vsync_cb(vsync_callback_t handler, void *arg, int idx);
  80. +int unregister_vsync_cb(vsync_callback_t handler, void *arg, int idx);
  81. +
  82. #endif /* ifndef DA8XX_FB_H */