connectTheSignalSlot.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * OMAP2plus display device setup / initialization.
  3. *
  4. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  5. * Senthilvadivu Guruswamy
  6. * Sumit Semwal
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  13. * kind, whether express or implied; without even the implied warranty
  14. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #include <linux/string.h>
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/clk.h>
  23. #include <linux/err.h>
  24. #include <linux/delay.h>
  25. #include <video/omapdss.h>
  26. #include "omap_hwmod.h"
  27. #include "omap_device.h"
  28. #include "omap-pm.h"
  29. #include "common.h"
  30. #include "soc.h"
  31. #include "iomap.h"
  32. #include "mux.h"
  33. #include "control.h"
  34. #include "display.h"
  35. #include "prm.h"
  36. #define DISPC_CONTROL 0x0040
  37. #define DISPC_CONTROL2 0x0238
  38. #define DISPC_CONTROL3 0x0848
  39. #define DISPC_IRQSTATUS 0x0018
  40. #define DSS_SYSCONFIG 0x10
  41. #define DSS_SYSSTATUS 0x14
  42. #define DSS_CONTROL 0x40
  43. #define DSS_SDI_CONTROL 0x44
  44. #define DSS_PLL_CONTROL 0x48
  45. #define LCD_EN_MASK (0x1 << 0)
  46. #define DIGIT_EN_MASK (0x1 << 1)
  47. #define FRAMEDONE_IRQ_SHIFT 0
  48. #define EVSYNC_EVEN_IRQ_SHIFT 2
  49. #define EVSYNC_ODD_IRQ_SHIFT 3
  50. #define FRAMEDONE2_IRQ_SHIFT 22
  51. #define FRAMEDONE3_IRQ_SHIFT 30
  52. #define FRAMEDONETV_IRQ_SHIFT 24
  53. /*
  54. * FRAMEDONE_IRQ_TIMEOUT: how long (in milliseconds) to wait during DISPC
  55. * reset before deciding that something has gone wrong
  56. */
  57. #define FRAMEDONE_IRQ_TIMEOUT 100
  58. static struct platform_device omap_display_device = {
  59. .name = "omapdss",
  60. .id = -1,
  61. .dev = {
  62. .platform_data = NULL,
  63. },
  64. };
  65. struct omap_dss_hwmod_data {
  66. const char *oh_name;
  67. const char *dev_name;
  68. const int id;
  69. };
  70. static const struct omap_dss_hwmod_data omap2_dss_hwmod_data[] __initconst = {
  71. { "dss_core", "omapdss_dss", -1 },
  72. { "dss_dispc", "omapdss_dispc", -1 },
  73. { "dss_rfbi", "omapdss_rfbi", -1 },
  74. { "dss_venc", "omapdss_venc", -1 },
  75. };
  76. static const struct omap_dss_hwmod_data omap3_dss_hwmod_data[] __initconst = {
  77. { "dss_core", "omapdss_dss", -1 },
  78. { "dss_dispc", "omapdss_dispc", -1 },
  79. { "dss_rfbi", "omapdss_rfbi", -1 },
  80. { "dss_venc", "omapdss_venc", -1 },
  81. { "dss_dsi1", "omapdss_dsi", 0 },
  82. };
  83. static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initconst = {
  84. { "dss_core", "omapdss_dss", -1 },
  85. { "dss_dispc", "omapdss_dispc", -1 },
  86. { "dss_rfbi", "omapdss_rfbi", -1 },
  87. { "dss_dsi1", "omapdss_dsi", 0 },
  88. { "dss_dsi2", "omapdss_dsi", 1 },
  89. { "dss_hdmi", "omapdss_hdmi", -1 },
  90. };
  91. static void __init omap4_tpd12s015_mux_pads(void)
  92. {
  93. omap_mux_init_signal("hdmi_cec",
  94. OMAP_PIN_INPUT_PULLUP);
  95. omap_mux_init_signal("hdmi_ddc_scl",
  96. OMAP_PIN_INPUT_PULLUP);
  97. omap_mux_init_signal("hdmi_ddc_sda",
  98. OMAP_PIN_INPUT_PULLUP);
  99. }
  100. static void __init omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
  101. {
  102. u32 reg;
  103. u16 control_i2c_1;
  104. /*
  105. * CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
  106. * HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
  107. * internal pull up resistor.
  108. */
  109. if (flags & OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP) {
  110. control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
  111. reg = omap4_ctrl_pad_readl(control_i2c_1);
  112. reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
  113. OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);
  114. omap4_ctrl_pad_writel(reg, control_i2c_1);
  115. }
  116. }
  117. static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
  118. {
  119. u32 enable_mask, enable_shift;
  120. u32 pipd_mask, pipd_shift;
  121. u32 reg;
  122. if (dsi_id == 0) {
  123. enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
  124. enable_shift = OMAP4_DSI1_LANEENABLE_SHIFT;
  125. pipd_mask = OMAP4_DSI1_PIPD_MASK;
  126. pipd_shift = OMAP4_DSI1_PIPD_SHIFT;
  127. } else if (dsi_id == 1) {
  128. enable_mask = OMAP4_DSI2_LANEENABLE_MASK;
  129. enable_shift = OMAP4_DSI2_LANEENABLE_SHIFT;
  130. pipd_mask = OMAP4_DSI2_PIPD_MASK;
  131. pipd_shift = OMAP4_DSI2_PIPD_SHIFT;
  132. } else {
  133. return -ENODEV;
  134. }
  135. reg = omap4_ctrl_pad_readl(OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
  136. reg &= ~enable_mask;
  137. reg &= ~pipd_mask;
  138. reg |= (lanes << enable_shift) & enable_mask;
  139. reg |= (lanes << pipd_shift) & pipd_mask;
  140. omap4_ctrl_pad_writel(reg, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_DSIPHY);
  141. return 0;
  142. }
  143. int __init omap_hdmi_init(enum omap_hdmi_flags flags)
  144. {
  145. if (cpu_is_omap44xx()) {
  146. omap4_hdmi_mux_pads(flags);
  147. omap4_tpd12s015_mux_pads();
  148. }
  149. return 0;
  150. }
  151. static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
  152. {
  153. if (cpu_is_omap44xx())
  154. return omap4_dsi_mux_pads(dsi_id, lane_mask);
  155. return 0;
  156. }