lcd_inn1610.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 <linux/gpio.h>
  24. #include "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. /* configure GPIO(14, 15) as outputs */
  31. if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) {
  32. pr_err(MODULE_NAME ": can't request GPIO 14\n");
  33. r = -1;
  34. goto exit;
  35. }
  36. if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) {
  37. pr_err(MODULE_NAME ": can't request GPIO 15\n");
  38. gpio_free(14);
  39. r = -1;
  40. goto exit;
  41. }
  42. exit:
  43. return r;
  44. }
  45. static void innovator1610_panel_cleanup(struct lcd_panel *panel)
  46. {
  47. gpio_free(15);
  48. gpio_free(14);
  49. }
  50. static int innovator1610_panel_enable(struct lcd_panel *panel)
  51. {
  52. /* set GPIO14 and GPIO15 high */
  53. gpio_set_value(14, 1);
  54. gpio_set_value(15, 1);
  55. return 0;
  56. }
  57. static void innovator1610_panel_disable(struct lcd_panel *panel)
  58. {
  59. /* set GPIO13, GPIO14 and GPIO15 low */
  60. gpio_set_value(14, 0);
  61. gpio_set_value(15, 0);
  62. }
  63. static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
  64. {
  65. return 0;
  66. }
  67. struct lcd_panel innovator1610_panel = {
  68. .name = "inn1610",
  69. .config = OMAP_LCDC_PANEL_TFT,
  70. .bpp = 16,
  71. .data_lines = 16,
  72. .x_res = 320,
  73. .y_res = 240,
  74. .pixel_clock = 12500,
  75. .hsw = 40,
  76. .hfp = 40,
  77. .hbp = 72,
  78. .vsw = 1,
  79. .vfp = 1,
  80. .vbp = 0,
  81. .pcd = 12,
  82. .init = innovator1610_panel_init,
  83. .cleanup = innovator1610_panel_cleanup,
  84. .enable = innovator1610_panel_enable,
  85. .disable = innovator1610_panel_disable,
  86. .get_caps = innovator1610_panel_get_caps,
  87. };
  88. static int innovator1610_panel_probe(struct platform_device *pdev)
  89. {
  90. omapfb_register_panel(&innovator1610_panel);
  91. return 0;
  92. }
  93. static int innovator1610_panel_remove(struct platform_device *pdev)
  94. {
  95. return 0;
  96. }
  97. static int innovator1610_panel_suspend(struct platform_device *pdev,
  98. pm_message_t mesg)
  99. {
  100. return 0;
  101. }
  102. static int innovator1610_panel_resume(struct platform_device *pdev)
  103. {
  104. return 0;
  105. }
  106. static struct platform_driver innovator1610_panel_driver = {
  107. .probe = innovator1610_panel_probe,
  108. .remove = innovator1610_panel_remove,
  109. .suspend = innovator1610_panel_suspend,
  110. .resume = innovator1610_panel_resume,
  111. .driver = {
  112. .name = "lcd_inn1610",
  113. },
  114. };
  115. module_platform_driver(innovator1610_panel_driver);