lcd_omap3beagle.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * LCD panel support for the TI OMAP3 Beagle board
  3. *
  4. * Author: Koen Kooi <koen@openembedded.org>
  5. *
  6. * Derived from drivers/video/omap/lcd-omap3evm.c
  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 <linux/gpio.h>
  25. #include <linux/i2c/twl.h>
  26. #include <plat/mux.h>
  27. #include <plat/mux.h>
  28. #include <asm/mach-types.h>
  29. #include "omapfb.h"
  30. #define LCD_PANEL_ENABLE_GPIO 170
  31. static int omap3beagle_panel_init(struct lcd_panel *panel,
  32. struct omapfb_device *fbdev)
  33. {
  34. gpio_request(LCD_PANEL_ENABLE_GPIO, "LCD enable");
  35. return 0;
  36. }
  37. static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
  38. {
  39. gpio_free(LCD_PANEL_ENABLE_GPIO);
  40. }
  41. static int omap3beagle_panel_enable(struct lcd_panel *panel)
  42. {
  43. gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
  44. return 0;
  45. }
  46. static void omap3beagle_panel_disable(struct lcd_panel *panel)
  47. {
  48. gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0);
  49. }
  50. static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel)
  51. {
  52. return 0;
  53. }
  54. struct lcd_panel omap3beagle_panel = {
  55. .name = "omap3beagle",
  56. .config = OMAP_LCDC_PANEL_TFT,
  57. .bpp = 16,
  58. .data_lines = 24,
  59. .x_res = 1024,
  60. .y_res = 768,
  61. .hsw = 3, /* hsync_len (4) - 1 */
  62. .hfp = 3, /* right_margin (4) - 1 */
  63. .hbp = 39, /* left_margin (40) - 1 */
  64. .vsw = 1, /* vsync_len (2) - 1 */
  65. .vfp = 2, /* lower_margin */
  66. .vbp = 7, /* upper_margin (8) - 1 */
  67. .pixel_clock = 64000,
  68. .init = omap3beagle_panel_init,
  69. .cleanup = omap3beagle_panel_cleanup,
  70. .enable = omap3beagle_panel_enable,
  71. .disable = omap3beagle_panel_disable,
  72. .get_caps = omap3beagle_panel_get_caps,
  73. };
  74. static int omap3beagle_panel_probe(struct platform_device *pdev)
  75. {
  76. omapfb_register_panel(&omap3beagle_panel);
  77. return 0;
  78. }
  79. static int omap3beagle_panel_remove(struct platform_device *pdev)
  80. {
  81. return 0;
  82. }
  83. static int omap3beagle_panel_suspend(struct platform_device *pdev,
  84. pm_message_t mesg)
  85. {
  86. return 0;
  87. }
  88. static int omap3beagle_panel_resume(struct platform_device *pdev)
  89. {
  90. return 0;
  91. }
  92. struct platform_driver omap3beagle_panel_driver = {
  93. .probe = omap3beagle_panel_probe,
  94. .remove = omap3beagle_panel_remove,
  95. .suspend = omap3beagle_panel_suspend,
  96. .resume = omap3beagle_panel_resume,
  97. .driver = {
  98. .name = "omap3beagle_lcd",
  99. .owner = THIS_MODULE,
  100. },
  101. };
  102. static int __init omap3beagle_panel_drv_init(void)
  103. {
  104. return platform_driver_register(&omap3beagle_panel_driver);
  105. }
  106. static void __exit omap3beagle_panel_drv_exit(void)
  107. {
  108. platform_driver_unregister(&omap3beagle_panel_driver);
  109. }
  110. module_init(omap3beagle_panel_drv_init);
  111. module_exit(omap3beagle_panel_drv_exit);