mddi_hw.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. /* drivers/video/msm_fb/mddi_hw.h
  2. *
  3. * MSM MDDI Hardware Registers and Structures
  4. *
  5. * Copyright (C) 2007 QUALCOMM Incorporated
  6. * Copyright (C) 2007 Google Incorporated
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. */
  17. #ifndef _MDDI_HW_H_
  18. #define _MDDI_HW_H_
  19. #include <linux/types.h>
  20. #define MDDI_CMD 0x0000
  21. #define MDDI_VERSION 0x0004
  22. #define MDDI_PRI_PTR 0x0008
  23. #define MDDI_SEC_PTR 0x000c
  24. #define MDDI_BPS 0x0010
  25. #define MDDI_SPM 0x0014
  26. #define MDDI_INT 0x0018
  27. #define MDDI_INTEN 0x001c
  28. #define MDDI_REV_PTR 0x0020
  29. #define MDDI_REV_SIZE 0x0024
  30. #define MDDI_STAT 0x0028
  31. #define MDDI_REV_RATE_DIV 0x002c
  32. #define MDDI_REV_CRC_ERR 0x0030
  33. #define MDDI_TA1_LEN 0x0034
  34. #define MDDI_TA2_LEN 0x0038
  35. #define MDDI_TEST_BUS 0x003c
  36. #define MDDI_TEST 0x0040
  37. #define MDDI_REV_PKT_CNT 0x0044
  38. #define MDDI_DRIVE_HI 0x0048
  39. #define MDDI_DRIVE_LO 0x004c
  40. #define MDDI_DISP_WAKE 0x0050
  41. #define MDDI_REV_ENCAP_SZ 0x0054
  42. #define MDDI_RTD_VAL 0x0058
  43. #define MDDI_PAD_CTL 0x0068
  44. #define MDDI_DRIVER_START_CNT 0x006c
  45. #define MDDI_NEXT_PRI_PTR 0x0070
  46. #define MDDI_NEXT_SEC_PTR 0x0074
  47. #define MDDI_MISR_CTL 0x0078
  48. #define MDDI_MISR_DATA 0x007c
  49. #define MDDI_SF_CNT 0x0080
  50. #define MDDI_MF_CNT 0x0084
  51. #define MDDI_CURR_REV_PTR 0x0088
  52. #define MDDI_CORE_VER 0x008c
  53. #define MDDI_FIFO_ALLOC 0x0090
  54. #define MDDI_PAD_IO_CTL 0x00a0
  55. #define MDDI_PAD_CAL 0x00a4
  56. #define MDDI_INT_PRI_PTR_READ 0x0001
  57. #define MDDI_INT_SEC_PTR_READ 0x0002
  58. #define MDDI_INT_REV_DATA_AVAIL 0x0004
  59. #define MDDI_INT_DISP_REQ 0x0008
  60. #define MDDI_INT_PRI_UNDERFLOW 0x0010
  61. #define MDDI_INT_SEC_UNDERFLOW 0x0020
  62. #define MDDI_INT_REV_OVERFLOW 0x0040
  63. #define MDDI_INT_CRC_ERROR 0x0080
  64. #define MDDI_INT_MDDI_IN 0x0100
  65. #define MDDI_INT_PRI_OVERWRITE 0x0200
  66. #define MDDI_INT_SEC_OVERWRITE 0x0400
  67. #define MDDI_INT_REV_OVERWRITE 0x0800
  68. #define MDDI_INT_DMA_FAILURE 0x1000
  69. #define MDDI_INT_LINK_ACTIVE 0x2000
  70. #define MDDI_INT_IN_HIBERNATION 0x4000
  71. #define MDDI_INT_PRI_LINK_LIST_DONE 0x8000
  72. #define MDDI_INT_SEC_LINK_LIST_DONE 0x10000
  73. #define MDDI_INT_NO_CMD_PKTS_PEND 0x20000
  74. #define MDDI_INT_RTD_FAILURE 0x40000
  75. #define MDDI_INT_REV_PKT_RECEIVED 0x80000
  76. #define MDDI_INT_REV_PKTS_AVAIL 0x100000
  77. #define MDDI_INT_NEED_CLEAR ( \
  78. MDDI_INT_REV_DATA_AVAIL | \
  79. MDDI_INT_PRI_UNDERFLOW | \
  80. MDDI_INT_SEC_UNDERFLOW | \
  81. MDDI_INT_REV_OVERFLOW | \
  82. MDDI_INT_CRC_ERROR | \
  83. MDDI_INT_REV_PKT_RECEIVED)
  84. #define MDDI_STAT_LINK_ACTIVE 0x0001
  85. #define MDDI_STAT_NEW_REV_PTR 0x0002
  86. #define MDDI_STAT_NEW_PRI_PTR 0x0004
  87. #define MDDI_STAT_NEW_SEC_PTR 0x0008
  88. #define MDDI_STAT_IN_HIBERNATION 0x0010
  89. #define MDDI_STAT_PRI_LINK_LIST_DONE 0x0020
  90. #define MDDI_STAT_SEC_LINK_LIST_DONE 0x0040
  91. #define MDDI_STAT_PENDING_TIMING_PKT 0x0080
  92. #define MDDI_STAT_PENDING_REV_ENCAP 0x0100
  93. #define MDDI_STAT_PENDING_POWERDOWN 0x0200
  94. #define MDDI_STAT_RTD_MEAS_FAIL 0x0800
  95. #define MDDI_STAT_CLIENT_WAKEUP_REQ 0x1000
  96. #define MDDI_CMD_POWERDOWN 0x0100
  97. #define MDDI_CMD_POWERUP 0x0200
  98. #define MDDI_CMD_HIBERNATE 0x0300
  99. #define MDDI_CMD_RESET 0x0400
  100. #define MDDI_CMD_DISP_IGNORE 0x0501
  101. #define MDDI_CMD_DISP_LISTEN 0x0500
  102. #define MDDI_CMD_SEND_REV_ENCAP 0x0600
  103. #define MDDI_CMD_GET_CLIENT_CAP 0x0601
  104. #define MDDI_CMD_GET_CLIENT_STATUS 0x0602
  105. #define MDDI_CMD_SEND_RTD 0x0700
  106. #define MDDI_CMD_LINK_ACTIVE 0x0900
  107. #define MDDI_CMD_PERIODIC_REV_ENCAP 0x0A00
  108. #define MDDI_CMD_FORCE_NEW_REV_PTR 0x0C00
  109. #define MDDI_VIDEO_REV_PKT_SIZE 0x40
  110. #define MDDI_CLIENT_CAPABILITY_REV_PKT_SIZE 0x60
  111. #define MDDI_MAX_REV_PKT_SIZE 0x60
  112. /* #define MDDI_REV_BUFFER_SIZE 128 */
  113. #define MDDI_REV_BUFFER_SIZE (MDDI_MAX_REV_PKT_SIZE * 4)
  114. /* MDP sends 256 pixel packets, so lower value hibernates more without
  115. * significantly increasing latency of waiting for next subframe */
  116. #define MDDI_HOST_BYTES_PER_SUBFRAME 0x3C00
  117. #if defined(CONFIG_MSM_MDP31) || defined(CONFIG_MSM_MDP40)
  118. #define MDDI_HOST_TA2_LEN 0x001a
  119. #define MDDI_HOST_REV_RATE_DIV 0x0004
  120. #else
  121. #define MDDI_HOST_TA2_LEN 0x000c
  122. #define MDDI_HOST_REV_RATE_DIV 0x0002
  123. #endif
  124. struct __attribute__((packed)) mddi_rev_packet {
  125. uint16_t length;
  126. uint16_t type;
  127. uint16_t client_id;
  128. };
  129. struct __attribute__((packed)) mddi_client_status {
  130. uint16_t length;
  131. uint16_t type;
  132. uint16_t client_id;
  133. uint16_t reverse_link_request; /* bytes needed in rev encap message */
  134. uint8_t crc_error_count;
  135. uint8_t capability_change;
  136. uint16_t graphics_busy_flags;
  137. uint16_t crc16;
  138. };
  139. struct __attribute__((packed)) mddi_client_caps {
  140. uint16_t length; /* length, exclusive of this field */
  141. uint16_t type; /* 66 */
  142. uint16_t client_id;
  143. uint16_t Protocol_Version;
  144. uint16_t Minimum_Protocol_Version;
  145. uint16_t Data_Rate_Capability;
  146. uint8_t Interface_Type_Capability;
  147. uint8_t Number_of_Alt_Displays;
  148. uint16_t PostCal_Data_Rate;
  149. uint16_t Bitmap_Width;
  150. uint16_t Bitmap_Height;
  151. uint16_t Display_Window_Width;
  152. uint16_t Display_Window_Height;
  153. uint32_t Color_Map_Size;
  154. uint16_t Color_Map_RGB_Width;
  155. uint16_t RGB_Capability;
  156. uint8_t Monochrome_Capability;
  157. uint8_t Reserved_1;
  158. uint16_t Y_Cb_Cr_Capability;
  159. uint16_t Bayer_Capability;
  160. uint16_t Alpha_Cursor_Image_Planes;
  161. uint32_t Client_Feature_Capability_Indicators;
  162. uint8_t Maximum_Video_Frame_Rate_Capability;
  163. uint8_t Minimum_Video_Frame_Rate_Capability;
  164. uint16_t Minimum_Sub_frame_Rate;
  165. uint16_t Audio_Buffer_Depth;
  166. uint16_t Audio_Channel_Capability;
  167. uint16_t Audio_Sample_Rate_Capability;
  168. uint8_t Audio_Sample_Resolution;
  169. uint8_t Mic_Audio_Sample_Resolution;
  170. uint16_t Mic_Sample_Rate_Capability;
  171. uint8_t Keyboard_Data_Format;
  172. uint8_t pointing_device_data_format;
  173. uint16_t content_protection_type;
  174. uint16_t Mfr_Name;
  175. uint16_t Product_Code;
  176. uint16_t Reserved_3;
  177. uint32_t Serial_Number;
  178. uint8_t Week_of_Manufacture;
  179. uint8_t Year_of_Manufacture;
  180. uint16_t crc16;
  181. } mddi_client_capability_type;
  182. struct __attribute__((packed)) mddi_video_stream {
  183. uint16_t length;
  184. uint16_t type; /* 16 */
  185. uint16_t client_id; /* 0 */
  186. uint16_t video_data_format_descriptor;
  187. /* format of each pixel in the Pixel Data in the present stream in the
  188. * present packet.
  189. * If bits [15:13] = 000 monochrome
  190. * If bits [15:13] = 001 color pixels (palette).
  191. * If bits [15:13] = 010 color pixels in raw RGB
  192. * If bits [15:13] = 011 data in 4:2:2 Y Cb Cr format
  193. * If bits [15:13] = 100 Bayer pixels
  194. */
  195. uint16_t pixel_data_attributes;
  196. /* interpreted as follows:
  197. * Bits [1:0] = 11 pixel data is displayed to both eyes
  198. * Bits [1:0] = 10 pixel data is routed to the left eye only.
  199. * Bits [1:0] = 01 pixel data is routed to the right eye only.
  200. * Bits [1:0] = 00 pixel data is routed to the alternate display.
  201. * Bit 2 is 0 Pixel Data is in the standard progressive format.
  202. * Bit 2 is 1 Pixel Data is in interlace format.
  203. * Bit 3 is 0 Pixel Data is in the standard progressive format.
  204. * Bit 3 is 1 Pixel Data is in alternate pixel format.
  205. * Bit 4 is 0 Pixel Data is to or from the display frame buffer.
  206. * Bit 4 is 1 Pixel Data is to or from the camera.
  207. * Bit 5 is 0 pixel data contains the next consecutive row of pixels.
  208. * Bit 5 is 1 X Left Edge, Y Top Edge, X Right Edge, Y Bottom Edge,
  209. * X Start, and Y Start parameters are not defined and
  210. * shall be ignored by the client.
  211. * Bits [7:6] = 01 Pixel data is written to the offline image buffer.
  212. * Bits [7:6] = 00 Pixel data is written to the buffer to refresh display.
  213. * Bits [7:6] = 11 Pixel data is written to all image buffers.
  214. * Bits [7:6] = 10 Invalid. Reserved for future use.
  215. * Bits 8 through 11 alternate display number.
  216. * Bits 12 through 14 are reserved for future use and shall be set to zero.
  217. * Bit 15 is 1 the row of pixels is the last row of pixels in a frame.
  218. */
  219. uint16_t x_left_edge;
  220. uint16_t y_top_edge;
  221. /* X,Y coordinate of the top left edge of the screen window */
  222. uint16_t x_right_edge;
  223. uint16_t y_bottom_edge;
  224. /* X,Y coordinate of the bottom right edge of the window being
  225. * updated. */
  226. uint16_t x_start;
  227. uint16_t y_start;
  228. /* (X Start, Y Start) is the first pixel in the Pixel Data field
  229. * below. */
  230. uint16_t pixel_count;
  231. /* number of pixels in the Pixel Data field below. */
  232. uint16_t parameter_CRC;
  233. /* 16-bit CRC of all bytes from the Packet Length to the Pixel Count. */
  234. uint16_t reserved;
  235. /* 16-bit variable to make structure align on 4 byte boundary */
  236. };
  237. #define TYPE_VIDEO_STREAM 16
  238. #define TYPE_CLIENT_CAPS 66
  239. #define TYPE_REGISTER_ACCESS 146
  240. #define TYPE_CLIENT_STATUS 70
  241. struct __attribute__((packed)) mddi_register_access {
  242. uint16_t length;
  243. uint16_t type; /* 146 */
  244. uint16_t client_id;
  245. uint16_t read_write_info;
  246. /* Bits 13:0 a 14-bit unsigned integer that specifies the number of
  247. * 32-bit Register Data List items to be transferred in the
  248. * Register Data List field.
  249. * Bits[15:14] = 00 Write to register(s);
  250. * Bits[15:14] = 10 Read from register(s);
  251. * Bits[15:14] = 11 Response to a Read.
  252. * Bits[15:14] = 01 this value is reserved for future use. */
  253. #define MDDI_WRITE (0 << 14)
  254. #define MDDI_READ (2 << 14)
  255. #define MDDI_READ_RESP (3 << 14)
  256. uint32_t register_address;
  257. /* the register address that is to be written to or read from. */
  258. uint16_t crc16;
  259. uint32_t register_data_list;
  260. /* list of 4-byte register data values for/from client registers */
  261. };
  262. struct __attribute__((packed)) mddi_llentry {
  263. uint16_t flags;
  264. uint16_t header_count;
  265. uint16_t data_count;
  266. dma_addr_t data; /* 32 bit */
  267. struct mddi_llentry *next;
  268. uint16_t reserved;
  269. union {
  270. struct mddi_video_stream v;
  271. struct mddi_register_access r;
  272. uint32_t _[12];
  273. } u;
  274. };
  275. #endif