panel-sharp-lq043t1dg01.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * LCD panel driver for Sharp LQ043T1DG01
  3. *
  4. * Copyright (C) 2009 Texas Instruments Inc
  5. * Author: Vaibhav Hiremath <hvaibhav@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published by
  9. * the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/module.h>
  20. #include <linux/delay.h>
  21. #include <linux/device.h>
  22. #include <linux/err.h>
  23. #include <plat/display.h>
  24. static struct omap_video_timings sharp_lq_timings = {
  25. .x_res = 480,
  26. .y_res = 272,
  27. .pixel_clock = 9000,
  28. .hsw = 42,
  29. .hfp = 3,
  30. .hbp = 2,
  31. .vsw = 11,
  32. .vfp = 3,
  33. .vbp = 2,
  34. };
  35. static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev)
  36. {
  37. int r;
  38. r = omapdss_dpi_display_enable(dssdev);
  39. if (r)
  40. goto err0;
  41. /* wait couple of vsyncs until enabling the LCD */
  42. msleep(50);
  43. if (dssdev->platform_enable) {
  44. r = dssdev->platform_enable(dssdev);
  45. if (r)
  46. goto err1;
  47. }
  48. return 0;
  49. err1:
  50. omapdss_dpi_display_disable(dssdev);
  51. err0:
  52. return r;
  53. }
  54. static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev)
  55. {
  56. if (dssdev->platform_disable)
  57. dssdev->platform_disable(dssdev);
  58. /* wait at least 5 vsyncs after disabling the LCD */
  59. msleep(100);
  60. omapdss_dpi_display_disable(dssdev);
  61. }
  62. static int sharp_lq_panel_probe(struct omap_dss_device *dssdev)
  63. {
  64. dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
  65. OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO;
  66. dssdev->panel.acb = 0x0;
  67. dssdev->panel.timings = sharp_lq_timings;
  68. return 0;
  69. }
  70. static void sharp_lq_panel_remove(struct omap_dss_device *dssdev)
  71. {
  72. }
  73. static int sharp_lq_panel_enable(struct omap_dss_device *dssdev)
  74. {
  75. int r = 0;
  76. r = sharp_lq_panel_power_on(dssdev);
  77. if (r)
  78. return r;
  79. dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
  80. return 0;
  81. }
  82. static void sharp_lq_panel_disable(struct omap_dss_device *dssdev)
  83. {
  84. sharp_lq_panel_power_off(dssdev);
  85. dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
  86. }
  87. static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev)
  88. {
  89. sharp_lq_panel_power_off(dssdev);
  90. dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
  91. return 0;
  92. }
  93. static int sharp_lq_panel_resume(struct omap_dss_device *dssdev)
  94. {
  95. int r = 0;
  96. r = sharp_lq_panel_power_on(dssdev);
  97. if (r)
  98. return r;
  99. dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
  100. return 0;
  101. }
  102. static struct omap_dss_driver sharp_lq_driver = {
  103. .probe = sharp_lq_panel_probe,
  104. .remove = sharp_lq_panel_remove,
  105. .enable = sharp_lq_panel_enable,
  106. .disable = sharp_lq_panel_disable,
  107. .suspend = sharp_lq_panel_suspend,
  108. .resume = sharp_lq_panel_resume,
  109. .driver = {
  110. .name = "sharp_lq_panel",
  111. .owner = THIS_MODULE,
  112. },
  113. };
  114. static int __init sharp_lq_panel_drv_init(void)
  115. {
  116. return omap_dss_register_driver(&sharp_lq_driver);
  117. }
  118. static void __exit sharp_lq_panel_drv_exit(void)
  119. {
  120. omap_dss_unregister_driver(&sharp_lq_driver);
  121. }
  122. module_init(sharp_lq_panel_drv_init);
  123. module_exit(sharp_lq_panel_drv_exit);
  124. MODULE_LICENSE("GPL");