dss-common.c 6.5 KB

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