mhl_defs.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef __MHL_SPEC_DEFS_H__
  14. #define __MHL_SPEC_DEFS_H__
  15. enum DevCapOffset_e {
  16. DEVCAP_OFFSET_DEV_STATE = 0x00,
  17. DEVCAP_OFFSET_MHL_VERSION = 0x01,
  18. DEVCAP_OFFSET_DEV_CAT = 0x02,
  19. DEVCAP_OFFSET_ADOPTER_ID_H = 0x03,
  20. DEVCAP_OFFSET_ADOPTER_ID_L = 0x04,
  21. DEVCAP_OFFSET_VID_LINK_MODE = 0x05,
  22. DEVCAP_OFFSET_AUD_LINK_MODE = 0x06,
  23. DEVCAP_OFFSET_VIDEO_TYPE = 0x07,
  24. DEVCAP_OFFSET_LOG_DEV_MAP = 0x08,
  25. DEVCAP_OFFSET_BANDWIDTH = 0x09,
  26. DEVCAP_OFFSET_FEATURE_FLAG = 0x0A,
  27. DEVCAP_OFFSET_DEVICE_ID_H = 0x0B,
  28. DEVCAP_OFFSET_DEVICE_ID_L = 0x0C,
  29. DEVCAP_OFFSET_SCRATCHPAD_SIZE = 0x0D,
  30. DEVCAP_OFFSET_INT_STAT_SIZE = 0x0E,
  31. DEVCAP_OFFSET_RESERVED = 0x0F,
  32. /* this one must be last */
  33. DEVCAP_SIZE
  34. };
  35. #ifndef __MHL_MSM_8334_REGS_H__
  36. #define __MHL_MSM_8334_REGS_H__
  37. #define BIT0 0x01
  38. #define BIT1 0x02
  39. #define BIT2 0x04
  40. #define BIT3 0x08
  41. #define BIT4 0x10
  42. #define BIT5 0x20
  43. #define BIT6 0x40
  44. #define BIT7 0x80
  45. #define LOW 0
  46. #define HIGH 1
  47. #define MAX_PAGES 8
  48. #endif
  49. /* Version that this chip supports*/
  50. /* bits 4..7 */
  51. #define MHL_VER_MAJOR (0x01 << 4)
  52. /* bits 0..3 */
  53. #define MHL_VER_MINOR 0x02
  54. #define MHL_VERSION (MHL_VER_MAJOR | MHL_VER_MINOR)
  55. /*Device Category*/
  56. #define MHL_DEV_CATEGORY_OFFSET DEVCAP_OFFSET_DEV_CAT
  57. #define MHL_DEV_CATEGORY_POW_BIT (BIT4)
  58. #define MHL_DEV_CAT_SOURCE 0x02
  59. /*Video Link Mode*/
  60. #define MHL_DEV_VID_LINK_SUPPRGB444 0x01
  61. #define MHL_DEV_VID_LINK_SUPPYCBCR444 0x02
  62. #define MHL_DEV_VID_LINK_SUPPYCBCR422 0x04
  63. #define MHL_DEV_VID_LINK_SUPP_PPIXEL 0x08
  64. #define MHL_DEV_VID_LINK_SUPP_ISLANDS 0x10
  65. /*Audio Link Mode Support*/
  66. #define MHL_DEV_AUD_LINK_2CH 0x01
  67. #define MHL_DEV_AUD_LINK_8CH 0x02
  68. /*Feature Flag in the devcap*/
  69. #define MHL_DEV_FEATURE_FLAG_OFFSET DEVCAP_OFFSET_FEATURE_FLAG
  70. /* Dongles have freedom to not support RCP */
  71. #define MHL_FEATURE_RCP_SUPPORT BIT0
  72. /* Dongles have freedom to not support RAP */
  73. #define MHL_FEATURE_RAP_SUPPORT BIT1
  74. /* Dongles have freedom to not support SCRATCHPAD */
  75. #define MHL_FEATURE_SP_SUPPORT BIT2
  76. /*Logical Dev Map*/
  77. #define MHL_DEV_LD_DISPLAY (0x01 << 0)
  78. #define MHL_DEV_LD_VIDEO (0x01 << 1)
  79. #define MHL_DEV_LD_AUDIO (0x01 << 2)
  80. #define MHL_DEV_LD_MEDIA (0x01 << 3)
  81. #define MHL_DEV_LD_TUNER (0x01 << 4)
  82. #define MHL_DEV_LD_RECORD (0x01 << 5)
  83. #define MHL_DEV_LD_SPEAKER (0x01 << 6)
  84. #define MHL_DEV_LD_GUI (0x01 << 7)
  85. /*Bandwidth*/
  86. /* 225 MHz */
  87. #define MHL_BANDWIDTH_LIMIT 22
  88. #define MHL_STATUS_REG_CONNECTED_RDY 0x30
  89. #define MHL_STATUS_REG_LINK_MODE 0x31
  90. #define MHL_STATUS_DCAP_RDY BIT0
  91. #define MHL_STATUS_CLK_MODE_MASK 0x07
  92. #define MHL_STATUS_CLK_MODE_PACKED_PIXEL 0x02
  93. #define MHL_STATUS_CLK_MODE_NORMAL 0x03
  94. #define MHL_STATUS_PATH_EN_MASK 0x08
  95. #define MHL_STATUS_PATH_ENABLED 0x08
  96. #define MHL_STATUS_PATH_DISABLED 0x00
  97. #define MHL_STATUS_MUTED_MASK 0x10
  98. #define MHL_RCHANGE_INT 0x20
  99. #define MHL_DCHANGE_INT 0x21
  100. #define MHL_INT_DCAP_CHG BIT0
  101. #define MHL_INT_DSCR_CHG BIT1
  102. #define MHL_INT_REQ_WRT BIT2
  103. #define MHL_INT_GRT_WRT BIT3
  104. /* On INTR_1 the EDID_CHG is located at BIT 0*/
  105. #define MHL_INT_EDID_CHG BIT1
  106. /* This contains one nibble each - max offset */
  107. #define MHL_INT_AND_STATUS_SIZE 0x33
  108. #define MHL_SCRATCHPAD_OFFSET 0x40
  109. #define MHL_SCRATCHPAD_SIZE 16
  110. #define MAX_SCRATCHPAD_TRANSFER_SIZE 64
  111. #define ADOPTER_ID_SIZE 2
  112. #define MHL_DEVCAP_ALL 0xffff
  113. /* manually define highest number */
  114. #define MHL_MAX_BUFFER_SIZE MHL_SCRATCHPAD_SIZE
  115. #define MHL_BURST_WAIT (1000)
  116. enum {
  117. /* RCP sub-command */
  118. MHL_MSC_MSG_RCP = 0x10,
  119. /* RCP Acknowledge sub-command */
  120. MHL_MSC_MSG_RCPK = 0x11,
  121. /* RCP Error sub-command */
  122. MHL_MSC_MSG_RCPE = 0x12,
  123. /* Mode Change Warning sub-command */
  124. MHL_MSC_MSG_RAP = 0x20,
  125. /* MCW Acknowledge sub-command */
  126. MHL_MSC_MSG_RAPK = 0x21,
  127. };
  128. #define MHL_RCPE_NO_ERROR 0x00
  129. #define MHL_RCPE_UNSUPPORTED_KEY_CODE 0x01
  130. #define MHL_RCPE_INEFFECTIVE_KEY_CODE 0x01
  131. #define MHL_RCPE_BUSY 0x02
  132. #define MHL_RAPK_NO_ERROR 0x00
  133. #define MHL_RAPK_UNRECOGNIZED_ACTION_CODE 0x01
  134. #define MHL_RAPK_UNSUPPORTED_ACTION_CODE 0x02
  135. #define MHL_RAPK_BUSY 0x03
  136. #define T_ABORT_NEXT (2050)
  137. /* MHL spec related defines*/
  138. enum {
  139. /* Command or Data byte acknowledge */
  140. MHL_ACK = 0x33,
  141. /* Command or Data byte not acknowledge */
  142. MHL_NACK = 0x34,
  143. /* Transaction abort */
  144. MHL_ABORT = 0x35,
  145. /* 0xE0 - Write one status register strip top bit */
  146. MHL_WRITE_STAT = 0x60 | 0x80,
  147. /* Write one interrupt register */
  148. MHL_SET_INT = 0x60,
  149. /* Read one register */
  150. MHL_READ_DEVCAP = 0x61,
  151. /* Read CBUS revision level from follower */
  152. MHL_GET_STATE = 0x62,
  153. /* Read vendor ID value from follower. */
  154. MHL_GET_VENDOR_ID = 0x63,
  155. /* Set Hot Plug Detect in follower */
  156. MHL_SET_HPD = 0x64,
  157. /* Clear Hot Plug Detect in follower */
  158. MHL_CLR_HPD = 0x65,
  159. /* Set Capture ID for downstream device. */
  160. MHL_SET_CAP_ID = 0x66,
  161. /* Get Capture ID from downstream device. */
  162. MHL_GET_CAP_ID = 0x67,
  163. /* VS command to send RCP sub-commands */
  164. MHL_MSC_MSG = 0x68,
  165. /* Get Vendor-Specific command error code. */
  166. MHL_GET_SC1_ERRORCODE = 0x69,
  167. /* Get DDC channel command error code. */
  168. MHL_GET_DDC_ERRORCODE = 0x6A,
  169. /* Get MSC command error code. */
  170. MHL_GET_MSC_ERRORCODE = 0x6B,
  171. /* Write 1-16 bytes to responder's scratchpad. */
  172. MHL_WRITE_BURST = 0x6C,
  173. /* Get channel 3 command error code. */
  174. MHL_GET_SC3_ERRORCODE = 0x6D,
  175. };
  176. /* Polling. */
  177. #define MHL_RAP_POLL 0x00
  178. /* Turn content streaming ON. */
  179. #define MHL_RAP_CONTENT_ON 0x10
  180. /* Turn content streaming OFF. */
  181. #define MHL_RAP_CONTENT_OFF 0x11
  182. /*
  183. *
  184. * MHL Timings applicable to this driver.
  185. *
  186. */
  187. /* 100 - 1000 milliseconds. Per MHL 1.0 Specs */
  188. #define T_SRC_VBUS_CBUS_TO_STABLE (200)
  189. /* 20 milliseconds. Per MHL 1.0 Specs */
  190. #define T_SRC_WAKE_PULSE_WIDTH_1 (20)
  191. /* 60 milliseconds. Per MHL 1.0 Specs */
  192. #define T_SRC_WAKE_PULSE_WIDTH_2 (60)
  193. /* 100 - 1000 milliseconds. Per MHL 1.0 Specs */
  194. #define T_SRC_WAKE_TO_DISCOVER (500)
  195. #define T_SRC_VBUS_CBUS_T0_STABLE (500)
  196. /* Allow RSEN to stay low this much before reacting.*/
  197. #define T_SRC_RSEN_DEGLITCH (100)
  198. /* Wait this much after connection before reacting to RSEN (300-500ms)*/
  199. /* Per specs between 300 to 500 ms*/
  200. #define T_SRC_RXSENSE_CHK (400)
  201. #endif /* __MHL_SPEC_DEFS_H__ */