dsi_ctrl_hw.h 38 KB

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