mddi_hw.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  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_INT_PRI_PTR_READ 0x0001
  54. #define MDDI_INT_SEC_PTR_READ 0x0002
  55. #define MDDI_INT_REV_DATA_AVAIL 0x0004
  56. #define MDDI_INT_DISP_REQ 0x0008
  57. #define MDDI_INT_PRI_UNDERFLOW 0x0010
  58. #define MDDI_INT_SEC_UNDERFLOW 0x0020
  59. #define MDDI_INT_REV_OVERFLOW 0x0040
  60. #define MDDI_INT_CRC_ERROR 0x0080
  61. #define MDDI_INT_MDDI_IN 0x0100
  62. #define MDDI_INT_PRI_OVERWRITE 0x0200
  63. #define MDDI_INT_SEC_OVERWRITE 0x0400
  64. #define MDDI_INT_REV_OVERWRITE 0x0800
  65. #define MDDI_INT_DMA_FAILURE 0x1000
  66. #define MDDI_INT_LINK_ACTIVE 0x2000
  67. #define MDDI_INT_IN_HIBERNATION 0x4000
  68. #define MDDI_INT_PRI_LINK_LIST_DONE 0x8000
  69. #define MDDI_INT_SEC_LINK_LIST_DONE 0x10000
  70. #define MDDI_INT_NO_CMD_PKTS_PEND 0x20000
  71. #define MDDI_INT_RTD_FAILURE 0x40000
  72. #define MDDI_INT_REV_PKT_RECEIVED 0x80000
  73. #define MDDI_INT_REV_PKTS_AVAIL 0x100000
  74. #define MDDI_INT_NEED_CLEAR ( \
  75. MDDI_INT_REV_DATA_AVAIL | \
  76. MDDI_INT_PRI_UNDERFLOW | \
  77. MDDI_INT_SEC_UNDERFLOW | \
  78. MDDI_INT_REV_OVERFLOW | \
  79. MDDI_INT_CRC_ERROR | \
  80. MDDI_INT_REV_PKT_RECEIVED)
  81. #define MDDI_STAT_LINK_ACTIVE 0x0001
  82. #define MDDI_STAT_NEW_REV_PTR 0x0002
  83. #define MDDI_STAT_NEW_PRI_PTR 0x0004
  84. #define MDDI_STAT_NEW_SEC_PTR 0x0008
  85. #define MDDI_STAT_IN_HIBERNATION 0x0010
  86. #define MDDI_STAT_PRI_LINK_LIST_DONE 0x0020
  87. #define MDDI_STAT_SEC_LINK_LIST_DONE 0x0040
  88. #define MDDI_STAT_PENDING_TIMING_PKT 0x0080
  89. #define MDDI_STAT_PENDING_REV_ENCAP 0x0100
  90. #define MDDI_STAT_PENDING_POWERDOWN 0x0200
  91. #define MDDI_STAT_RTD_MEAS_FAIL 0x0800
  92. #define MDDI_STAT_CLIENT_WAKEUP_REQ 0x1000
  93. #define MDDI_CMD_POWERDOWN 0x0100
  94. #define MDDI_CMD_POWERUP 0x0200
  95. #define MDDI_CMD_HIBERNATE 0x0300
  96. #define MDDI_CMD_RESET 0x0400
  97. #define MDDI_CMD_DISP_IGNORE 0x0501
  98. #define MDDI_CMD_DISP_LISTEN 0x0500
  99. #define MDDI_CMD_SEND_REV_ENCAP 0x0600
  100. #define MDDI_CMD_GET_CLIENT_CAP 0x0601
  101. #define MDDI_CMD_GET_CLIENT_STATUS 0x0602
  102. #define MDDI_CMD_SEND_RTD 0x0700
  103. #define MDDI_CMD_LINK_ACTIVE 0x0900
  104. #define MDDI_CMD_PERIODIC_REV_ENCAP 0x0A00
  105. #define MDDI_CMD_FORCE_NEW_REV_PTR 0x0C00
  106. #define MDDI_VIDEO_REV_PKT_SIZE 0x40
  107. #define MDDI_CLIENT_CAPABILITY_REV_PKT_SIZE 0x60
  108. #define MDDI_MAX_REV_PKT_SIZE 0x60
  109. /* #define MDDI_REV_BUFFER_SIZE 128 */
  110. #define MDDI_REV_BUFFER_SIZE (MDDI_MAX_REV_PKT_SIZE * 4)
  111. /* MDP sends 256 pixel packets, so lower value hibernates more without
  112. * significantly increasing latency of waiting for next subframe */
  113. #define MDDI_HOST_BYTES_PER_SUBFRAME 0x3C00
  114. #define MDDI_HOST_TA2_LEN 0x000c
  115. #define MDDI_HOST_REV_RATE_DIV 0x0002
  116. struct __attribute__((packed)) mddi_rev_packet {
  117. uint16_t length;
  118. uint16_t type;
  119. uint16_t client_id;
  120. };
  121. struct __attribute__((packed)) mddi_client_status {
  122. uint16_t length;
  123. uint16_t type;
  124. uint16_t client_id;
  125. uint16_t reverse_link_request; /* bytes needed in rev encap message */
  126. uint8_t crc_error_count;
  127. uint8_t capability_change;
  128. uint16_t graphics_busy_flags;
  129. uint16_t crc16;
  130. };
  131. struct __attribute__((packed)) mddi_client_caps {
  132. uint16_t length; /* length, exclusive of this field */
  133. uint16_t type; /* 66 */
  134. uint16_t client_id;
  135. uint16_t Protocol_Version;
  136. uint16_t Minimum_Protocol_Version;
  137. uint16_t Data_Rate_Capability;
  138. uint8_t Interface_Type_Capability;
  139. uint8_t Number_of_Alt_Displays;
  140. uint16_t PostCal_Data_Rate;
  141. uint16_t Bitmap_Width;
  142. uint16_t Bitmap_Height;
  143. uint16_t Display_Window_Width;
  144. uint16_t Display_Window_Height;
  145. uint32_t Color_Map_Size;
  146. uint16_t Color_Map_RGB_Width;
  147. uint16_t RGB_Capability;
  148. uint8_t Monochrome_Capability;
  149. uint8_t Reserved_1;
  150. uint16_t Y_Cb_Cr_Capability;
  151. uint16_t Bayer_Capability;
  152. uint16_t Alpha_Cursor_Image_Planes;
  153. uint32_t Client_Feature_Capability_Indicators;
  154. uint8_t Maximum_Video_Frame_Rate_Capability;
  155. uint8_t Minimum_Video_Frame_Rate_Capability;
  156. uint16_t Minimum_Sub_frame_Rate;
  157. uint16_t Audio_Buffer_Depth;
  158. uint16_t Audio_Channel_Capability;
  159. uint16_t Audio_Sample_Rate_Capability;
  160. uint8_t Audio_Sample_Resolution;
  161. uint8_t Mic_Audio_Sample_Resolution;
  162. uint16_t Mic_Sample_Rate_Capability;
  163. uint8_t Keyboard_Data_Format;
  164. uint8_t pointing_device_data_format;
  165. uint16_t content_protection_type;
  166. uint16_t Mfr_Name;
  167. uint16_t Product_Code;
  168. uint16_t Reserved_3;
  169. uint32_t Serial_Number;
  170. uint8_t Week_of_Manufacture;
  171. uint8_t Year_of_Manufacture;
  172. uint16_t crc16;
  173. } mddi_client_capability_type;
  174. struct __attribute__((packed)) mddi_video_stream {
  175. uint16_t length;
  176. uint16_t type; /* 16 */
  177. uint16_t client_id; /* 0 */
  178. uint16_t video_data_format_descriptor;
  179. /* format of each pixel in the Pixel Data in the present stream in the
  180. * present packet.
  181. * If bits [15:13] = 000 monochrome
  182. * If bits [15:13] = 001 color pixels (palette).
  183. * If bits [15:13] = 010 color pixels in raw RGB
  184. * If bits [15:13] = 011 data in 4:2:2 Y Cb Cr format
  185. * If bits [15:13] = 100 Bayer pixels
  186. */
  187. uint16_t pixel_data_attributes;
  188. /* interpreted as follows:
  189. * Bits [1:0] = 11 pixel data is displayed to both eyes
  190. * Bits [1:0] = 10 pixel data is routed to the left eye only.
  191. * Bits [1:0] = 01 pixel data is routed to the right eye only.
  192. * Bits [1:0] = 00 pixel data is routed to the alternate display.
  193. * Bit 2 is 0 Pixel Data is in the standard progressive format.
  194. * Bit 2 is 1 Pixel Data is in interlace format.
  195. * Bit 3 is 0 Pixel Data is in the standard progressive format.
  196. * Bit 3 is 1 Pixel Data is in alternate pixel format.
  197. * Bit 4 is 0 Pixel Data is to or from the display frame buffer.
  198. * Bit 4 is 1 Pixel Data is to or from the camera.
  199. * Bit 5 is 0 pixel data contains the next consecutive row of pixels.
  200. * Bit 5 is 1 X Left Edge, Y Top Edge, X Right Edge, Y Bottom Edge,
  201. * X Start, and Y Start parameters are not defined and
  202. * shall be ignored by the client.
  203. * Bits [7:6] = 01 Pixel data is written to the offline image buffer.
  204. * Bits [7:6] = 00 Pixel data is written to the buffer to refresh display.
  205. * Bits [7:6] = 11 Pixel data is written to all image buffers.
  206. * Bits [7:6] = 10 Invalid. Reserved for future use.
  207. * Bits 8 through 11 alternate display number.
  208. * Bits 12 through 14 are reserved for future use and shall be set to zero.
  209. * Bit 15 is 1 the row of pixels is the last row of pixels in a frame.
  210. */
  211. uint16_t x_left_edge;
  212. uint16_t y_top_edge;
  213. /* X,Y coordinate of the top left edge of the screen window */
  214. uint16_t x_right_edge;
  215. uint16_t y_bottom_edge;
  216. /* X,Y coordinate of the bottom right edge of the window being
  217. * updated. */
  218. uint16_t x_start;
  219. uint16_t y_start;
  220. /* (X Start, Y Start) is the first pixel in the Pixel Data field
  221. * below. */
  222. uint16_t pixel_count;
  223. /* number of pixels in the Pixel Data field below. */
  224. uint16_t parameter_CRC;
  225. /* 16-bit CRC of all bytes from the Packet Length to the Pixel Count. */
  226. uint16_t reserved;
  227. /* 16-bit variable to make structure align on 4 byte boundary */
  228. };
  229. #define TYPE_VIDEO_STREAM 16
  230. #define TYPE_CLIENT_CAPS 66
  231. #define TYPE_REGISTER_ACCESS 146
  232. #define TYPE_CLIENT_STATUS 70
  233. struct __attribute__((packed)) mddi_register_access {
  234. uint16_t length;
  235. uint16_t type; /* 146 */
  236. uint16_t client_id;
  237. uint16_t read_write_info;
  238. /* Bits 13:0 a 14-bit unsigned integer that specifies the number of
  239. * 32-bit Register Data List items to be transferred in the
  240. * Register Data List field.
  241. * Bits[15:14] = 00 Write to register(s);
  242. * Bits[15:14] = 10 Read from register(s);
  243. * Bits[15:14] = 11 Response to a Read.
  244. * Bits[15:14] = 01 this value is reserved for future use. */
  245. #define MDDI_WRITE (0 << 14)
  246. #define MDDI_READ (2 << 14)
  247. #define MDDI_READ_RESP (3 << 14)
  248. uint32_t register_address;
  249. /* the register address that is to be written to or read from. */
  250. uint16_t crc16;
  251. uint32_t register_data_list;
  252. /* list of 4-byte register data values for/from client registers */
  253. };
  254. struct __attribute__((packed)) mddi_llentry {
  255. uint16_t flags;
  256. uint16_t header_count;
  257. uint16_t data_count;
  258. dma_addr_t data; /* 32 bit */
  259. struct mddi_llentry *next;
  260. uint16_t reserved;
  261. union {
  262. struct mddi_video_stream v;
  263. struct mddi_register_access r;
  264. uint32_t _[12];
  265. } u;
  266. };
  267. #endif