lcd_osk.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 <asm/gpio.h>
  25. #include <mach/hardware.h>
  26. #include <mach/mux.h>
  27. #include "omapfb.h"
  28. static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
  29. {
  30. /* gpio2 was allocated in board init */
  31. return 0;
  32. }
  33. static void osk_panel_cleanup(struct lcd_panel *panel)
  34. {
  35. }
  36. static int osk_panel_enable(struct lcd_panel *panel)
  37. {
  38. /* configure PWL pin */
  39. omap_cfg_reg(PWL);
  40. /* Enable PWL unit */
  41. omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
  42. /* Set PWL level */
  43. omap_writeb(0xFF, OMAP_PWL_ENABLE);
  44. /* set GPIO2 high (lcd power enabled) */
  45. gpio_set_value(2, 1);
  46. return 0;
  47. }
  48. static void osk_panel_disable(struct lcd_panel *panel)
  49. {
  50. /* Set PWL level to zero */
  51. omap_writeb(0x00, OMAP_PWL_ENABLE);
  52. /* Disable PWL unit */
  53. omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
  54. /* set GPIO2 low */
  55. gpio_set_value(2, 0);
  56. }
  57. static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
  58. {
  59. return 0;
  60. }
  61. struct lcd_panel osk_panel = {
  62. .name = "osk",
  63. .config = OMAP_LCDC_PANEL_TFT,
  64. .bpp = 16,
  65. .data_lines = 16,
  66. .x_res = 240,
  67. .y_res = 320,
  68. .pixel_clock = 12500,
  69. .hsw = 40,
  70. .hfp = 40,
  71. .hbp = 72,
  72. .vsw = 1,
  73. .vfp = 1,
  74. .vbp = 0,
  75. .pcd = 12,
  76. .init = osk_panel_init,
  77. .cleanup = osk_panel_cleanup,
  78. .enable = osk_panel_enable,
  79. .disable = osk_panel_disable,
  80. .get_caps = osk_panel_get_caps,
  81. };
  82. static int osk_panel_probe(struct platform_device *pdev)
  83. {
  84. omapfb_register_panel(&osk_panel);
  85. return 0;
  86. }
  87. static int osk_panel_remove(struct platform_device *pdev)
  88. {
  89. return 0;
  90. }
  91. static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
  92. {
  93. return 0;
  94. }
  95. static int osk_panel_resume(struct platform_device *pdev)
  96. {
  97. return 0;
  98. }
  99. static struct platform_driver osk_panel_driver = {
  100. .probe = osk_panel_probe,
  101. .remove = osk_panel_remove,
  102. .suspend = osk_panel_suspend,
  103. .resume = osk_panel_resume,
  104. .driver = {
  105. .name = "lcd_osk",
  106. },
  107. };
  108. module_platform_driver(osk_panel_driver);