dsi_ctrl_hw.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DSI_CTRL_HW_H_
  6. #define _DSI_CTRL_HW_H_
  7. #include <linux/kernel.h>
  8. #include <linux/types.h>
  9. #include <linux/bitops.h>
  10. #include <linux/bitmap.h>
  11. #include "dsi_defs.h"
  12. #include "dsi_hw.h"
  13. #define DSI_CTRL_HW_DBG(c, fmt, ...) DRM_DEV_DEBUG(NULL, "[msm-dsi-debug]: DSI_%d: "\
  14. fmt, c ? c->index : -1, ##__VA_ARGS__)
  15. #define DSI_CTRL_HW_ERR(c, fmt, ...) DRM_DEV_ERROR(NULL, "[msm-dsi-error]: DSI_%d: "\
  16. fmt, c ? c->index : -1, ##__VA_ARGS__)
  17. #define DSI_CTRL_HW_INFO(c, fmt, ...) DRM_DEV_INFO(NULL, "[msm-dsi-info]: DSI_%d: "\
  18. fmt, c ? c->index : -1, ##__VA_ARGS__)
  19. #define DSI_MMSS_MISC_R32(dsi_ctrl_hw, off) DSI_GEN_R32((dsi_ctrl_hw)->mmss_misc_base, off)
  20. #define DSI_MMSS_MISC_W32(dsi_ctrl_hw, off, val) \
  21. DSI_GEN_W32_DEBUG((dsi_ctrl_hw)->mmss_misc_base, (dsi_ctrl_hw)->index, off, val)
  22. #define DSI_DISP_CC_R32(dsi_ctrl_hw, off) DSI_GEN_R32((dsi_ctrl_hw)->disp_cc_base, off)
  23. #define DSI_DISP_CC_W32(dsi_ctrl_hw, off, val) \
  24. DSI_GEN_W32_DEBUG((dsi_ctrl_hw)->disp_cc_base, (dsi_ctrl_hw)->index, off, val)
  25. #define DSI_MDP_INTF_R32(dsi_ctrl_hw, off) DSI_GEN_R32((dsi_ctrl_hw)->mdp_intf_base, off)
  26. #define DSI_MDP_INTF_W32(dsi_ctrl_hw, off, val) \
  27. DSI_GEN_W32_DEBUG((dsi_ctrl_hw)->mdp_intf_base, (dsi_ctrl_hw)->index, off, val)
  28. /**
  29. * Modifier flag for command transmission. If this flag is set, command
  30. * information is programmed to hardware and transmission is not triggered.
  31. * Caller should call the trigger_command_dma() to start the transmission. This
  32. * flag is valed for kickoff_command() and kickoff_fifo_command() operations.
  33. */
  34. #define DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER 0x1
  35. /**
  36. * enum dsi_ctrl_version - version of the dsi host controller
  37. * @DSI_CTRL_VERSION_UNKNOWN: Unknown controller version
  38. * @DSI_CTRL_VERSION_2_2: DSI host v2.2 controller
  39. * @DSI_CTRL_VERSION_2_3: DSI host v2.3 controller
  40. * @DSI_CTRL_VERSION_2_4: DSI host v2.4 controller
  41. * @DSI_CTRL_VERSION_2_5: DSI host v2.5 controller
  42. * @DSI_CTRL_VERSION_2_6: DSI host v2.6 controller
  43. * @DSI_CTRL_VERSION_2_7: DSI host v2.7 controller
  44. * @DSI_CTRL_VERSION_MAX: max version
  45. */
  46. enum dsi_ctrl_version {
  47. DSI_CTRL_VERSION_UNKNOWN,
  48. DSI_CTRL_VERSION_2_2,
  49. DSI_CTRL_VERSION_2_3,
  50. DSI_CTRL_VERSION_2_4,
  51. DSI_CTRL_VERSION_2_5,
  52. DSI_CTRL_VERSION_2_6,
  53. DSI_CTRL_VERSION_2_7,
  54. DSI_CTRL_VERSION_MAX
  55. };
  56. /**
  57. * enum dsi_ctrl_hw_features - features supported by dsi host controller
  58. * @DSI_CTRL_VIDEO_TPG: Test pattern support for video mode.
  59. * @DSI_CTRL_CMD_TPG: Test pattern support for command mode.
  60. * @DSI_CTRL_VARIABLE_REFRESH_RATE: variable panel timing
  61. * @DSI_CTRL_DYNAMIC_REFRESH: variable pixel clock rate
  62. * @DSI_CTRL_NULL_PACKET_INSERTION: NULL packet insertion
  63. * @DSI_CTRL_DESKEW_CALIB: Deskew calibration support
  64. * @DSI_CTRL_DPHY: Controller support for DPHY
  65. * @DSI_CTRL_CPHY: Controller support for CPHY
  66. * @DSI_CTRL_MAX_FEATURES:
  67. */
  68. enum dsi_ctrl_hw_features {
  69. DSI_CTRL_VIDEO_TPG,
  70. DSI_CTRL_CMD_TPG,
  71. DSI_CTRL_VARIABLE_REFRESH_RATE,
  72. DSI_CTRL_DYNAMIC_REFRESH,
  73. DSI_CTRL_NULL_PACKET_INSERTION,
  74. DSI_CTRL_DESKEW_CALIB,
  75. DSI_CTRL_DPHY,
  76. DSI_CTRL_CPHY,
  77. DSI_CTRL_MAX_FEATURES
  78. };
  79. /**
  80. * enum dsi_test_pattern - test pattern type
  81. * @DSI_TEST_PATTERN_FIXED: Test pattern is fixed, based on init value.
  82. * @DSI_TEST_PATTERN_INC: Incremental test pattern, base on init value.
  83. * @DSI_TEST_PATTERN_POLY: Pattern generated from polynomial and init val.
  84. * @DSI_TEST_PATTERN_MAX:
  85. */
  86. enum dsi_test_pattern {
  87. DSI_TEST_PATTERN_FIXED = 0,
  88. DSI_TEST_PATTERN_INC,
  89. DSI_TEST_PATTERN_POLY,
  90. DSI_TEST_PATTERN_MAX
  91. };
  92. /**
  93. * enum dsi_status_int_index - index of interrupts generated by DSI controller
  94. * @DSI_SINT_CMD_MODE_DMA_DONE: Command mode DMA packets are sent out.
  95. * @DSI_SINT_CMD_STREAM0_FRAME_DONE: A frame of cmd mode stream0 is sent out.
  96. * @DSI_SINT_CMD_STREAM1_FRAME_DONE: A frame of cmd mode stream1 is sent out.
  97. * @DSI_SINT_CMD_STREAM2_FRAME_DONE: A frame of cmd mode stream2 is sent out.
  98. * @DSI_SINT_VIDEO_MODE_FRAME_DONE: A frame of video mode stream is sent out.
  99. * @DSI_SINT_BTA_DONE: A BTA is completed.
  100. * @DSI_SINT_CMD_FRAME_DONE: A frame of selected cmd mode stream is
  101. * sent out by MDP.
  102. * @DSI_SINT_DYN_REFRESH_DONE: The dynamic refresh operation completed.
  103. * @DSI_SINT_DESKEW_DONE: The deskew calibration operation done.
  104. * @DSI_SINT_DYN_BLANK_DMA_DONE: The dynamic blankin DMA operation has
  105. * completed.
  106. * @DSI_SINT_ERROR: DSI error has happened.
  107. */
  108. enum dsi_status_int_index {
  109. DSI_SINT_CMD_MODE_DMA_DONE = 0,
  110. DSI_SINT_CMD_STREAM0_FRAME_DONE = 1,
  111. DSI_SINT_CMD_STREAM1_FRAME_DONE = 2,
  112. DSI_SINT_CMD_STREAM2_FRAME_DONE = 3,
  113. DSI_SINT_VIDEO_MODE_FRAME_DONE = 4,
  114. DSI_SINT_BTA_DONE = 5,
  115. DSI_SINT_CMD_FRAME_DONE = 6,
  116. DSI_SINT_DYN_REFRESH_DONE = 7,
  117. DSI_SINT_DESKEW_DONE = 8,
  118. DSI_SINT_DYN_BLANK_DMA_DONE = 9,
  119. DSI_SINT_ERROR = 10,
  120. DSI_STATUS_INTERRUPT_COUNT
  121. };
  122. /**
  123. * enum dsi_status_int_type - status interrupts generated by DSI controller
  124. * @DSI_CMD_MODE_DMA_DONE: Command mode DMA packets are sent out.
  125. * @DSI_CMD_STREAM0_FRAME_DONE: A frame of command mode stream0 is sent out.
  126. * @DSI_CMD_STREAM1_FRAME_DONE: A frame of command mode stream1 is sent out.
  127. * @DSI_CMD_STREAM2_FRAME_DONE: A frame of command mode stream2 is sent out.
  128. * @DSI_VIDEO_MODE_FRAME_DONE: A frame of video mode stream is sent out.
  129. * @DSI_BTA_DONE: A BTA is completed.
  130. * @DSI_CMD_FRAME_DONE: A frame of selected command mode stream is
  131. * sent out by MDP.
  132. * @DSI_DYN_REFRESH_DONE: The dynamic refresh operation has completed.
  133. * @DSI_DESKEW_DONE: The deskew calibration operation has completed
  134. * @DSI_DYN_BLANK_DMA_DONE: The dynamic blankin DMA operation has
  135. * completed.
  136. * @DSI_ERROR: DSI error has happened.
  137. */
  138. enum dsi_status_int_type {
  139. DSI_CMD_MODE_DMA_DONE = BIT(DSI_SINT_CMD_MODE_DMA_DONE),
  140. DSI_CMD_STREAM0_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM0_FRAME_DONE),
  141. DSI_CMD_STREAM1_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM1_FRAME_DONE),
  142. DSI_CMD_STREAM2_FRAME_DONE = BIT(DSI_SINT_CMD_STREAM2_FRAME_DONE),
  143. DSI_VIDEO_MODE_FRAME_DONE = BIT(DSI_SINT_VIDEO_MODE_FRAME_DONE),
  144. DSI_BTA_DONE = BIT(DSI_SINT_BTA_DONE),
  145. DSI_CMD_FRAME_DONE = BIT(DSI_SINT_CMD_FRAME_DONE),
  146. DSI_DYN_REFRESH_DONE = BIT(DSI_SINT_DYN_REFRESH_DONE),
  147. DSI_DESKEW_DONE = BIT(DSI_SINT_DESKEW_DONE),
  148. DSI_DYN_BLANK_DMA_DONE = BIT(DSI_SINT_DYN_BLANK_DMA_DONE),
  149. DSI_ERROR = BIT(DSI_SINT_ERROR)
  150. };
  151. /**
  152. * enum dsi_error_int_index - index of error interrupts from DSI controller
  153. * @DSI_EINT_RDBK_SINGLE_ECC_ERR: Single bit ECC error in read packet.
  154. * @DSI_EINT_RDBK_MULTI_ECC_ERR: Multi bit ECC error in read packet.
  155. * @DSI_EINT_RDBK_CRC_ERR: CRC error in read packet.
  156. * @DSI_EINT_RDBK_INCOMPLETE_PKT: Incomplete read packet.
  157. * @DSI_EINT_PERIPH_ERROR_PKT: Error packet returned from peripheral,
  158. * @DSI_EINT_LP_RX_TIMEOUT: Low power reverse transmission timeout.
  159. * @DSI_EINT_HS_TX_TIMEOUT: High speed fwd transmission timeout.
  160. * @DSI_EINT_BTA_TIMEOUT: BTA timeout.
  161. * @DSI_EINT_PLL_UNLOCK: PLL has unlocked.
  162. * @DSI_EINT_DLN0_ESC_ENTRY_ERR: Incorrect LP Rx escape entry.
  163. * @DSI_EINT_DLN0_ESC_SYNC_ERR: LP Rx data is not byte aligned.
  164. * @DSI_EINT_DLN0_LP_CONTROL_ERR: Incorrect LP Rx state sequence.
  165. * @DSI_EINT_PANEL_SPECIFIC_ERR: DSI Protocol violation error.
  166. * @DSI_EINT_INTERLEAVE_OP_CONTENTION: Interleave operation contention.
  167. * @DSI_EINT_CMD_DMA_FIFO_UNDERFLOW: Command mode DMA FIFO underflow.
  168. * @DSI_EINT_CMD_MDP_FIFO_UNDERFLOW: Command MDP FIFO underflow (failed to
  169. * receive one complete line from MDP).
  170. * @DSI_EINT_DLN0_HS_FIFO_OVERFLOW: High speed FIFO data lane 0 overflows.
  171. * @DSI_EINT_DLN1_HS_FIFO_OVERFLOW: High speed FIFO data lane 1 overflows.
  172. * @DSI_EINT_DLN2_HS_FIFO_OVERFLOW: High speed FIFO data lane 2 overflows.
  173. * @DSI_EINT_DLN3_HS_FIFO_OVERFLOW: High speed FIFO data lane 3 overflows.
  174. * @DSI_EINT_DLN0_HS_FIFO_UNDERFLOW: High speed FIFO data lane 0 underflows.
  175. * @DSI_EINT_DLN1_HS_FIFO_UNDERFLOW: High speed FIFO data lane 1 underflows.
  176. * @DSI_EINT_DLN2_HS_FIFO_UNDERFLOW: High speed FIFO data lane 2 underflows.
  177. * @DSI_EINT_DLN3_HS_FIFO_UNDERFLOW: High speed FIFO data lane 3 undeflows.
  178. * @DSI_EINT_DLN0_LP0_CONTENTION: PHY level contention while lane 0 low.
  179. * @DSI_EINT_DLN1_LP0_CONTENTION: PHY level contention while lane 1 low.
  180. * @DSI_EINT_DLN2_LP0_CONTENTION: PHY level contention while lane 2 low.
  181. * @DSI_EINT_DLN3_LP0_CONTENTION: PHY level contention while lane 3 low.
  182. * @DSI_EINT_DLN0_LP1_CONTENTION: PHY level contention while lane 0 high.
  183. * @DSI_EINT_DLN1_LP1_CONTENTION: PHY level contention while lane 1 high.
  184. * @DSI_EINT_DLN2_LP1_CONTENTION: PHY level contention while lane 2 high.
  185. * @DSI_EINT_DLN3_LP1_CONTENTION: PHY level contention while lane 3 high.
  186. */
  187. enum dsi_error_int_index {
  188. DSI_EINT_RDBK_SINGLE_ECC_ERR = 0,
  189. DSI_EINT_RDBK_MULTI_ECC_ERR = 1,
  190. DSI_EINT_RDBK_CRC_ERR = 2,
  191. DSI_EINT_RDBK_INCOMPLETE_PKT = 3,
  192. DSI_EINT_PERIPH_ERROR_PKT = 4,
  193. DSI_EINT_LP_RX_TIMEOUT = 5,
  194. DSI_EINT_HS_TX_TIMEOUT = 6,
  195. DSI_EINT_BTA_TIMEOUT = 7,
  196. DSI_EINT_PLL_UNLOCK = 8,
  197. DSI_EINT_DLN0_ESC_ENTRY_ERR = 9,
  198. DSI_EINT_DLN0_ESC_SYNC_ERR = 10,
  199. DSI_EINT_DLN0_LP_CONTROL_ERR = 11,
  200. DSI_EINT_PANEL_SPECIFIC_ERR = 12,
  201. DSI_EINT_INTERLEAVE_OP_CONTENTION = 13,
  202. DSI_EINT_CMD_DMA_FIFO_UNDERFLOW = 14,
  203. DSI_EINT_CMD_MDP_FIFO_UNDERFLOW = 15,
  204. DSI_EINT_DLN0_HS_FIFO_OVERFLOW = 16,
  205. DSI_EINT_DLN1_HS_FIFO_OVERFLOW = 17,
  206. DSI_EINT_DLN2_HS_FIFO_OVERFLOW = 18,
  207. DSI_EINT_DLN3_HS_FIFO_OVERFLOW = 19,
  208. DSI_EINT_DLN0_HS_FIFO_UNDERFLOW = 20,
  209. DSI_EINT_DLN1_HS_FIFO_UNDERFLOW = 21,
  210. DSI_EINT_DLN2_HS_FIFO_UNDERFLOW = 22,
  211. DSI_EINT_DLN3_HS_FIFO_UNDERFLOW = 23,
  212. DSI_EINT_DLN0_LP0_CONTENTION = 24,
  213. DSI_EINT_DLN1_LP0_CONTENTION = 25,
  214. DSI_EINT_DLN2_LP0_CONTENTION = 26,
  215. DSI_EINT_DLN3_LP0_CONTENTION = 27,
  216. DSI_EINT_DLN0_LP1_CONTENTION = 28,
  217. DSI_EINT_DLN1_LP1_CONTENTION = 29,
  218. DSI_EINT_DLN2_LP1_CONTENTION = 30,
  219. DSI_EINT_DLN3_LP1_CONTENTION = 31,
  220. DSI_ERROR_INTERRUPT_COUNT
  221. };
  222. /**
  223. * enum dsi_error_int_type - error interrupts generated by DSI controller
  224. * @DSI_RDBK_SINGLE_ECC_ERR: Single bit ECC error in read packet.
  225. * @DSI_RDBK_MULTI_ECC_ERR: Multi bit ECC error in read packet.
  226. * @DSI_RDBK_CRC_ERR: CRC error in read packet.
  227. * @DSI_RDBK_INCOMPLETE_PKT: Incomplete read packet.
  228. * @DSI_PERIPH_ERROR_PKT: Error packet returned from peripheral,
  229. * @DSI_LP_RX_TIMEOUT: Low power reverse transmission timeout.
  230. * @DSI_HS_TX_TIMEOUT: High speed forward transmission timeout.
  231. * @DSI_BTA_TIMEOUT: BTA timeout.
  232. * @DSI_PLL_UNLOCK: PLL has unlocked.
  233. * @DSI_DLN0_ESC_ENTRY_ERR: Incorrect LP Rx escape entry.
  234. * @DSI_DLN0_ESC_SYNC_ERR: LP Rx data is not byte aligned.
  235. * @DSI_DLN0_LP_CONTROL_ERR: Incorrect LP Rx state sequence.
  236. * @DSI_PANEL_SPECIFIC_ERR: DSI Protocol violation.
  237. * @DSI_INTERLEAVE_OP_CONTENTION: Interleave operation contention.
  238. * @DSI_CMD_DMA_FIFO_UNDERFLOW: Command mode DMA FIFO underflow.
  239. * @DSI_CMD_MDP_FIFO_UNDERFLOW: Command MDP FIFO underflow (failed to
  240. * receive one complete line from MDP).
  241. * @DSI_DLN0_HS_FIFO_OVERFLOW: High speed FIFO for data lane 0 overflows.
  242. * @DSI_DLN1_HS_FIFO_OVERFLOW: High speed FIFO for data lane 1 overflows.
  243. * @DSI_DLN2_HS_FIFO_OVERFLOW: High speed FIFO for data lane 2 overflows.
  244. * @DSI_DLN3_HS_FIFO_OVERFLOW: High speed FIFO for data lane 3 overflows.
  245. * @DSI_DLN0_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 0 underflows.
  246. * @DSI_DLN1_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 1 underflows.
  247. * @DSI_DLN2_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 2 underflows.
  248. * @DSI_DLN3_HS_FIFO_UNDERFLOW: High speed FIFO for data lane 3 undeflows.
  249. * @DSI_DLN0_LP0_CONTENTION: PHY level contention while lane 0 is low.
  250. * @DSI_DLN1_LP0_CONTENTION: PHY level contention while lane 1 is low.
  251. * @DSI_DLN2_LP0_CONTENTION: PHY level contention while lane 2 is low.
  252. * @DSI_DLN3_LP0_CONTENTION: PHY level contention while lane 3 is low.
  253. * @DSI_DLN0_LP1_CONTENTION: PHY level contention while lane 0 is high.
  254. * @DSI_DLN1_LP1_CONTENTION: PHY level contention while lane 1 is high.
  255. * @DSI_DLN2_LP1_CONTENTION: PHY level contention while lane 2 is high.
  256. * @DSI_DLN3_LP1_CONTENTION: PHY level contention while lane 3 is high.
  257. */
  258. enum dsi_error_int_type {
  259. DSI_RDBK_SINGLE_ECC_ERR = BIT(DSI_EINT_RDBK_SINGLE_ECC_ERR),
  260. DSI_RDBK_MULTI_ECC_ERR = BIT(DSI_EINT_RDBK_MULTI_ECC_ERR),
  261. DSI_RDBK_CRC_ERR = BIT(DSI_EINT_RDBK_CRC_ERR),
  262. DSI_RDBK_INCOMPLETE_PKT = BIT(DSI_EINT_RDBK_INCOMPLETE_PKT),
  263. DSI_PERIPH_ERROR_PKT = BIT(DSI_EINT_PERIPH_ERROR_PKT),
  264. DSI_LP_RX_TIMEOUT = BIT(DSI_EINT_LP_RX_TIMEOUT),
  265. DSI_HS_TX_TIMEOUT = BIT(DSI_EINT_HS_TX_TIMEOUT),
  266. DSI_BTA_TIMEOUT = BIT(DSI_EINT_BTA_TIMEOUT),
  267. DSI_PLL_UNLOCK = BIT(DSI_EINT_PLL_UNLOCK),
  268. DSI_DLN0_ESC_ENTRY_ERR = BIT(DSI_EINT_DLN0_ESC_ENTRY_ERR),
  269. DSI_DLN0_ESC_SYNC_ERR = BIT(DSI_EINT_DLN0_ESC_SYNC_ERR),
  270. DSI_DLN0_LP_CONTROL_ERR = BIT(DSI_EINT_DLN0_LP_CONTROL_ERR),
  271. DSI_PANEL_SPECIFIC_ERR = BIT(DSI_EINT_PANEL_SPECIFIC_ERR),
  272. DSI_INTERLEAVE_OP_CONTENTION = BIT(DSI_EINT_INTERLEAVE_OP_CONTENTION),
  273. DSI_CMD_DMA_FIFO_UNDERFLOW = BIT(DSI_EINT_CMD_DMA_FIFO_UNDERFLOW),
  274. DSI_CMD_MDP_FIFO_UNDERFLOW = BIT(DSI_EINT_CMD_MDP_FIFO_UNDERFLOW),
  275. DSI_DLN0_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN0_HS_FIFO_OVERFLOW),
  276. DSI_DLN1_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN1_HS_FIFO_OVERFLOW),
  277. DSI_DLN2_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN2_HS_FIFO_OVERFLOW),
  278. DSI_DLN3_HS_FIFO_OVERFLOW = BIT(DSI_EINT_DLN3_HS_FIFO_OVERFLOW),
  279. DSI_DLN0_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN0_HS_FIFO_UNDERFLOW),
  280. DSI_DLN1_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN1_HS_FIFO_UNDERFLOW),
  281. DSI_DLN2_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN2_HS_FIFO_UNDERFLOW),
  282. DSI_DLN3_HS_FIFO_UNDERFLOW = BIT(DSI_EINT_DLN3_HS_FIFO_UNDERFLOW),
  283. DSI_DLN0_LP0_CONTENTION = BIT(DSI_EINT_DLN0_LP0_CONTENTION),
  284. DSI_DLN1_LP0_CONTENTION = BIT(DSI_EINT_DLN1_LP0_CONTENTION),
  285. DSI_DLN2_LP0_CONTENTION = BIT(DSI_EINT_DLN2_LP0_CONTENTION),
  286. DSI_DLN3_LP0_CONTENTION = BIT(DSI_EINT_DLN3_LP0_CONTENTION),
  287. DSI_DLN0_LP1_CONTENTION = BIT(DSI_EINT_DLN0_LP1_CONTENTION),
  288. DSI_DLN1_LP1_CONTENTION = BIT(DSI_EINT_DLN1_LP1_CONTENTION),
  289. DSI_DLN2_LP1_CONTENTION = BIT(DSI_EINT_DLN2_LP1_CONTENTION),
  290. DSI_DLN3_LP1_CONTENTION = BIT(DSI_EINT_DLN3_LP1_CONTENTION),
  291. };
  292. /**
  293. * struct dsi_ctrl_cmd_dma_info - command buffer information
  294. * @offset: IOMMU VA for command buffer address.
  295. * @length: Length of the command buffer.
  296. * @datatype: Datatype of cmd.
  297. * @en_broadcast: Enable broadcast mode if set to true.
  298. * @is_master: Is master in broadcast mode.
  299. * @use_lpm: Use low power mode for command transmission.
  300. */
  301. struct dsi_ctrl_cmd_dma_info {
  302. u32 offset;
  303. u32 length;
  304. u8 datatype;
  305. bool en_broadcast;
  306. bool is_master;
  307. bool use_lpm;
  308. };
  309. /**
  310. * struct dsi_ctrl_cmd_dma_fifo_info - command payload tp be sent using FIFO
  311. * @command: VA for command buffer.
  312. * @size: Size of the command buffer.
  313. * @en_broadcast: Enable broadcast mode if set to true.
  314. * @is_master: Is master in broadcast mode.
  315. * @use_lpm: Use low power mode for command transmission.
  316. */
  317. struct dsi_ctrl_cmd_dma_fifo_info {
  318. u32 *command;
  319. u32 size;
  320. bool en_broadcast;
  321. bool is_master;
  322. bool use_lpm;
  323. };
  324. struct dsi_ctrl_hw;
  325. struct ctrl_ulps_config_ops {
  326. /**
  327. * ulps_request() - request ulps entry for specified lanes
  328. * @ctrl: Pointer to the controller host hardware.
  329. * @lanes: ORed list of lanes (enum dsi_data_lanes) which need
  330. * to enter ULPS.
  331. *
  332. * Caller should check if lanes are in ULPS mode by calling
  333. * get_lanes_in_ulps() operation.
  334. */
  335. void (*ulps_request)(struct dsi_ctrl_hw *ctrl, u32 lanes);
  336. /**
  337. * ulps_exit() - exit ULPS on specified lanes
  338. * @ctrl: Pointer to the controller host hardware.
  339. * @lanes: ORed list of lanes (enum dsi_data_lanes) which need
  340. * to exit ULPS.
  341. *
  342. * Caller should check if lanes are in active mode by calling
  343. * get_lanes_in_ulps() operation.
  344. */
  345. void (*ulps_exit)(struct dsi_ctrl_hw *ctrl, u32 lanes);
  346. /**
  347. * get_lanes_in_ulps() - returns the list of lanes in ULPS mode
  348. * @ctrl: Pointer to the controller host hardware.
  349. *
  350. * Returns an ORed list of lanes (enum dsi_data_lanes) that are in ULPS
  351. * state. If 0 is returned, all the lanes are active.
  352. *
  353. * Return: List of lanes in ULPS state.
  354. */
  355. u32 (*get_lanes_in_ulps)(struct dsi_ctrl_hw *ctrl);
  356. };
  357. /**
  358. * struct dsi_ctrl_hw_ops - operations supported by dsi host hardware
  359. */
  360. struct dsi_ctrl_hw_ops {
  361. /**
  362. * host_setup() - Setup DSI host configuration
  363. * @ctrl: Pointer to controller host hardware.
  364. * @config: Configuration for DSI host controller
  365. */
  366. void (*host_setup)(struct dsi_ctrl_hw *ctrl,
  367. struct dsi_host_common_cfg *config);
  368. /**
  369. * video_engine_en() - enable DSI video engine
  370. * @ctrl: Pointer to controller host hardware.
  371. * @on: Enable/disabel video engine.
  372. */
  373. void (*video_engine_en)(struct dsi_ctrl_hw *ctrl, bool on);
  374. /**
  375. * setup_avr() - set the AVR_SUPPORT_ENABLE bit in DSI_VIDEO_MODE_CTRL
  376. * @ctrl: Pointer to controller host hardware.
  377. * @enable: Controls whether this bit is set or cleared
  378. */
  379. void (*setup_avr)(struct dsi_ctrl_hw *ctrl, bool enable);
  380. /**
  381. * video_engine_setup() - Setup dsi host controller for video mode
  382. * @ctrl: Pointer to controller host hardware.
  383. * @common_cfg: Common configuration parameters.
  384. * @cfg: Video mode configuration.
  385. *
  386. * Set up DSI video engine with a specific configuration. Controller and
  387. * video engine are not enabled as part of this function.
  388. */
  389. void (*video_engine_setup)(struct dsi_ctrl_hw *ctrl,
  390. struct dsi_host_common_cfg *common_cfg,
  391. struct dsi_video_engine_cfg *cfg);
  392. /**
  393. * set_video_timing() - set up the timing for video frame
  394. * @ctrl: Pointer to controller host hardware.
  395. * @mode: Video mode information.
  396. *
  397. * Set up the video timing parameters for the DSI video mode operation.
  398. */
  399. void (*set_video_timing)(struct dsi_ctrl_hw *ctrl,
  400. struct dsi_mode_info *mode);
  401. /**
  402. * cmd_engine_setup() - setup dsi host controller for command mode
  403. * @ctrl: Pointer to the controller host hardware.
  404. * @common_cfg: Common configuration parameters.
  405. * @cfg: Command mode configuration.
  406. *
  407. * Setup DSI CMD engine with a specific configuration. Controller and
  408. * command engine are not enabled as part of this function.
  409. */
  410. void (*cmd_engine_setup)(struct dsi_ctrl_hw *ctrl,
  411. struct dsi_host_common_cfg *common_cfg,
  412. struct dsi_cmd_engine_cfg *cfg);
  413. /**
  414. * setup_cmd_stream() - set up parameters for command pixel streams
  415. * @ctrl: Pointer to controller host hardware.
  416. * @mode: Pointer to mode information.
  417. * @cfg: DSI host configuration that is common to both
  418. * video and command modes.
  419. * @vc_id: stream_id.
  420. *
  421. * Setup parameters for command mode pixel stream size.
  422. */
  423. void (*setup_cmd_stream)(struct dsi_ctrl_hw *ctrl,
  424. struct dsi_mode_info *mode,
  425. struct dsi_host_common_cfg *cfg,
  426. u32 vc_id,
  427. struct dsi_rect *roi);
  428. /**
  429. * ctrl_en() - enable DSI controller engine
  430. * @ctrl: Pointer to the controller host hardware.
  431. * @on: turn on/off the DSI controller engine.
  432. */
  433. void (*ctrl_en)(struct dsi_ctrl_hw *ctrl, bool on);
  434. /**
  435. * cmd_engine_en() - enable DSI controller command engine
  436. * @ctrl: Pointer to the controller host hardware.
  437. * @on: Turn on/off the DSI command engine.
  438. */
  439. void (*cmd_engine_en)(struct dsi_ctrl_hw *ctrl, bool on);
  440. /**
  441. * phy_sw_reset() - perform a soft reset on the PHY.
  442. * @ctrl: Pointer to the controller host hardware.
  443. */
  444. void (*phy_sw_reset)(struct dsi_ctrl_hw *ctrl);
  445. /**
  446. * config_clk_gating() - enable/disable DSI PHY clk gating
  447. * @ctrl: Pointer to the controller host hardware.
  448. * @enable: enable/disable DSI PHY clock gating.
  449. * @clk_selection: clock to enable/disable clock gating.
  450. */
  451. void (*config_clk_gating)(struct dsi_ctrl_hw *ctrl, bool enable,
  452. enum dsi_clk_gate_type clk_selection);
  453. /**
  454. * soft_reset() - perform a soft reset on DSI controller
  455. * @ctrl: Pointer to the controller host hardware.
  456. *
  457. * The video, command and controller engines will be disabled before the
  458. * reset is triggered. After, the engines will be re-enabled to the same
  459. * state as before the reset.
  460. *
  461. * If the reset is done while MDP timing engine is turned on, the video
  462. * engine should be re-enabled only during the vertical blanking time.
  463. */
  464. void (*soft_reset)(struct dsi_ctrl_hw *ctrl);
  465. /**
  466. * setup_lane_map() - setup mapping between logical and physical lanes
  467. * @ctrl: Pointer to the controller host hardware.
  468. * @lane_map: Structure defining the mapping between DSI logical
  469. * lanes and physical lanes.
  470. */
  471. void (*setup_lane_map)(struct dsi_ctrl_hw *ctrl,
  472. struct dsi_lane_map *lane_map);
  473. /**
  474. * kickoff_command() - transmits commands stored in memory
  475. * @ctrl: Pointer to the controller host hardware.
  476. * @cmd: Command information.
  477. * @flags: Modifiers for command transmission.
  478. *
  479. * The controller hardware is programmed with address and size of the
  480. * command buffer. The transmission is kicked off if
  481. * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is
  482. * set, caller should make a separate call to trigger_command_dma() to
  483. * transmit the command.
  484. */
  485. void (*kickoff_command)(struct dsi_ctrl_hw *ctrl,
  486. struct dsi_ctrl_cmd_dma_info *cmd,
  487. u32 flags);
  488. /**
  489. * kickoff_command_non_embedded_mode() - cmd in non embedded mode
  490. * @ctrl: Pointer to the controller host hardware.
  491. * @cmd: Command information.
  492. * @flags: Modifiers for command transmission.
  493. *
  494. * If command length is greater than DMA FIFO size of 256 bytes we use
  495. * this non- embedded mode.
  496. * The controller hardware is programmed with address and size of the
  497. * command buffer. The transmission is kicked off if
  498. * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is
  499. * set, caller should make a separate call to trigger_command_dma() to
  500. * transmit the command.
  501. */
  502. void (*kickoff_command_non_embedded_mode)(struct dsi_ctrl_hw *ctrl,
  503. struct dsi_ctrl_cmd_dma_info *cmd,
  504. u32 flags);
  505. /**
  506. * kickoff_fifo_command() - transmits a command using FIFO in dsi
  507. * hardware.
  508. * @ctrl: Pointer to the controller host hardware.
  509. * @cmd: Command information.
  510. * @flags: Modifiers for command transmission.
  511. *
  512. * The controller hardware FIFO is programmed with command header and
  513. * payload. The transmission is kicked off if
  514. * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag is not set. If this flag is
  515. * set, caller should make a separate call to trigger_command_dma() to
  516. * transmit the command.
  517. */
  518. void (*kickoff_fifo_command)(struct dsi_ctrl_hw *ctrl,
  519. struct dsi_ctrl_cmd_dma_fifo_info *cmd,
  520. u32 flags);
  521. void (*reset_cmd_fifo)(struct dsi_ctrl_hw *ctrl);
  522. /**
  523. * trigger_command_dma() - trigger transmission of command buffer.
  524. * @ctrl: Pointer to the controller host hardware.
  525. *
  526. * This trigger can be only used if there was a prior call to
  527. * kickoff_command() of kickoff_fifo_command() with
  528. * DSI_CTRL_HW_CMD_WAIT_FOR_TRIGGER flag.
  529. */
  530. void (*trigger_command_dma)(struct dsi_ctrl_hw *ctrl);
  531. /**
  532. * get_cmd_read_data() - get data read from the peripheral
  533. * @ctrl: Pointer to the controller host hardware.
  534. * @rd_buf: Buffer where data will be read into.
  535. * @read_offset: Offset from where to read.
  536. * @rx_byte: Number of bytes to be read.
  537. * @pkt_size: Size of response expected.
  538. * @hw_read_cnt: Actual number of bytes read by HW.
  539. */
  540. u32 (*get_cmd_read_data)(struct dsi_ctrl_hw *ctrl,
  541. u8 *rd_buf,
  542. u32 read_offset,
  543. u32 rx_byte,
  544. u32 pkt_size,
  545. u32 *hw_read_cnt);
  546. /**
  547. * wait_for_lane_idle() - wait for DSI lanes to go to idle state
  548. * @ctrl: Pointer to the controller host hardware.
  549. * @lanes: ORed list of lanes (enum dsi_data_lanes) which need
  550. * to be checked to be in idle state.
  551. */
  552. int (*wait_for_lane_idle)(struct dsi_ctrl_hw *ctrl, u32 lanes);
  553. struct ctrl_ulps_config_ops ulps_ops;
  554. /**
  555. * clamp_enable() - enable DSI clamps
  556. * @ctrl: Pointer to the controller host hardware.
  557. * @lanes: ORed list of lanes which need to have clamps released.
  558. * @enable_ulps: ulps state.
  559. */
  560. /**
  561. * clamp_enable() - enable DSI clamps to keep PHY driving a stable link
  562. * @ctrl: Pointer to the controller host hardware.
  563. * @lanes: ORed list of lanes which need to have clamps released.
  564. * @enable_ulps: TODO:??
  565. */
  566. void (*clamp_enable)(struct dsi_ctrl_hw *ctrl,
  567. u32 lanes,
  568. bool enable_ulps);
  569. /**
  570. * clamp_disable() - disable DSI clamps
  571. * @ctrl: Pointer to the controller host hardware.
  572. * @lanes: ORed list of lanes which need to have clamps released.
  573. * @disable_ulps: ulps state.
  574. */
  575. void (*clamp_disable)(struct dsi_ctrl_hw *ctrl,
  576. u32 lanes,
  577. bool disable_ulps);
  578. /**
  579. * phy_reset_config() - Disable/enable propagation of reset signal
  580. * from ahb domain to DSI PHY
  581. * @ctrl: Pointer to the controller host hardware.
  582. * @enable: True to mask the reset signal, false to unmask
  583. */
  584. void (*phy_reset_config)(struct dsi_ctrl_hw *ctrl,
  585. bool enable);
  586. /**
  587. * get_interrupt_status() - returns the interrupt status
  588. * @ctrl: Pointer to the controller host hardware.
  589. *
  590. * Returns the ORed list of interrupts(enum dsi_status_int_type) that
  591. * are active. This list does not include any error interrupts. Caller
  592. * should call get_error_status for error interrupts.
  593. *
  594. * Return: List of active interrupts.
  595. */
  596. u32 (*get_interrupt_status)(struct dsi_ctrl_hw *ctrl);
  597. /**
  598. * clear_interrupt_status() - clears the specified interrupts
  599. * @ctrl: Pointer to the controller host hardware.
  600. * @ints: List of interrupts to be cleared.
  601. */
  602. void (*clear_interrupt_status)(struct dsi_ctrl_hw *ctrl, u32 ints);
  603. /**
  604. * poll_dma_status()- API to poll DMA status
  605. * @ctrl: Pointer to the controller host hardware.
  606. */
  607. u32 (*poll_dma_status)(struct dsi_ctrl_hw *ctrl);
  608. /**
  609. * enable_status_interrupts() - enable the specified interrupts
  610. * @ctrl: Pointer to the controller host hardware.
  611. * @ints: List of interrupts to be enabled.
  612. *
  613. * Enables the specified interrupts. This list will override the
  614. * previous interrupts enabled through this function. Caller has to
  615. * maintain the state of the interrupts enabled. To disable all
  616. * interrupts, set ints to 0.
  617. */
  618. void (*enable_status_interrupts)(struct dsi_ctrl_hw *ctrl, u32 ints);
  619. /**
  620. * get_error_status() - returns the error status
  621. * @ctrl: Pointer to the controller host hardware.
  622. *
  623. * Returns the ORed list of errors(enum dsi_error_int_type) that are
  624. * active. This list does not include any status interrupts. Caller
  625. * should call get_interrupt_status for status interrupts.
  626. *
  627. * Return: List of active error interrupts.
  628. */
  629. u64 (*get_error_status)(struct dsi_ctrl_hw *ctrl);
  630. /**
  631. * clear_error_status() - clears the specified errors
  632. * @ctrl: Pointer to the controller host hardware.
  633. * @errors: List of errors to be cleared.
  634. */
  635. void (*clear_error_status)(struct dsi_ctrl_hw *ctrl, u64 errors);
  636. /**
  637. * enable_error_interrupts() - enable the specified interrupts
  638. * @ctrl: Pointer to the controller host hardware.
  639. * @errors: List of errors to be enabled.
  640. *
  641. * Enables the specified interrupts. This list will override the
  642. * previous interrupts enabled through this function. Caller has to
  643. * maintain the state of the interrupts enabled. To disable all
  644. * interrupts, set errors to 0.
  645. */
  646. void (*enable_error_interrupts)(struct dsi_ctrl_hw *ctrl, u64 errors);
  647. /**
  648. * video_test_pattern_setup() - setup test pattern engine for video mode
  649. * @ctrl: Pointer to the controller host hardware.
  650. * @type: Type of test pattern.
  651. * @init_val: Initial value to use for generating test pattern.
  652. */
  653. void (*video_test_pattern_setup)(struct dsi_ctrl_hw *ctrl,
  654. enum dsi_test_pattern type,
  655. u32 init_val);
  656. /**
  657. * cmd_test_pattern_setup() - setup test patttern engine for cmd mode
  658. * @ctrl: Pointer to the controller host hardware.
  659. * @type: Type of test pattern.
  660. * @init_val: Initial value to use for generating test pattern.
  661. * @stream_id: Stream Id on which packets are generated.
  662. */
  663. void (*cmd_test_pattern_setup)(struct dsi_ctrl_hw *ctrl,
  664. enum dsi_test_pattern type,
  665. u32 init_val,
  666. u32 stream_id);
  667. /**
  668. * test_pattern_enable() - enable test pattern engine
  669. * @ctrl: Pointer to the controller host hardware.
  670. * @enable: Enable/Disable test pattern engine.
  671. */
  672. void (*test_pattern_enable)(struct dsi_ctrl_hw *ctrl, bool enable);
  673. /**
  674. * clear_phy0_ln_err() - clear DSI PHY lane-0 errors
  675. * @ctrl: Pointer to the controller host hardware.
  676. */
  677. void (*clear_phy0_ln_err)(struct dsi_ctrl_hw *ctrl);
  678. /**
  679. * trigger_cmd_test_pattern() - trigger a command mode frame update with
  680. * test pattern
  681. * @ctrl: Pointer to the controller host hardware.
  682. * @stream_id: Stream on which frame update is sent.
  683. */
  684. void (*trigger_cmd_test_pattern)(struct dsi_ctrl_hw *ctrl,
  685. u32 stream_id);
  686. ssize_t (*reg_dump_to_buffer)(struct dsi_ctrl_hw *ctrl,
  687. char *buf,
  688. u32 size);
  689. /**
  690. * setup_misr() - Setup frame MISR
  691. * @ctrl: Pointer to the controller host hardware.
  692. * @panel_mode: CMD or VIDEO mode indicator
  693. * @enable: Enable/disable MISR.
  694. * @frame_count: Number of frames to accumulate MISR.
  695. */
  696. void (*setup_misr)(struct dsi_ctrl_hw *ctrl,
  697. enum dsi_op_mode panel_mode,
  698. bool enable, u32 frame_count);
  699. /**
  700. * collect_misr() - Read frame MISR
  701. * @ctrl: Pointer to the controller host hardware.
  702. * @panel_mode: CMD or VIDEO mode indicator
  703. */
  704. u32 (*collect_misr)(struct dsi_ctrl_hw *ctrl,
  705. enum dsi_op_mode panel_mode);
  706. /**
  707. * set_timing_db() - enable/disable Timing DB register
  708. * @ctrl: Pointer to controller host hardware.
  709. * @enable: Enable/Disable flag.
  710. *
  711. * Enable or Disabe the Timing DB register.
  712. */
  713. void (*set_timing_db)(struct dsi_ctrl_hw *ctrl,
  714. bool enable);
  715. /**
  716. * clear_rdbk_register() - Clear and reset read back register
  717. * @ctrl: Pointer to the controller host hardware.
  718. */
  719. void (*clear_rdbk_register)(struct dsi_ctrl_hw *ctrl);
  720. /** schedule_dma_cmd() - Schdeule DMA command transfer on a
  721. * particular blanking line.
  722. * @ctrl: Pointer to the controller host hardware.
  723. * @line_no: Blanking line number on whihch DMA command
  724. * needs to be sent.
  725. */
  726. void (*schedule_dma_cmd)(struct dsi_ctrl_hw *ctrl, int line_no);
  727. /**
  728. * ctrl_reset() - Reset DSI lanes to recover from DSI errors
  729. * @ctrl: Pointer to the controller host hardware.
  730. * @mask: Indicates the error type.
  731. */
  732. int (*ctrl_reset)(struct dsi_ctrl_hw *ctrl, int mask);
  733. /**
  734. * mask_error_int() - Mask/Unmask particular DSI error interrupts
  735. * @ctrl: Pointer to the controller host hardware.
  736. * @idx: Indicates the errors to be masked.
  737. * @en: Bool for mask or unmask of the error
  738. */
  739. void (*mask_error_intr)(struct dsi_ctrl_hw *ctrl, u32 idx, bool en);
  740. /**
  741. * error_intr_ctrl() - Mask/Unmask master DSI error interrupt
  742. * @ctrl: Pointer to the controller host hardware.
  743. * @en: Bool for mask or unmask of DSI error
  744. */
  745. void (*error_intr_ctrl)(struct dsi_ctrl_hw *ctrl, bool en);
  746. /**
  747. * get_error_mask() - get DSI error interrupt mask status
  748. * @ctrl: Pointer to the controller host hardware.
  749. */
  750. u32 (*get_error_mask)(struct dsi_ctrl_hw *ctrl);
  751. /**
  752. * get_hw_version() - get DSI controller hw version
  753. * @ctrl: Pointer to the controller host hardware.
  754. */
  755. u32 (*get_hw_version)(struct dsi_ctrl_hw *ctrl);
  756. /**
  757. * wait_for_cmd_mode_mdp_idle() - wait for command mode engine not to
  758. * be busy sending data from display engine
  759. * @ctrl: Pointer to the controller host hardware.
  760. */
  761. int (*wait_for_cmd_mode_mdp_idle)(struct dsi_ctrl_hw *ctrl);
  762. /**
  763. * hw.ops.set_continuous_clk() - Set continuous clock
  764. * @ctrl: Pointer to the controller host hardware.
  765. * @enable: Bool to control continuous clock request.
  766. */
  767. void (*set_continuous_clk)(struct dsi_ctrl_hw *ctrl, bool enable);
  768. /**
  769. * hw.ops.wait4dynamic_refresh_done() - Wait for dynamic refresh done
  770. * @ctrl: Pointer to the controller host hardware.
  771. */
  772. int (*wait4dynamic_refresh_done)(struct dsi_ctrl_hw *ctrl);
  773. /**
  774. * hw.ops.vid_engine_busy() - Returns true if vid engine is busy
  775. * @ctrl: Pointer to the controller host hardware.
  776. */
  777. bool (*vid_engine_busy)(struct dsi_ctrl_hw *ctrl);
  778. /**
  779. * hw.ops.hs_req_sel() - enable continuous clk support through phy
  780. * @ctrl: Pointer to the controller host hardware.
  781. * @sel_phy: Bool to control whether to select phy or controller
  782. */
  783. void (*hs_req_sel)(struct dsi_ctrl_hw *ctrl, bool sel_phy);
  784. /**
  785. * hw.ops.configure_cmddma_window() - configure DMA window for CMD TX
  786. * @ctrl: Pointer to the controller host hardware.
  787. * @cmd: Pointer to the DSI DMA command info.
  788. * @line_no: Line number at which the CMD needs to be triggered.
  789. * @window: Width of the DMA CMD window.
  790. */
  791. void (*configure_cmddma_window)(struct dsi_ctrl_hw *ctrl,
  792. struct dsi_ctrl_cmd_dma_info *cmd,
  793. u32 line_no, u32 window);
  794. /**
  795. * hw.ops.reset_trig_ctrl() - resets trigger control of DSI controller
  796. * @ctrl: Pointer to the controller host hardware.
  797. * @cfg: Common configuration parameters.
  798. */
  799. void (*reset_trig_ctrl)(struct dsi_ctrl_hw *ctrl,
  800. struct dsi_host_common_cfg *cfg);
  801. /**
  802. * hw.ops.log_line_count() - reads the MDP interface line count
  803. * registers.
  804. * @ctrl: Pointer to the controller host hardware.
  805. * @cmd_mode: Boolean to indicate command mode operation.
  806. */
  807. u32 (*log_line_count)(struct dsi_ctrl_hw *ctrl, bool cmd_mode);
  808. /**
  809. * hw.ops.splitlink_cmd_setup() - configure the sublink to transfer
  810. * @ctrl: Pointer to the controller host hardware.
  811. * @common_cfg: Common configuration parameters.
  812. * @sublink: Which sublink to transfer the command.
  813. */
  814. void (*splitlink_cmd_setup)(struct dsi_ctrl_hw *ctrl,
  815. struct dsi_host_common_cfg *common_cfg, u32 sublink);
  816. };
  817. /*
  818. * struct dsi_ctrl_hw - DSI controller hardware object specific to an instance
  819. * @base: VA for the DSI controller base address.
  820. * @length: Length of the DSI controller register map.
  821. * @mmss_misc_base: Base address of mmss_misc register map.
  822. * @mmss_misc_length: Length of mmss_misc register map.
  823. * @disp_cc_base: Base address of disp_cc register map.
  824. * @disp_cc_length: Length of disp_cc register map.
  825. * @mdp_intf_base: Base address of mdp_intf register map. Addresses of
  826. * MDP_TEAR_INTF_TEAR_LINE_COUNT and MDP_TEAR_INTF_LINE_COUNT
  827. * are mapped using the base address to test and validate
  828. * the RD ptr value and line count value respectively when
  829. * a CMD is triggered and it succeeds.
  830. * @index: Instance ID of the controller.
  831. * @feature_map: Features supported by the DSI controller.
  832. * @ops: Function pointers to the operations supported by the
  833. * controller.
  834. * @supported_interrupts: Number of supported interrupts.
  835. * @supported_errors: Number of supported errors.
  836. * @phy_isolation_enabled: A boolean property allows to isolate the phy from
  837. * dsi controller and run only dsi controller.
  838. * @null_insertion_enabled: A boolean property to allow dsi controller to
  839. * insert null packet.
  840. * @widebus_support: 48 bit wide data bus is supported.
  841. * @reset_trig_ctrl: Boolean to indicate if trigger control needs to
  842. * be reset to default.
  843. */
  844. struct dsi_ctrl_hw {
  845. void __iomem *base;
  846. u32 length;
  847. void __iomem *mmss_misc_base;
  848. u32 mmss_misc_length;
  849. void __iomem *disp_cc_base;
  850. u32 disp_cc_length;
  851. void __iomem *mdp_intf_base;
  852. u32 index;
  853. /* features */
  854. DECLARE_BITMAP(feature_map, DSI_CTRL_MAX_FEATURES);
  855. struct dsi_ctrl_hw_ops ops;
  856. /* capabilities */
  857. u32 supported_interrupts;
  858. u64 supported_errors;
  859. bool phy_isolation_enabled;
  860. bool null_insertion_enabled;
  861. bool widebus_support;
  862. bool reset_trig_ctrl;
  863. };
  864. #endif /* _DSI_CTRL_HW_H_ */