lcd_inn1610.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * LCD panel support for the TI OMAP1610 Innovator board
  3. *
  4. * Copyright (C) 2004 Nokia Corporation
  5. * Author: Imre Deak <imre.deak@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 as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program; if not, write to the Free Software Foundation, Inc.,
  19. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <mach/gpio.h>
  24. #include <mach/omapfb.h>
  25. #define MODULE_NAME "omapfb-lcd_h3"
  26. static int innovator1610_panel_init(struct lcd_panel *panel,
  27. struct omapfb_device *fbdev)
  28. {
  29. int r = 0;
  30. if (omap_request_gpio(14)) {
  31. pr_err(MODULE_NAME ": can't request GPIO 14\n");
  32. r = -1;
  33. goto exit;
  34. }
  35. if (omap_request_gpio(15)) {
  36. pr_err(MODULE_NAME ": can't request GPIO 15\n");
  37. omap_free_gpio(14);
  38. r = -1;
  39. goto exit;
  40. }
  41. /* configure GPIO(14, 15) as outputs */
  42. omap_set_gpio_direction(14, 0);
  43. omap_set_gpio_direction(15, 0);
  44. exit:
  45. return r;
  46. }
  47. static void innovator1610_panel_cleanup(struct lcd_panel *panel)
  48. {
  49. omap_free_gpio(15);
  50. omap_free_gpio(14);
  51. }
  52. static int innovator1610_panel_enable(struct lcd_panel *panel)
  53. {
  54. /* set GPIO14 and GPIO15 high */
  55. omap_set_gpio_dataout(14, 1);
  56. omap_set_gpio_dataout(15, 1);
  57. return 0;
  58. }
  59. static void innovator1610_panel_disable(struct lcd_panel *panel)
  60. {
  61. /* set GPIO13, GPIO14 and GPIO15 low */
  62. omap_set_gpio_dataout(14, 0);
  63. omap_set_gpio_dataout(15, 0);
  64. }
  65. static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
  66. {
  67. return 0;
  68. }
  69. struct lcd_panel innovator1610_panel = {
  70. .name = "inn1610",
  71. .config = OMAP_LCDC_PANEL_TFT,
  72. .bpp = 16,
  73. .data_lines = 16,
  74. .x_res = 320,
  75. .y_res = 240,
  76. .pixel_clock = 12500,
  77. .hsw = 40,
  78. .hfp = 40,
  79. .hbp = 72,
  80. .vsw = 1,
  81. .vfp = 1,
  82. .vbp = 0,
  83. .pcd = 12,
  84. .init = innovator1610_panel_init,
  85. .cleanup = innovator1610_panel_cleanup,
  86. .enable = innovator1610_panel_enable,
  87. .disable = innovator1610_panel_disable,
  88. .get_caps = innovator1610_panel_get_caps,
  89. };
  90. static int innovator1610_panel_probe(struct platform_device *pdev)
  91. {
  92. omapfb_register_panel(&innovator1610_panel);
  93. return 0;
  94. }
  95. static int innovator1610_panel_remove(struct platform_device *pdev)
  96. {
  97. return 0;
  98. }
  99. static int innovator1610_panel_suspend(struct platform_device *pdev,
  100. pm_message_t mesg)
  101. {
  102. return 0;
  103. }
  104. static int innovator1610_panel_resume(struct platform_device *pdev)
  105. {
  106. return 0;
  107. }
  108. struct platform_driver innovator1610_panel_driver = {
  109. .probe = innovator1610_panel_probe,
  110. .remove = innovator1610_panel_remove,
  111. .suspend = innovator1610_panel_suspend,
  112. .resume = innovator1610_panel_resume,
  113. .driver = {
  114. .name = "lcd_inn1610",
  115. .owner = THIS_MODULE,
  116. },
  117. };
  118. static int innovator1610_panel_drv_init(void)
  119. {
  120. return platform_driver_register(&innovator1610_panel_driver);
  121. }
  122. static void innovator1610_panel_drv_cleanup(void)
  123. {
  124. platform_driver_unregister(&innovator1610_panel_driver);
  125. }
  126. module_init(innovator1610_panel_drv_init);
  127. module_exit(innovator1610_panel_drv_cleanup);