mddihosti.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /* Copyright (c) 2008-2010, 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 MDDIHOSTI_H
  14. #define MDDIHOSTI_H
  15. #include "msm_fb.h"
  16. #include "mddihost.h"
  17. #include <linux/clk.h>
  18. /* Register offsets in MDDI, applies to both msm_pmdh_base and
  19. * (u32)msm_emdh_base. */
  20. #define MDDI_CMD 0x0000
  21. #define MDDI_VERSION 0x0004
  22. #define MDDI_PRI_PTR 0x0008
  23. #define MDDI_BPS 0x0010
  24. #define MDDI_SPM 0x0014
  25. #define MDDI_INT 0x0018
  26. #define MDDI_INTEN 0x001c
  27. #define MDDI_REV_PTR 0x0020
  28. #define MDDI_REV_SIZE 0x0024
  29. #define MDDI_STAT 0x0028
  30. #define MDDI_REV_RATE_DIV 0x002c
  31. #define MDDI_REV_CRC_ERR 0x0030
  32. #define MDDI_TA1_LEN 0x0034
  33. #define MDDI_TA2_LEN 0x0038
  34. #define MDDI_TEST 0x0040
  35. #define MDDI_REV_PKT_CNT 0x0044
  36. #define MDDI_DRIVE_HI 0x0048
  37. #define MDDI_DRIVE_LO 0x004c
  38. #define MDDI_DISP_WAKE 0x0050
  39. #define MDDI_REV_ENCAP_SZ 0x0054
  40. #define MDDI_RTD_VAL 0x0058
  41. #define MDDI_PAD_CTL 0x0068
  42. #define MDDI_DRIVER_START_CNT 0x006c
  43. #define MDDI_CORE_VER 0x008c
  44. #define MDDI_FIFO_ALLOC 0x0090
  45. #define MDDI_PAD_IO_CTL 0x00a0
  46. #define MDDI_PAD_CAL 0x00a4
  47. #ifdef ENABLE_MDDI_MULTI_READ_WRITE
  48. #define MDDI_HOST_MAX_CLIENT_REG_IN_SAME_ADDR 128
  49. #else
  50. #define MDDI_HOST_MAX_CLIENT_REG_IN_SAME_ADDR 1
  51. #endif
  52. extern int32 mddi_client_type;
  53. extern u32 mddi_msg_level;
  54. /* No longer need to write to clear these registers */
  55. #define xxxx_mddi_host_reg_outm(reg, mask, val) \
  56. do { \
  57. if (host_idx == MDDI_HOST_PRIM) \
  58. mddi_host_reg_outm_pmdh(reg, mask, val); \
  59. else \
  60. mddi_host_reg_outm_emdh(reg, mask, val); \
  61. } while (0)
  62. #define mddi_host_reg_outm(reg, mask, val) \
  63. do { \
  64. unsigned long __addr; \
  65. if (host_idx == MDDI_HOST_PRIM) \
  66. __addr = (u32)msm_pmdh_base + MDDI_##reg; \
  67. else \
  68. __addr = (u32)msm_emdh_base + MDDI_##reg; \
  69. writel((readl(__addr) & ~(mask)) | ((val) & (mask)), __addr); \
  70. } while (0)
  71. #define xxxx_mddi_host_reg_out(reg, val) \
  72. do { \
  73. if (host_idx == MDDI_HOST_PRIM) \
  74. mddi_host_reg_out_pmdh(reg, val); \
  75. else \
  76. mddi_host_reg_out_emdh(reg, val); \
  77. } while (0)
  78. #define mddi_host_reg_out(reg, val) \
  79. do { \
  80. if (host_idx == MDDI_HOST_PRIM) \
  81. writel(val, (u32)msm_pmdh_base + MDDI_##reg); \
  82. else \
  83. writel(val, (u32)msm_emdh_base + MDDI_##reg); \
  84. } while (0)
  85. #define xxxx_mddi_host_reg_in(reg) \
  86. ((host_idx) ? \
  87. mddi_host_reg_in_emdh(reg) : mddi_host_reg_in_pmdh(reg));
  88. #define mddi_host_reg_in(reg) \
  89. ((host_idx) ? \
  90. readl((u32)msm_emdh_base + MDDI_##reg) : \
  91. readl((u32)msm_pmdh_base + MDDI_##reg)) \
  92. #define xxxx_mddi_host_reg_inm(reg, mask) \
  93. ((host_idx) ? \
  94. mddi_host_reg_inm_emdh(reg, mask) : \
  95. mddi_host_reg_inm_pmdh(reg, mask);)
  96. #define mddi_host_reg_inm(reg, mask) \
  97. ((host_idx) ? \
  98. readl((u32)msm_emdh_base + MDDI_##reg) & (mask) : \
  99. readl((u32)msm_pmdh_base + MDDI_##reg) & (mask)) \
  100. /* Using non-cacheable pmem, so do nothing */
  101. #define mddi_invalidate_cache_lines(addr_start, num_bytes)
  102. /*
  103. * Using non-cacheable pmem, so do nothing with cache
  104. * but, ensure write goes out to memory
  105. */
  106. #define mddi_flush_cache_lines(addr_start, num_bytes) \
  107. (void) addr_start; \
  108. (void) num_bytes; \
  109. memory_barrier()
  110. /* Since this translates to Remote Procedure Calls to check on clock status
  111. * just use a local variable to keep track of io_clock */
  112. #define MDDI_HOST_IS_IO_CLOCK_ON mddi_host_io_clock_on
  113. #define MDDI_HOST_ENABLE_IO_CLOCK
  114. #define MDDI_HOST_DISABLE_IO_CLOCK
  115. #define MDDI_HOST_IS_HCLK_ON mddi_host_hclk_on
  116. #define MDDI_HOST_ENABLE_HCLK
  117. #define MDDI_HOST_DISABLE_HCLK
  118. #define FEATURE_MDDI_HOST_IO_CLOCK_CONTROL_DISABLE
  119. #define FEATURE_MDDI_HOST_HCLK_CONTROL_DISABLE
  120. #define TRAMP_MDDI_HOST_ISR TRAMP_MDDI_PRI_ISR
  121. #define TRAMP_MDDI_HOST_EXT_ISR TRAMP_MDDI_EXT_ISR
  122. #define MDP_LINE_COUNT_BMSK 0x3ff
  123. #define MDP_SYNC_STATUS 0x000c
  124. #define MDP_LINE_COUNT \
  125. (readl(msm_mdp_base + MDP_SYNC_STATUS) & MDP_LINE_COUNT_BMSK)
  126. /* MDP sends 256 pixel packets, so lower value hibernates more without
  127. * significantly increasing latency of waiting for next subframe */
  128. #define MDDI_HOST_BYTES_PER_SUBFRAME 0x3C00
  129. #if defined(CONFIG_FB_MSM_MDP31) || defined(CONFIG_FB_MSM_MDP40)
  130. #define MDDI_HOST_TA2_LEN 0x001a
  131. #define MDDI_HOST_REV_RATE_DIV 0x0004
  132. #else
  133. #define MDDI_HOST_TA2_LEN 0x000c
  134. #define MDDI_HOST_REV_RATE_DIV 0x0002
  135. #endif
  136. #define MDDI_MSG_EMERG(msg, ...) \
  137. if (mddi_msg_level > 0) \
  138. printk(KERN_EMERG msg, ## __VA_ARGS__);
  139. #define MDDI_MSG_ALERT(msg, ...) \
  140. if (mddi_msg_level > 1) \
  141. printk(KERN_ALERT msg, ## __VA_ARGS__);
  142. #define MDDI_MSG_CRIT(msg, ...) \
  143. if (mddi_msg_level > 2) \
  144. printk(KERN_CRIT msg, ## __VA_ARGS__);
  145. #define MDDI_MSG_ERR(msg, ...) \
  146. if (mddi_msg_level > 3) \
  147. printk(KERN_ERR msg, ## __VA_ARGS__);
  148. #define MDDI_MSG_WARNING(msg, ...) \
  149. if (mddi_msg_level > 4) \
  150. printk(KERN_WARNING msg, ## __VA_ARGS__);
  151. #define MDDI_MSG_NOTICE(msg, ...) \
  152. if (mddi_msg_level > 5) \
  153. printk(KERN_NOTICE msg, ## __VA_ARGS__);
  154. #define MDDI_MSG_INFO(msg, ...) \
  155. if (mddi_msg_level > 6) \
  156. printk(KERN_INFO msg, ## __VA_ARGS__);
  157. #define MDDI_MSG_DEBUG(msg, ...) \
  158. if (mddi_msg_level > 7) \
  159. printk(KERN_DEBUG msg, ## __VA_ARGS__);
  160. #define GCC_PACKED __attribute__((packed))
  161. typedef struct GCC_PACKED {
  162. uint16 packet_length;
  163. /* total # of bytes in the packet not including
  164. the packet_length field. */
  165. uint16 packet_type;
  166. /* A Packet Type of 70 identifies the packet as
  167. a Client status Packet. */
  168. uint16 bClient_ID;
  169. /* This field is reserved for future use and shall
  170. be set to zero. */
  171. } mddi_rev_packet_type;
  172. typedef struct GCC_PACKED {
  173. uint16 packet_length;
  174. /* total # of bytes in the packet not including
  175. the packet_length field. */
  176. uint16 packet_type;
  177. /* A Packet Type of 70 identifies the packet as
  178. a Client status Packet. */
  179. uint16 bClient_ID;
  180. /* This field is reserved for future use and shall
  181. be set to zero. */
  182. uint16 reverse_link_request;
  183. /* 16 bit unsigned integer with number of bytes client
  184. needs in the * reverse encapsulation message
  185. to transmit data. */
  186. uint8 crc_error_count;
  187. uint8 capability_change;
  188. uint16 graphics_busy_flags;
  189. uint16 parameter_CRC;
  190. /* 16-bit CRC of all the bytes in the packet
  191. including Packet Length. */
  192. } mddi_client_status_type;
  193. typedef struct GCC_PACKED {
  194. uint16 packet_length;
  195. /* total # of bytes in the packet not including
  196. the packet_length field. */
  197. uint16 packet_type;
  198. /* A Packet Type of 66 identifies the packet as
  199. a Client Capability Packet. */
  200. uint16 bClient_ID;
  201. /* This field is reserved for future use and
  202. shall be set to zero. */
  203. uint16 Protocol_Version;
  204. uint16 Minimum_Protocol_Version;
  205. uint16 Data_Rate_Capability;
  206. uint8 Interface_Type_Capability;
  207. uint8 Number_of_Alt_Displays;
  208. uint16 PostCal_Data_Rate;
  209. uint16 Bitmap_Width;
  210. uint16 Bitmap_Height;
  211. uint16 Display_Window_Width;
  212. uint16 Display_Window_Height;
  213. uint32 Color_Map_Size;
  214. uint16 Color_Map_RGB_Width;
  215. uint16 RGB_Capability;
  216. uint8 Monochrome_Capability;
  217. uint8 Reserved_1;
  218. uint16 Y_Cb_Cr_Capability;
  219. uint16 Bayer_Capability;
  220. uint16 Alpha_Cursor_Image_Planes;
  221. uint32 Client_Feature_Capability_Indicators;
  222. uint8 Maximum_Video_Frame_Rate_Capability;
  223. uint8 Minimum_Video_Frame_Rate_Capability;
  224. uint16 Minimum_Sub_frame_Rate;
  225. uint16 Audio_Buffer_Depth;
  226. uint16 Audio_Channel_Capability;
  227. uint16 Audio_Sample_Rate_Capability;
  228. uint8 Audio_Sample_Resolution;
  229. uint8 Mic_Audio_Sample_Resolution;
  230. uint16 Mic_Sample_Rate_Capability;
  231. uint8 Keyboard_Data_Format;
  232. uint8 pointing_device_data_format;
  233. uint16 content_protection_type;
  234. uint16 Mfr_Name;
  235. uint16 Product_Code;
  236. uint16 Reserved_3;
  237. uint32 Serial_Number;
  238. uint8 Week_of_Manufacture;
  239. uint8 Year_of_Manufacture;
  240. uint16 parameter_CRC;
  241. /* 16-bit CRC of all the bytes in the packet including Packet Length. */
  242. } mddi_client_capability_type;
  243. typedef struct GCC_PACKED {
  244. uint16 packet_length;
  245. /* total # of bytes in the packet not including the packet_length field. */
  246. uint16 packet_type;
  247. /* A Packet Type of 16 identifies the packet as a Video Stream Packet. */
  248. uint16 bClient_ID;
  249. /* This field is reserved for future use and shall be set to zero. */
  250. uint16 video_data_format_descriptor;
  251. /* format of each pixel in the Pixel Data in the present stream in the
  252. * present packet.
  253. * If bits [15:13] = 000 monochrome
  254. * If bits [15:13] = 001 color pixels (palette).
  255. * If bits [15:13] = 010 color pixels in raw RGB
  256. * If bits [15:13] = 011 data in 4:2:2 Y Cb Cr format
  257. * If bits [15:13] = 100 Bayer pixels
  258. */
  259. uint16 pixel_data_attributes;
  260. /* interpreted as follows:
  261. * Bits [1:0] = 11 pixel data is displayed to both eyes
  262. * Bits [1:0] = 10 pixel data is routed to the left eye only.
  263. * Bits [1:0] = 01 pixel data is routed to the right eye only.
  264. * Bits [1:0] = 00 pixel data is routed to the alternate display.
  265. * Bit 2 is 0 Pixel Data is in the standard progressive format.
  266. * Bit 2 is 1 Pixel Data is in interlace format.
  267. * Bit 3 is 0 Pixel Data is in the standard progressive format.
  268. * Bit 3 is 1 Pixel Data is in alternate pixel format.
  269. * Bit 4 is 0 Pixel Data is to or from the display frame buffer.
  270. * Bit 4 is 1 Pixel Data is to or from the camera.
  271. * Bit 5 is 0 pixel data contains the next consecutive row of pixels.
  272. * Bit 5 is 1 X Left Edge, Y Top Edge, X Right Edge, Y Bottom Edge,
  273. * X Start, and Y Start parameters are not defined and
  274. * shall be ignored by the client.
  275. * Bits [7:6] = 01 Pixel data is written to the offline image buffer.
  276. * Bits [7:6] = 00 Pixel data is written to the buffer to refresh display.
  277. * Bits [7:6] = 11 Pixel data is written to all image buffers.
  278. * Bits [7:6] = 10 Invalid. Reserved for future use.
  279. * Bits 8 through 11 alternate display number.
  280. * Bits 12 through 14 are reserved for future use and shall be set to zero.
  281. * Bit 15 is 1 the row of pixels is the last row of pixels in a frame.
  282. */
  283. uint16 x_left_edge;
  284. uint16 y_top_edge;
  285. /* X,Y coordinate of the top left edge of the screen window */
  286. uint16 x_right_edge;
  287. uint16 y_bottom_edge;
  288. /* X,Y coordinate of the bottom right edge of the window being updated. */
  289. uint16 x_start;
  290. uint16 y_start;
  291. /* (X Start, Y Start) is the first pixel in the Pixel Data field below. */
  292. uint16 pixel_count;
  293. /* number of pixels in the Pixel Data field below. */
  294. uint16 parameter_CRC;
  295. /* 16-bit CRC of all bytes from the Packet Length to the Pixel Count. */
  296. uint16 reserved;
  297. /* 16-bit variable to make structure align on 4 byte boundary */
  298. } mddi_video_stream_packet_type;
  299. typedef struct GCC_PACKED {
  300. uint16 packet_length;
  301. /* total # of bytes in the packet not including the packet_length field. */
  302. uint16 packet_type;
  303. /* A Packet Type of 146 identifies the packet as a Register Access Packet. */
  304. uint16 bClient_ID;
  305. /* This field is reserved for future use and shall be set to zero. */
  306. uint16 read_write_info;
  307. /* Bits 13:0 a 14-bit unsigned integer that specifies the number of
  308. * 32-bit Register Data List items to be transferred in the
  309. * Register Data List field.
  310. * Bits[15:14] = 00 Write to register(s);
  311. * Bits[15:14] = 10 Read from register(s);
  312. * Bits[15:14] = 11 Response to a Read.
  313. * Bits[15:14] = 01 this value is reserved for future use. */
  314. uint32 register_address;
  315. /* the register address that is to be written to or read from. */
  316. uint16 parameter_CRC;
  317. /* 16-bit CRC of all bytes from the Packet Length to the Register Address. */
  318. uint32 register_data_list[MDDI_HOST_MAX_CLIENT_REG_IN_SAME_ADDR];
  319. /* list of 4-byte register data values for/from client registers */
  320. /* For multi-read/write, 512(128 * 4) bytes of data available */
  321. } mddi_register_access_packet_type;
  322. typedef union GCC_PACKED {
  323. mddi_video_stream_packet_type video_pkt;
  324. mddi_register_access_packet_type register_pkt;
  325. #ifdef ENABLE_MDDI_MULTI_READ_WRITE
  326. /* add 1008 byte pad to ensure 1024 byte llist struct, that can be
  327. * manipulated easily with cache */
  328. uint32 alignment_pad[252]; /* 1008 bytes */
  329. #else
  330. /* add 48 byte pad to ensure 64 byte llist struct, that can be
  331. * manipulated easily with cache */
  332. uint32 alignment_pad[12]; /* 48 bytes */
  333. #endif
  334. } mddi_packet_header_type;
  335. typedef struct GCC_PACKED mddi_host_llist_struct {
  336. uint16 link_controller_flags;
  337. uint16 packet_header_count;
  338. uint16 packet_data_count;
  339. void *packet_data_pointer;
  340. struct mddi_host_llist_struct *next_packet_pointer;
  341. uint16 reserved;
  342. mddi_packet_header_type packet_header;
  343. } mddi_linked_list_type;
  344. typedef struct {
  345. struct completion done_comp;
  346. mddi_llist_done_cb_type done_cb;
  347. uint16 next_idx;
  348. boolean waiting;
  349. boolean in_use;
  350. } mddi_linked_list_notify_type;
  351. #ifdef ENABLE_MDDI_MULTI_READ_WRITE
  352. #define MDDI_LLIST_POOL_SIZE 0x10000
  353. #else
  354. #define MDDI_LLIST_POOL_SIZE 0x1000
  355. #endif
  356. #define MDDI_MAX_NUM_LLIST_ITEMS (MDDI_LLIST_POOL_SIZE / \
  357. sizeof(mddi_linked_list_type))
  358. #define UNASSIGNED_INDEX MDDI_MAX_NUM_LLIST_ITEMS
  359. #define MDDI_FIRST_DYNAMIC_LLIST_IDX 0
  360. /* Static llist items can be used for applications that frequently send
  361. * the same set of packets using the linked list interface. */
  362. /* Here we configure for 6 static linked list items:
  363. * The 1st is used for a the adaptive backlight setting.
  364. * and the remaining 5 are used for sending window adjustments for
  365. * MDDI clients that need windowing info sent separate from video
  366. * packets. */
  367. #define MDDI_NUM_STATIC_ABL_ITEMS 1
  368. #define MDDI_NUM_STATIC_WINDOW_ITEMS 5
  369. #define MDDI_NUM_STATIC_LLIST_ITEMS (MDDI_NUM_STATIC_ABL_ITEMS + \
  370. MDDI_NUM_STATIC_WINDOW_ITEMS)
  371. #define MDDI_NUM_DYNAMIC_LLIST_ITEMS (MDDI_MAX_NUM_LLIST_ITEMS - \
  372. MDDI_NUM_STATIC_LLIST_ITEMS)
  373. #define MDDI_FIRST_STATIC_LLIST_IDX MDDI_NUM_DYNAMIC_LLIST_ITEMS
  374. #define MDDI_FIRST_STATIC_ABL_IDX MDDI_FIRST_STATIC_LLIST_IDX
  375. #define MDDI_FIRST_STATIC_WINDOW_IDX (MDDI_FIRST_STATIC_LLIST_IDX + \
  376. MDDI_NUM_STATIC_ABL_ITEMS)
  377. /* GPIO registers */
  378. #define VSYNC_WAKEUP_REG 0x80
  379. #define GPIO_REG 0x81
  380. #define GPIO_OUTPUT_REG 0x82
  381. #define GPIO_INTERRUPT_REG 0x83
  382. #define GPIO_INTERRUPT_ENABLE_REG 0x84
  383. #define GPIO_POLARITY_REG 0x85
  384. /* Interrupt Bits */
  385. #define MDDI_INT_PRI_PTR_READ 0x0001
  386. #define MDDI_INT_SEC_PTR_READ 0x0002
  387. #define MDDI_INT_REV_DATA_AVAIL 0x0004
  388. #define MDDI_INT_DISP_REQ 0x0008
  389. #define MDDI_INT_PRI_UNDERFLOW 0x0010
  390. #define MDDI_INT_SEC_UNDERFLOW 0x0020
  391. #define MDDI_INT_REV_OVERFLOW 0x0040
  392. #define MDDI_INT_CRC_ERROR 0x0080
  393. #define MDDI_INT_MDDI_IN 0x0100
  394. #define MDDI_INT_PRI_OVERWRITE 0x0200
  395. #define MDDI_INT_SEC_OVERWRITE 0x0400
  396. #define MDDI_INT_REV_OVERWRITE 0x0800
  397. #define MDDI_INT_DMA_FAILURE 0x1000
  398. #define MDDI_INT_LINK_ACTIVE 0x2000
  399. #define MDDI_INT_IN_HIBERNATION 0x4000
  400. #define MDDI_INT_PRI_LINK_LIST_DONE 0x8000
  401. #define MDDI_INT_SEC_LINK_LIST_DONE 0x10000
  402. #define MDDI_INT_NO_CMD_PKTS_PEND 0x20000
  403. #define MDDI_INT_RTD_FAILURE 0x40000
  404. #define MDDI_INT_ERROR_CONDITIONS ( \
  405. MDDI_INT_PRI_UNDERFLOW | MDDI_INT_SEC_UNDERFLOW | \
  406. MDDI_INT_REV_OVERFLOW | MDDI_INT_CRC_ERROR | \
  407. MDDI_INT_PRI_OVERWRITE | MDDI_INT_SEC_OVERWRITE | \
  408. MDDI_INT_RTD_FAILURE | \
  409. MDDI_INT_REV_OVERWRITE | MDDI_INT_DMA_FAILURE)
  410. #define MDDI_INT_LINK_STATE_CHANGES ( \
  411. MDDI_INT_LINK_ACTIVE | MDDI_INT_IN_HIBERNATION)
  412. /* Status Bits */
  413. #define MDDI_STAT_LINK_ACTIVE 0x0001
  414. #define MDDI_STAT_NEW_REV_PTR 0x0002
  415. #define MDDI_STAT_NEW_PRI_PTR 0x0004
  416. #define MDDI_STAT_NEW_SEC_PTR 0x0008
  417. #define MDDI_STAT_IN_HIBERNATION 0x0010
  418. #define MDDI_STAT_PRI_LINK_LIST_DONE 0x0020
  419. #define MDDI_STAT_SEC_LINK_LIST_DONE 0x0040
  420. #define MDDI_STAT_PENDING_TIMING_PKT 0x0080
  421. #define MDDI_STAT_PENDING_REV_ENCAP 0x0100
  422. #define MDDI_STAT_PENDING_POWERDOWN 0x0200
  423. #define MDDI_STAT_RTD_MEAS_FAIL 0x0800
  424. #define MDDI_STAT_CLIENT_WAKEUP_REQ 0x1000
  425. /* Command Bits */
  426. #define MDDI_CMD_POWERDOWN 0x0100
  427. #define MDDI_CMD_POWERUP 0x0200
  428. #define MDDI_CMD_HIBERNATE 0x0300
  429. #define MDDI_CMD_RESET 0x0400
  430. #define MDDI_CMD_DISP_IGNORE 0x0501
  431. #define MDDI_CMD_DISP_LISTEN 0x0500
  432. #define MDDI_CMD_SEND_REV_ENCAP 0x0600
  433. #define MDDI_CMD_GET_CLIENT_CAP 0x0601
  434. #define MDDI_CMD_GET_CLIENT_STATUS 0x0602
  435. #define MDDI_CMD_SEND_RTD 0x0700
  436. #define MDDI_CMD_LINK_ACTIVE 0x0900
  437. #define MDDI_CMD_PERIODIC_REV_ENCAP 0x0A00
  438. #define MDDI_CMD_FW_LINK_SKEW_CAL 0x0D00
  439. extern void mddi_host_init(mddi_host_type host);
  440. extern void mddi_host_powerdown(mddi_host_type host);
  441. extern uint16 mddi_get_next_free_llist_item(mddi_host_type host, boolean wait);
  442. extern uint16 mddi_get_reg_read_llist_item(mddi_host_type host, boolean wait);
  443. extern void mddi_queue_forward_packets(uint16 first_llist_idx,
  444. uint16 last_llist_idx,
  445. boolean wait,
  446. mddi_llist_done_cb_type llist_done_cb,
  447. mddi_host_type host);
  448. extern void mddi_host_write_pix_attr_reg(uint32 value);
  449. extern void mddi_client_lcd_gpio_poll(uint32 poll_reg_val);
  450. extern void mddi_client_lcd_vsync_detected(boolean detected);
  451. extern void mddi_host_disable_hibernation(boolean disable);
  452. extern mddi_linked_list_type *llist_extern[];
  453. extern mddi_linked_list_type *llist_dma_extern[];
  454. extern mddi_linked_list_notify_type *llist_extern_notify[];
  455. extern struct timer_list mddi_host_timer;
  456. typedef struct {
  457. uint16 transmitting_start_idx;
  458. uint16 transmitting_end_idx;
  459. uint16 waiting_start_idx;
  460. uint16 waiting_end_idx;
  461. uint16 reg_read_idx;
  462. uint16 next_free_idx;
  463. boolean reg_read_waiting;
  464. } mddi_llist_info_type;
  465. extern mddi_llist_info_type mddi_llist;
  466. #define MDDI_GPIO_DEFAULT_POLLING_INTERVAL 200
  467. typedef struct {
  468. uint32 polling_reg;
  469. uint32 polling_val;
  470. uint32 polling_interval;
  471. boolean polling_enabled;
  472. } mddi_gpio_info_type;
  473. uint32 mddi_get_client_id(void);
  474. void mddi_mhctl_remove(mddi_host_type host_idx);
  475. void mddi_host_timer_service(unsigned long data);
  476. void mddi_host_client_cnt_reset(void);
  477. #endif /* MDDIHOSTI_H */