lcd_osk.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * LCD panel support for the TI OMAP OSK board
  3. *
  4. * Copyright (C) 2004 Nokia Corporation
  5. * Author: Imre Deak <imre.deak@nokia.com>
  6. * Adapted for OSK by <dirk.behme@de.bosch.com>
  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 <mach/hardware.h>
  26. #include <mach/mux.h>
  27. #include "omapfb.h"
  28. static int osk_panel_enable(struct lcd_panel *panel)
  29. {
  30. /* configure PWL pin */
  31. omap_cfg_reg(PWL);
  32. /* Enable PWL unit */
  33. omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
  34. /* Set PWL level */
  35. omap_writeb(0xFF, OMAP_PWL_ENABLE);
  36. /* set GPIO2 high (lcd power enabled) */
  37. gpio_set_value(2, 1);
  38. return 0;
  39. }
  40. static void osk_panel_disable(struct lcd_panel *panel)
  41. {
  42. /* Set PWL level to zero */
  43. omap_writeb(0x00, OMAP_PWL_ENABLE);
  44. /* Disable PWL unit */
  45. omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
  46. /* set GPIO2 low */
  47. gpio_set_value(2, 0);
  48. }
  49. static struct lcd_panel osk_panel = {
  50. .name = "osk",
  51. .config = OMAP_LCDC_PANEL_TFT,
  52. .bpp = 16,
  53. .data_lines = 16,
  54. .x_res = 240,
  55. .y_res = 320,
  56. .pixel_clock = 12500,
  57. .hsw = 40,
  58. .hfp = 40,
  59. .hbp = 72,
  60. .vsw = 1,
  61. .vfp = 1,
  62. .vbp = 0,
  63. .pcd = 12,
  64. .enable = osk_panel_enable,
  65. .disable = osk_panel_disable,
  66. };
  67. static int osk_panel_probe(struct platform_device *pdev)
  68. {
  69. omapfb_register_panel(&osk_panel);
  70. return 0;
  71. }
  72. static struct platform_driver osk_panel_driver = {
  73. .probe = osk_panel_probe,
  74. .driver = {
  75. .name = "lcd_osk",
  76. },
  77. };
  78. module_platform_driver(osk_panel_driver);
  79. MODULE_AUTHOR("Imre Deak");
  80. MODULE_DESCRIPTION("LCD panel support for the TI OMAP OSK board");
  81. MODULE_LICENSE("GPL");