dss-common.c 7.0 KB

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