lcd_osk.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * LCD panel support for the TI OMAP OSK board
  3. *
  4. * Copyright (C) 2004 Nokia Corporation
  5. * Author: Imre Deak <imre.deak@nokia.com>
  6. * Adapted for OSK by <dirk.behme@de.bosch.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. #include <linux/module.h>
  23. #include <linux/platform_device.h>
  24. #include <mach/gpio.h>
  25. #include <mach/mux.h>
  26. #include <mach/omapfb.h>
  27. static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
  28. {
  29. /* gpio2 was allocated in board init */
  30. return 0;
  31. }
  32. static void osk_panel_cleanup(struct lcd_panel *panel)
  33. {
  34. }
  35. static int osk_panel_enable(struct lcd_panel *panel)
  36. {
  37. /* configure PWL pin */
  38. omap_cfg_reg(PWL);
  39. /* Enable PWL unit */
  40. omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
  41. /* Set PWL level */
  42. omap_writeb(0xFF, OMAP_PWL_ENABLE);
  43. /* set GPIO2 high (lcd power enabled) */
  44. gpio_set_value(2, 1);
  45. return 0;
  46. }
  47. static void osk_panel_disable(struct lcd_panel *panel)
  48. {
  49. /* Set PWL level to zero */
  50. omap_writeb(0x00, OMAP_PWL_ENABLE);
  51. /* Disable PWL unit */
  52. omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
  53. /* set GPIO2 low */
  54. gpio_set_value(2, 0);
  55. }
  56. static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
  57. {
  58. return 0;
  59. }
  60. struct lcd_panel osk_panel = {
  61. .name = "osk",
  62. .config = OMAP_LCDC_PANEL_TFT,
  63. .bpp = 16,
  64. .data_lines = 16,
  65. .x_res = 240,
  66. .y_res = 320,
  67. .pixel_clock = 12500,
  68. .hsw = 40,
  69. .hfp = 40,
  70. .hbp = 72,
  71. .vsw = 1,
  72. .vfp = 1,
  73. .vbp = 0,
  74. .pcd = 12,
  75. .init = osk_panel_init,
  76. .cleanup = osk_panel_cleanup,
  77. .enable = osk_panel_enable,
  78. .disable = osk_panel_disable,
  79. .get_caps = osk_panel_get_caps,
  80. };
  81. static int osk_panel_probe(struct platform_device *pdev)
  82. {
  83. omapfb_register_panel(&osk_panel);
  84. return 0;
  85. }
  86. static int osk_panel_remove(struct platform_device *pdev)
  87. {
  88. return 0;
  89. }
  90. static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
  91. {
  92. return 0;
  93. }
  94. static int osk_panel_resume(struct platform_device *pdev)
  95. {
  96. return 0;
  97. }
  98. struct platform_driver osk_panel_driver = {
  99. .probe = osk_panel_probe,
  100. .remove = osk_panel_remove,
  101. .suspend = osk_panel_suspend,
  102. .resume = osk_panel_resume,
  103. .driver = {
  104. .name = "lcd_osk",
  105. .owner = THIS_MODULE,
  106. },
  107. };
  108. static int osk_panel_drv_init(void)
  109. {
  110. return platform_driver_register(&osk_panel_driver);
  111. }
  112. static void osk_panel_drv_cleanup(void)
  113. {
  114. platform_driver_unregister(&osk_panel_driver);
  115. }
  116. module_init(osk_panel_drv_init);
  117. module_exit(osk_panel_drv_cleanup);