dss-common.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * Copyright (C) 2012 Texas Instruments, Inc..
  3. * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * version 2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  17. * 02110-1301 USA
  18. *
  19. */
  20. /*
  21. * NOTE: this is a transitional file to help with DT adaptation.
  22. * This file will be removed when DSS supports DT.
  23. */
  24. #include <linux/kernel.h>
  25. #include <linux/gpio.h>
  26. #include <linux/platform_device.h>
  27. #include <video/omapdss.h>
  28. #include <video/omap-panel-data.h>
  29. #include "soc.h"
  30. #include "dss-common.h"
  31. #include "mux.h"
  32. #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
  33. #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
  34. #define HDMI_GPIO_HPD 63 /* Hotplug detect */
  35. #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
  36. /* DVI Connector */
  37. static struct connector_dvi_platform_data omap4_panda_dvi_connector_pdata = {
  38. .name = "dvi",
  39. .source = "tfp410.0",
  40. .i2c_bus_num = 2,
  41. };
  42. static struct platform_device omap4_panda_dvi_connector_device = {
  43. .name = "connector-dvi",
  44. .id = 0,
  45. .dev.platform_data = &omap4_panda_dvi_connector_pdata,
  46. };
  47. /* TFP410 DPI-to-DVI chip */
  48. static struct encoder_tfp410_platform_data omap4_panda_tfp410_pdata = {
  49. .name = "tfp410.0",
  50. .source = "dpi.0",
  51. .data_lines = 24,
  52. .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
  53. };
  54. static struct platform_device omap4_panda_tfp410_device = {
  55. .name = "tfp410",
  56. .id = 0,
  57. .dev.platform_data = &omap4_panda_tfp410_pdata,
  58. };
  59. /* HDMI Connector */
  60. static struct connector_hdmi_platform_data omap4_panda_hdmi_connector_pdata = {
  61. .name = "hdmi",
  62. .source = "tpd12s015.0",
  63. };
  64. static struct platform_device omap4_panda_hdmi_connector_device = {
  65. .name = "connector-hdmi",
  66. .id = 0,
  67. .dev.platform_data = &omap4_panda_hdmi_connector_pdata,
  68. };
  69. /* TPD12S015 HDMI ESD protection & level shifter chip */
  70. static struct encoder_tpd12s015_platform_data omap4_panda_tpd_pdata = {
  71. .name = "tpd12s015.0",
  72. .source = "hdmi.0",
  73. .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
  74. .ls_oe_gpio = HDMI_GPIO_LS_OE,
  75. .hpd_gpio = HDMI_GPIO_HPD,
  76. };
  77. static struct platform_device omap4_panda_tpd_device = {
  78. .name = "tpd12s015",
  79. .id = 0,
  80. .dev.platform_data = &omap4_panda_tpd_pdata,
  81. };
  82. static struct omap_dss_board_info omap4_panda_dss_data = {
  83. .default_display_name = "dvi",
  84. };
  85. void __init omap4_panda_display_init_of(void)
  86. {
  87. omap_display_init(&omap4_panda_dss_data);
  88. platform_device_register(&omap4_panda_tfp410_device);
  89. platform_device_register(&omap4_panda_dvi_connector_device);
  90. platform_device_register(&omap4_panda_tpd_device);
  91. platform_device_register(&omap4_panda_hdmi_connector_device);
  92. }
  93. /* OMAP4 Blaze display data */
  94. #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
  95. #define DLP_POWER_ON_GPIO 40
  96. static struct panel_dsicm_platform_data dsi1_panel = {
  97. .name = "lcd",
  98. .source = "dsi.0",
  99. .reset_gpio = 102,
  100. .use_ext_te = false,
  101. .ext_te_gpio = 101,
  102. .pin_config = {
  103. .num_pins = 6,
  104. .pins = { 0, 1, 2, 3, 4, 5 },
  105. },
  106. };
  107. static struct platform_device sdp4430_lcd_device = {
  108. .name = "panel-dsi-cm",
  109. .id = 0,
  110. .dev.platform_data = &dsi1_panel,
  111. };
  112. static struct panel_dsicm_platform_data dsi2_panel = {
  113. .name = "lcd2",
  114. .source = "dsi.1",
  115. .reset_gpio = 104,
  116. .use_ext_te = false,
  117. .ext_te_gpio = 103,
  118. .pin_config = {
  119. .num_pins = 6,
  120. .pins = { 0, 1, 2, 3, 4, 5 },
  121. },
  122. };
  123. static struct platform_device sdp4430_lcd2_device = {
  124. .name = "panel-dsi-cm",
  125. .id = 1,
  126. .dev.platform_data = &dsi2_panel,
  127. };
  128. /* HDMI Connector */
  129. static struct connector_hdmi_platform_data sdp4430_hdmi_connector_pdata = {
  130. .name = "hdmi",
  131. .source = "tpd12s015.0",
  132. };
  133. static struct platform_device sdp4430_hdmi_connector_device = {
  134. .name = "connector-hdmi",
  135. .id = 0,
  136. .dev.platform_data = &sdp4430_hdmi_connector_pdata,
  137. };
  138. /* TPD12S015 HDMI ESD protection & level shifter chip */
  139. static struct encoder_tpd12s015_platform_data sdp4430_tpd_pdata = {
  140. .name = "tpd12s015.0",
  141. .source = "hdmi.0",
  142. .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
  143. .ls_oe_gpio = HDMI_GPIO_LS_OE,
  144. .hpd_gpio = HDMI_GPIO_HPD,
  145. };
  146. static struct platform_device sdp4430_tpd_device = {
  147. .name = "tpd12s015",
  148. .id = 0,
  149. .dev.platform_data = &sdp4430_tpd_pdata,
  150. };
  151. static struct omap_dss_board_info sdp4430_dss_data = {
  152. .default_display_name = "lcd",
  153. };
  154. /*
  155. * we select LCD2 by default (instead of Pico DLP) by setting DISPLAY_SEL_GPIO.
  156. * Setting DLP_POWER_ON gpio enables the VDLP_2V5 VDLP_1V8 and VDLP_1V0 rails
  157. * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is
  158. * selected by default
  159. */
  160. void __init omap_4430sdp_display_init_of(void)
  161. {
  162. int r;
  163. r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
  164. "display_sel");
  165. if (r)
  166. pr_err("%s: Could not get display_sel GPIO\n", __func__);
  167. r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
  168. "DLP POWER ON");
  169. if (r)
  170. pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__);
  171. omap_display_init(&sdp4430_dss_data);
  172. platform_device_register(&sdp4430_lcd_device);
  173. platform_device_register(&sdp4430_lcd2_device);
  174. platform_device_register(&sdp4430_tpd_device);
  175. platform_device_register(&sdp4430_hdmi_connector_device);
  176. }