lcd_inn1610.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 <asm/arch/gpio.h>
  24. #include <asm/arch/omapfb.h>
  25. #define MODULE_NAME "omapfb-lcd_h3"
  26. #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
  27. static int innovator1610_panel_init(struct lcd_panel *panel,
  28. struct omapfb_device *fbdev)
  29. {
  30. int r = 0;
  31. if (omap_request_gpio(14)) {
  32. pr_err("can't request GPIO 14\n");
  33. r = -1;
  34. goto exit;
  35. }
  36. if (omap_request_gpio(15)) {
  37. pr_err("can't request GPIO 15\n");
  38. omap_free_gpio(14);
  39. r = -1;
  40. goto exit;
  41. }
  42. /* configure GPIO(14, 15) as outputs */
  43. omap_set_gpio_direction(14, 0);
  44. omap_set_gpio_direction(15, 0);
  45. exit:
  46. return r;
  47. }
  48. static void innovator1610_panel_cleanup(struct lcd_panel *panel)
  49. {
  50. omap_free_gpio(15);
  51. omap_free_gpio(14);
  52. }
  53. static int innovator1610_panel_enable(struct lcd_panel *panel)
  54. {
  55. /* set GPIO14 and GPIO15 high */
  56. omap_set_gpio_dataout(14, 1);
  57. omap_set_gpio_dataout(15, 1);
  58. return 0;
  59. }
  60. static void innovator1610_panel_disable(struct lcd_panel *panel)
  61. {
  62. /* set GPIO13, GPIO14 and GPIO15 low */
  63. omap_set_gpio_dataout(14, 0);
  64. omap_set_gpio_dataout(15, 0);
  65. }
  66. static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
  67. {
  68. return 0;
  69. }
  70. struct lcd_panel innovator1610_panel = {
  71. .name = "inn1610",
  72. .config = OMAP_LCDC_PANEL_TFT,
  73. .bpp = 16,
  74. .data_lines = 16,
  75. .x_res = 320,
  76. .y_res = 240,
  77. .pixel_clock = 12500,
  78. .hsw = 40,
  79. .hfp = 40,
  80. .hbp = 72,
  81. .vsw = 1,
  82. .vfp = 1,
  83. .vbp = 0,
  84. .pcd = 12,
  85. .init = innovator1610_panel_init,
  86. .cleanup = innovator1610_panel_cleanup,
  87. .enable = innovator1610_panel_enable,
  88. .disable = innovator1610_panel_disable,
  89. .get_caps = innovator1610_panel_get_caps,
  90. };
  91. static int innovator1610_panel_probe(struct platform_device *pdev)
  92. {
  93. omapfb_register_panel(&innovator1610_panel);
  94. return 0;
  95. }
  96. static int innovator1610_panel_remove(struct platform_device *pdev)
  97. {
  98. return 0;
  99. }
  100. static int innovator1610_panel_suspend(struct platform_device *pdev,
  101. pm_message_t mesg)
  102. {
  103. return 0;
  104. }
  105. static int innovator1610_panel_resume(struct platform_device *pdev)
  106. {
  107. return 0;
  108. }
  109. struct platform_driver innovator1610_panel_driver = {
  110. .probe = innovator1610_panel_probe,
  111. .remove = innovator1610_panel_remove,
  112. .suspend = innovator1610_panel_suspend,
  113. .resume = innovator1610_panel_resume,
  114. .driver = {
  115. .name = "lcd_inn1610",
  116. .owner = THIS_MODULE,
  117. },
  118. };
  119. static int innovator1610_panel_drv_init(void)
  120. {
  121. return platform_driver_register(&innovator1610_panel_driver);
  122. }
  123. static void innovator1610_panel_drv_cleanup(void)
  124. {
  125. platform_driver_unregister(&innovator1610_panel_driver);
  126. }
  127. module_init(innovator1610_panel_drv_init);
  128. module_exit(innovator1610_panel_drv_cleanup);