lcd_overo.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * LCD panel support for the Gumstix Overo
  3. *
  4. * Author: Steve Sakoman <steve@sakoman.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. *
  20. */
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/i2c/twl.h>
  24. #include <mach/gpio.h>
  25. #include <plat/mux.h>
  26. #include <asm/mach-types.h>
  27. #include "omapfb.h"
  28. #define LCD_ENABLE 144
  29. static int overo_panel_init(struct lcd_panel *panel,
  30. struct omapfb_device *fbdev)
  31. {
  32. if ((gpio_request(LCD_ENABLE, "LCD_ENABLE") == 0) &&
  33. (gpio_direction_output(LCD_ENABLE, 1) == 0))
  34. gpio_export(LCD_ENABLE, 0);
  35. else
  36. printk(KERN_ERR "could not obtain gpio for LCD_ENABLE\n");
  37. return 0;
  38. }
  39. static void overo_panel_cleanup(struct lcd_panel *panel)
  40. {
  41. gpio_free(LCD_ENABLE);
  42. }
  43. static int overo_panel_enable(struct lcd_panel *panel)
  44. {
  45. gpio_set_value(LCD_ENABLE, 1);
  46. return 0;
  47. }
  48. static void overo_panel_disable(struct lcd_panel *panel)
  49. {
  50. gpio_set_value(LCD_ENABLE, 0);
  51. }
  52. static unsigned long overo_panel_get_caps(struct lcd_panel *panel)
  53. {
  54. return 0;
  55. }
  56. struct lcd_panel overo_panel = {
  57. .name = "overo",
  58. .config = OMAP_LCDC_PANEL_TFT,
  59. .bpp = 16,
  60. .data_lines = 24,
  61. #if defined CONFIG_FB_OMAP_031M3R
  62. /* 640 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */
  63. .x_res = 640,
  64. .y_res = 480,
  65. .hfp = 48,
  66. .hsw = 32,
  67. .hbp = 80,
  68. .vfp = 3,
  69. .vsw = 4,
  70. .vbp = 7,
  71. .pixel_clock = 23500,
  72. #elif defined CONFIG_FB_OMAP_048M3R
  73. /* 800 x 600 @ 60 Hz Reduced blanking VESA CVT 0.48M3-R */
  74. .x_res = 800,
  75. .y_res = 600,
  76. .hfp = 48,
  77. .hsw = 32,
  78. .hbp = 80,
  79. .vfp = 3,
  80. .vsw = 4,
  81. .vbp = 11,
  82. .pixel_clock = 35500,
  83. #elif defined CONFIG_FB_OMAP_079M3R
  84. /* 1024 x 768 @ 60 Hz Reduced blanking VESA CVT 0.79M3-R */
  85. .x_res = 1024,
  86. .y_res = 768,
  87. .hfp = 48,
  88. .hsw = 32,
  89. .hbp = 80,
  90. .vfp = 3,
  91. .vsw = 4,
  92. .vbp = 15,
  93. .pixel_clock = 56000,
  94. #elif defined CONFIG_FB_OMAP_092M9R
  95. /* 1280 x 720 @ 60 Hz Reduced blanking VESA CVT 0.92M9-R */
  96. .x_res = 1280,
  97. .y_res = 720,
  98. .hfp = 48,
  99. .hsw = 32,
  100. .hbp = 80,
  101. .vfp = 3,
  102. .vsw = 5,
  103. .vbp = 13,
  104. .pixel_clock = 64000,
  105. #else
  106. /* use 640 x 480 if no config option */
  107. /* 640 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */
  108. .x_res = 640,
  109. .y_res = 480,
  110. .hfp = 48,
  111. .hsw = 32,
  112. .hbp = 80,
  113. .vfp = 3,
  114. .vsw = 4,
  115. .vbp = 7,
  116. .pixel_clock = 23500,
  117. #endif
  118. .init = overo_panel_init,
  119. .cleanup = overo_panel_cleanup,
  120. .enable = overo_panel_enable,
  121. .disable = overo_panel_disable,
  122. .get_caps = overo_panel_get_caps,
  123. };
  124. static int overo_panel_probe(struct platform_device *pdev)
  125. {
  126. omapfb_register_panel(&overo_panel);
  127. return 0;
  128. }
  129. static int overo_panel_remove(struct platform_device *pdev)
  130. {
  131. /* omapfb does not have unregister_panel */
  132. return 0;
  133. }
  134. static struct platform_driver overo_panel_driver = {
  135. .probe = overo_panel_probe,
  136. .remove = overo_panel_remove,
  137. .driver = {
  138. .name = "overo_lcd",
  139. .owner = THIS_MODULE,
  140. },
  141. };
  142. static int __init overo_panel_drv_init(void)
  143. {
  144. return platform_driver_register(&overo_panel_driver);
  145. }
  146. static void __exit overo_panel_drv_exit(void)
  147. {
  148. platform_driver_unregister(&overo_panel_driver);
  149. }
  150. module_init(overo_panel_drv_init);
  151. module_exit(overo_panel_drv_exit);