lcd_h3.c 2.9 KB

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