panel-sharp-ls037v7dw01.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * LCD panel driver for Sharp LS037V7DW01
  3. *
  4. * Copyright (C) 2008 Nokia Corporation
  5. * Author: Tomi Valkeinen <tomi.valkeinen@nokia.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_ls_timings = {
  25. .x_res = 480,
  26. .y_res = 640,
  27. .pixel_clock = 19200,
  28. .hsw = 2,
  29. .hfp = 1,
  30. .hbp = 28,
  31. .vsw = 1,
  32. .vfp = 1,
  33. .vbp = 1,
  34. };
  35. static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
  36. {
  37. dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
  38. OMAP_DSS_LCD_IHS;
  39. dssdev->panel.acb = 0x28;
  40. dssdev->panel.timings = sharp_ls_timings;
  41. return 0;
  42. }
  43. static void sharp_ls_panel_remove(struct omap_dss_device *dssdev)
  44. {
  45. }
  46. static int sharp_ls_power_on(struct omap_dss_device *dssdev)
  47. {
  48. int r = 0;
  49. r = omapdss_dpi_display_enable(dssdev);
  50. if (r)
  51. goto err0;
  52. /* wait couple of vsyncs until enabling the LCD */
  53. msleep(50);
  54. if (dssdev->platform_enable) {
  55. r = dssdev->platform_enable(dssdev);
  56. if (r)
  57. goto err1;
  58. }
  59. return 0;
  60. err1:
  61. omapdss_dpi_display_disable(dssdev);
  62. err0:
  63. return r;
  64. }
  65. static void sharp_ls_power_off(struct omap_dss_device *dssdev)
  66. {
  67. if (dssdev->platform_disable)
  68. dssdev->platform_disable(dssdev);
  69. /* wait at least 5 vsyncs after disabling the LCD */
  70. msleep(100);
  71. omapdss_dpi_display_disable(dssdev);
  72. }
  73. static int sharp_ls_panel_enable(struct omap_dss_device *dssdev)
  74. {
  75. int r;
  76. r = sharp_ls_power_on(dssdev);
  77. dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
  78. return r;
  79. }
  80. static void sharp_ls_panel_disable(struct omap_dss_device *dssdev)
  81. {
  82. sharp_ls_power_off(dssdev);
  83. dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
  84. }
  85. static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev)
  86. {
  87. sharp_ls_power_off(dssdev);
  88. dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
  89. return 0;
  90. }
  91. static int sharp_ls_panel_resume(struct omap_dss_device *dssdev)
  92. {
  93. int r;
  94. r = sharp_ls_power_on(dssdev);
  95. dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
  96. return r;
  97. }
  98. static struct omap_dss_driver sharp_ls_driver = {
  99. .probe = sharp_ls_panel_probe,
  100. .remove = sharp_ls_panel_remove,
  101. .enable = sharp_ls_panel_enable,
  102. .disable = sharp_ls_panel_disable,
  103. .suspend = sharp_ls_panel_suspend,
  104. .resume = sharp_ls_panel_resume,
  105. .driver = {
  106. .name = "sharp_ls_panel",
  107. .owner = THIS_MODULE,
  108. },
  109. };
  110. static int __init sharp_ls_panel_drv_init(void)
  111. {
  112. return omap_dss_register_driver(&sharp_ls_driver);
  113. }
  114. static void __exit sharp_ls_panel_drv_exit(void)
  115. {
  116. omap_dss_unregister_driver(&sharp_ls_driver);
  117. }
  118. module_init(sharp_ls_panel_drv_init);
  119. module_exit(sharp_ls_panel_drv_exit);
  120. MODULE_LICENSE("GPL");