lcd_inn1610.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * LCD panel support for the TI OMAP1610 Innovator board
  4. *
  5. * Copyright (C) 2004 Nokia Corporation
  6. * Author: Imre Deak <[email protected]>
  7. */
  8. #include <linux/module.h>
  9. #include <linux/platform_device.h>
  10. #include <linux/gpio.h>
  11. #include "omapfb.h"
  12. #define MODULE_NAME "omapfb-lcd_h3"
  13. static int innovator1610_panel_init(struct lcd_panel *panel,
  14. struct omapfb_device *fbdev)
  15. {
  16. int r = 0;
  17. /* configure GPIO(14, 15) as outputs */
  18. if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) {
  19. pr_err(MODULE_NAME ": can't request GPIO 14\n");
  20. r = -1;
  21. goto exit;
  22. }
  23. if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) {
  24. pr_err(MODULE_NAME ": can't request GPIO 15\n");
  25. gpio_free(14);
  26. r = -1;
  27. goto exit;
  28. }
  29. exit:
  30. return r;
  31. }
  32. static void innovator1610_panel_cleanup(struct lcd_panel *panel)
  33. {
  34. gpio_free(15);
  35. gpio_free(14);
  36. }
  37. static int innovator1610_panel_enable(struct lcd_panel *panel)
  38. {
  39. /* set GPIO14 and GPIO15 high */
  40. gpio_set_value(14, 1);
  41. gpio_set_value(15, 1);
  42. return 0;
  43. }
  44. static void innovator1610_panel_disable(struct lcd_panel *panel)
  45. {
  46. /* set GPIO13, GPIO14 and GPIO15 low */
  47. gpio_set_value(14, 0);
  48. gpio_set_value(15, 0);
  49. }
  50. static struct lcd_panel innovator1610_panel = {
  51. .name = "inn1610",
  52. .config = OMAP_LCDC_PANEL_TFT,
  53. .bpp = 16,
  54. .data_lines = 16,
  55. .x_res = 320,
  56. .y_res = 240,
  57. .pixel_clock = 12500,
  58. .hsw = 40,
  59. .hfp = 40,
  60. .hbp = 72,
  61. .vsw = 1,
  62. .vfp = 1,
  63. .vbp = 0,
  64. .pcd = 12,
  65. .init = innovator1610_panel_init,
  66. .cleanup = innovator1610_panel_cleanup,
  67. .enable = innovator1610_panel_enable,
  68. .disable = innovator1610_panel_disable,
  69. };
  70. static int innovator1610_panel_probe(struct platform_device *pdev)
  71. {
  72. omapfb_register_panel(&innovator1610_panel);
  73. return 0;
  74. }
  75. static struct platform_driver innovator1610_panel_driver = {
  76. .probe = innovator1610_panel_probe,
  77. .driver = {
  78. .name = "lcd_inn1610",
  79. },
  80. };
  81. module_platform_driver(innovator1610_panel_driver);
  82. MODULE_AUTHOR("Imre Deak");
  83. MODULE_DESCRIPTION("LCD panel support for the TI OMAP1610 Innovator board");
  84. MODULE_LICENSE("GPL");