dss-common.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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 void sdp4430_picodlp_init(void)
  153. {
  154. int r;
  155. const struct gpio picodlp_gpios[] = {
  156. {DLP_POWER_ON_GPIO, GPIOF_OUT_INIT_LOW,
  157. "DLP POWER ON"},
  158. {sdp4430_picodlp_pdata.emu_done_gpio, GPIOF_IN,
  159. "DLP EMU DONE"},
  160. {sdp4430_picodlp_pdata.pwrgood_gpio, GPIOF_OUT_INIT_LOW,
  161. "DLP PWRGOOD"},
  162. };
  163. r = gpio_request_array(picodlp_gpios, ARRAY_SIZE(picodlp_gpios));
  164. if (r)
  165. pr_err("Cannot request PicoDLP GPIOs, error %d\n", r);
  166. }
  167. static int sdp4430_panel_enable_picodlp(struct omap_dss_device *dssdev)
  168. {
  169. gpio_set_value(DISPLAY_SEL_GPIO, 0);
  170. gpio_set_value(DLP_POWER_ON_GPIO, 1);
  171. return 0;
  172. }
  173. static void sdp4430_panel_disable_picodlp(struct omap_dss_device *dssdev)
  174. {
  175. gpio_set_value(DLP_POWER_ON_GPIO, 0);
  176. gpio_set_value(DISPLAY_SEL_GPIO, 1);
  177. }
  178. static struct omap_dss_device sdp4430_picodlp_device = {
  179. .name = "picodlp",
  180. .driver_name = "picodlp_panel",
  181. .type = OMAP_DISPLAY_TYPE_DPI,
  182. .phy.dpi.data_lines = 24,
  183. .channel = OMAP_DSS_CHANNEL_LCD2,
  184. .platform_enable = sdp4430_panel_enable_picodlp,
  185. .platform_disable = sdp4430_panel_disable_picodlp,
  186. .data = &sdp4430_picodlp_pdata,
  187. };
  188. static struct omap_dss_device *sdp4430_dss_devices[] = {
  189. &sdp4430_lcd_device,
  190. &sdp4430_lcd2_device,
  191. &sdp4430_hdmi_device,
  192. &sdp4430_picodlp_device,
  193. };
  194. static struct omap_dss_board_info sdp4430_dss_data = {
  195. .num_devices = ARRAY_SIZE(sdp4430_dss_devices),
  196. .devices = sdp4430_dss_devices,
  197. .default_device = &sdp4430_lcd_device,
  198. };
  199. void __init omap_4430sdp_display_init(void)
  200. {
  201. int r;
  202. /* Enable LCD2 by default (instead of Pico DLP) */
  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. sdp4430_picodlp_init();
  208. omap_display_init(&sdp4430_dss_data);
  209. /*
  210. * OMAP4460SDP/Blaze and OMAP4430 ES2.3 SDP/Blaze boards and
  211. * later have external pull up on the HDMI I2C lines
  212. */
  213. if (cpu_is_omap446x() || omap_rev() > OMAP4430_REV_ES2_2)
  214. omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP);
  215. else
  216. omap_hdmi_init(0);
  217. omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT);
  218. omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT);
  219. omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN);
  220. }
  221. void __init omap_4430sdp_display_init_of(void)
  222. {
  223. int r;
  224. /* Enable LCD2 by default (instead of Pico DLP) */
  225. r = gpio_request_one(DISPLAY_SEL_GPIO, GPIOF_OUT_INIT_HIGH,
  226. "display_sel");
  227. if (r)
  228. pr_err("%s: Could not get display_sel GPIO\n", __func__);
  229. sdp4430_picodlp_init();
  230. omap_display_init(&sdp4430_dss_data);
  231. }