dss-common.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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 <video/omapdss.h>
  27. #include <video/omap-panel-data.h>
  28. #include "soc.h"
  29. #include "dss-common.h"
  30. #include "mux.h"
  31. #define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */
  32. #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
  33. #define HDMI_GPIO_HPD 63 /* Hotplug detect */
  34. /* Display DVI */
  35. #define PANDA_DVI_TFP410_POWER_DOWN_GPIO 0
  36. /* Using generic display panel */
  37. static struct tfp410_platform_data omap4_dvi_panel = {
  38. .i2c_bus_num = 3,
  39. .power_down_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
  40. };
  41. static struct omap_dss_device omap4_panda_dvi_device = {
  42. .type = OMAP_DISPLAY_TYPE_DPI,
  43. .name = "dvi",
  44. .driver_name = "tfp410",
  45. .data = &omap4_dvi_panel,
  46. .phy.dpi.data_lines = 24,
  47. .reset_gpio = PANDA_DVI_TFP410_POWER_DOWN_GPIO,
  48. .channel = OMAP_DSS_CHANNEL_LCD2,
  49. };
  50. static struct omap_dss_hdmi_data omap4_panda_hdmi_data = {
  51. .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
  52. .ls_oe_gpio = HDMI_GPIO_LS_OE,
  53. .hpd_gpio = HDMI_GPIO_HPD,
  54. };
  55. static struct omap_dss_device omap4_panda_hdmi_device = {
  56. .name = "hdmi",
  57. .driver_name = "hdmi_panel",
  58. .type = OMAP_DISPLAY_TYPE_HDMI,
  59. .channel = OMAP_DSS_CHANNEL_DIGIT,
  60. .data = &omap4_panda_hdmi_data,
  61. };
  62. static struct omap_dss_device *omap4_panda_dss_devices[] = {
  63. &omap4_panda_dvi_device,
  64. &omap4_panda_hdmi_device,
  65. };
  66. static struct omap_dss_board_info omap4_panda_dss_data = {
  67. .num_devices = ARRAY_SIZE(omap4_panda_dss_devices),
  68. .devices = omap4_panda_dss_devices,
  69. .default_device = &omap4_panda_dvi_device,
  70. };
  71. void __init omap4_panda_display_init(void)
  72. {
  73. omap_display_init(&omap4_panda_dss_data);
  74. /*
  75. * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
  76. * later have external pull up on the HDMI I2C lines
  77. */
  78. if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
  79. omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
  80. else
  81. omap_hdmi_init(0);
  82. omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
  83. omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
  84. omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
  85. }
  86. void __init omap4_panda_display_init_of(void)
  87. {
  88. omap_display_init(&omap4_panda_dss_data);
  89. }
  90. /* OMAP4 Blaze display data */
  91. #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */
  92. #define DLP_POWER_ON_GPIO 40
  93. static struct nokia_dsi_panel_data dsi1_panel = {
  94. .name = "taal",
  95. .reset_gpio = 102,
  96. .use_ext_te = false,
  97. .ext_te_gpio = 101,
  98. .esd_interval = 0,
  99. .pin_config = {
  100. .num_pins = 6,
  101. .pins = { 0, 1, 2, 3, 4, 5 },
  102. },
  103. };
  104. static struct omap_dss_device sdp4430_lcd_device = {
  105. .name = "lcd",
  106. .driver_name = "taal",
  107. .type = OMAP_DISPLAY_TYPE_DSI,
  108. .data = &dsi1_panel,
  109. .phy.dsi = {
  110. .module = 0,
  111. },
  112. .channel = OMAP_DSS_CHANNEL_LCD,
  113. };
  114. static struct nokia_dsi_panel_data dsi2_panel = {
  115. .name = "taal",
  116. .reset_gpio = 104,
  117. .use_ext_te = false,
  118. .ext_te_gpio = 103,
  119. .esd_interval = 0,
  120. .pin_config = {
  121. .num_pins = 6,
  122. .pins = { 0, 1, 2, 3, 4, 5 },
  123. },
  124. };
  125. static struct omap_dss_device sdp4430_lcd2_device = {
  126. .name = "lcd2",
  127. .driver_name = "taal",
  128. .type = OMAP_DISPLAY_TYPE_DSI,
  129. .data = &dsi2_panel,
  130. .phy.dsi = {
  131. .module = 1,
  132. },
  133. .channel = OMAP_DSS_CHANNEL_LCD2,
  134. };
  135. static struct omap_dss_hdmi_data sdp4430_hdmi_data = {
  136. .ct_cp_hpd_gpio = HDMI_GPIO_CT_CP_HPD,
  137. .ls_oe_gpio = HDMI_GPIO_LS_OE,
  138. .hpd_gpio = HDMI_GPIO_HPD,
  139. };
  140. static struct omap_dss_device sdp4430_hdmi_device = {
  141. .name = "hdmi",
  142. .driver_name = "hdmi_panel",
  143. .type = OMAP_DISPLAY_TYPE_HDMI,
  144. .channel = OMAP_DSS_CHANNEL_DIGIT,
  145. .data = &sdp4430_hdmi_data,
  146. };
  147. static struct picodlp_panel_data sdp4430_picodlp_pdata = {
  148. .picodlp_adapter_id = 2,
  149. .emu_done_gpio = 44,
  150. .pwrgood_gpio = 45,
  151. };
  152. static struct omap_dss_device sdp4430_picodlp_device = {
  153. .name = "picodlp",
  154. .driver_name = "picodlp_panel",
  155. .type = OMAP_DISPLAY_TYPE_DPI,
  156. .phy.dpi.data_lines = 24,
  157. .channel = OMAP_DSS_CHANNEL_LCD2,
  158. .data = &sdp4430_picodlp_pdata,
  159. };
  160. static struct omap_dss_device *sdp4430_dss_devices[] = {
  161. &sdp4430_lcd_device,
  162. &sdp4430_lcd2_device,
  163. &sdp4430_hdmi_device,
  164. &sdp4430_picodlp_device,
  165. };
  166. static struct omap_dss_board_info sdp4430_dss_data = {
  167. .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
  168. .devices = sdp4430_dss_devices,
  169. .default_device = &sdp4430_lcd_device,
  170. };
  171. /*
  172. * we select LCD2 by default (instead of Pico DLP) by setting DISPLAY_SEL_GPIO.
  173. * Setting DLP_POWER_ON gpio enables the VDLP_2V5 VDLP_1V8 and VDLP_1V0 rails
  174. * used by picodlp on the 4430sdp platform. Keep this gpio disabled as LCD2 is
  175. * selected by default
  176. */
  177. void __init omap_4430sdp_display_init(void)
  178. {
  179. int r;
  180. r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
  181. "display_sel");
  182. if (r)
  183. pr_err("%s: Could not get display_sel GPIO\n", __func__);
  184. r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
  185. "DLP POWER ON");
  186. if (r)
  187. pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__);
  188. omap_display_init(&sdp4430_dss_data);
  189. /*
  190. * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
  191. * later have external pull up on the HDMI I2C lines
  192. */
  193. if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
  194. omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
  195. else
  196. omap_hdmi_init(0);
  197. omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
  198. omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
  199. omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
  200. }
  201. void __init omap_4430sdp_display_init_of(void)
  202. {
  203. int r;
  204. r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
  205. "display_sel");
  206. if (r)
  207. pr_err("%s: Could not get display_sel GPIO\n", __func__);
  208. r = gpio_request_one(DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
  209. "DLP POWER ON");
  210. if (r)
  211. pr_err("%s: Could not get DLP POWER ON GPIO\n", __func__);
  212. omap_display_init(&sdp4430_dss_data);
  213. }