lcd_h3.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * LCD panel support for the TI OMAP H3 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/tps65010.h>
  25. #include <asm/arch/omapfb.h>
  26. #define MODULE_NAME "omapfb-lcd_h3"
  27. #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
  28. static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
  29. {
  30. return 0;
  31. }
  32. static void h3_panel_cleanup(struct lcd_panel *panel)
  33. {
  34. }
  35. static int h3_panel_enable(struct lcd_panel *panel)
  36. {
  37. int r = 0;
  38. /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
  39. r = tps65010_set_gpio_out_value(GPIO1, HIGH);
  40. if (!r)
  41. r = tps65010_set_gpio_out_value(GPIO2, HIGH);
  42. if (r)
  43. pr_err("Unable to turn on LCD panel\n");
  44. return r;
  45. }
  46. static void h3_panel_disable(struct lcd_panel *panel)
  47. {
  48. int r = 0;
  49. /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
  50. r = tps65010_set_gpio_out_value(GPIO1, LOW);
  51. if (!r)
  52. tps65010_set_gpio_out_value(GPIO2, LOW);
  53. if (r)
  54. pr_err("Unable to turn off LCD panel\n");
  55. }
  56. static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
  57. {
  58. return 0;
  59. }
  60. struct lcd_panel h3_panel = {
  61. .name = "h3",
  62. .config = OMAP_LCDC_PANEL_TFT,
  63. .data_lines = 16,
  64. .bpp = 16,
  65. .x_res = 240,
  66. .y_res = 320,
  67. .pixel_clock = 12000,
  68. .hsw = 12,
  69. .hfp = 14,
  70. .hbp = 72 - 12,
  71. .vsw = 1,
  72. .vfp = 1,
  73. .vbp = 0,
  74. .pcd = 0,
  75. .init = h3_panel_init,
  76. .cleanup = h3_panel_cleanup,
  77. .enable = h3_panel_enable,
  78. .disable = h3_panel_disable,
  79. .get_caps = h3_panel_get_caps,
  80. };
  81. static int h3_panel_probe(struct platform_device *pdev)
  82. {
  83. omapfb_register_panel(&h3_panel);
  84. return 0;
  85. }
  86. static int h3_panel_remove(struct platform_device *pdev)
  87. {
  88. return 0;
  89. }
  90. static int h3_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
  91. {
  92. return 0;
  93. }
  94. static int h3_panel_resume(struct platform_device *pdev)
  95. {
  96. return 0;
  97. }
  98. struct platform_driver h3_panel_driver = {
  99. .probe = h3_panel_probe,
  100. .remove = h3_panel_remove,
  101. .suspend = h3_panel_suspend,
  102. .resume = h3_panel_resume,
  103. .driver = {
  104. .name = "lcd_h3",
  105. .owner = THIS_MODULE,
  106. },
  107. };
  108. static int h3_panel_drv_init(void)
  109. {
  110. return platform_driver_register(&h3_panel_driver);
  111. }
  112. static void h3_panel_drv_cleanup(void)
  113. {
  114. platform_driver_unregister(&h3_panel_driver);
  115. }
  116. module_init(h3_panel_drv_init);
  117. module_exit(h3_panel_drv_cleanup);