sde_hw_catalog.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_CATALOG_H
  6. #define _SDE_HW_CATALOG_H
  7. #include <linux/kernel.h>
  8. #include <linux/bug.h>
  9. #include <linux/bitmap.h>
  10. #include <linux/err.h>
  11. #include <linux/msm-bus.h>
  12. #include <linux/of_fdt.h>
  13. #include <drm/drmP.h>
  14. /**
  15. * Max hardware block count: For ex: max 12 SSPP pipes or
  16. * 5 ctl paths. In all cases, it can have max 12 hardware blocks
  17. * based on current design
  18. */
  19. #define MAX_BLOCKS 12
  20. #define SDE_HW_VER(MAJOR, MINOR, STEP) (((MAJOR & 0xF) << 28) |\
  21. ((MINOR & 0xFFF) << 16) |\
  22. (STEP & 0xFFFF))
  23. #define SDE_HW_MAJOR(rev) ((rev) >> 28)
  24. #define SDE_HW_MINOR(rev) (((rev) >> 16) & 0xFFF)
  25. #define SDE_HW_STEP(rev) ((rev) & 0xFFFF)
  26. #define SDE_HW_MAJOR_MINOR(rev) ((rev) >> 16)
  27. #define IS_SDE_MAJOR_SAME(rev1, rev2) \
  28. (SDE_HW_MAJOR((rev1)) == SDE_HW_MAJOR((rev2)))
  29. #define IS_SDE_MAJOR_MINOR_SAME(rev1, rev2) \
  30. (SDE_HW_MAJOR_MINOR((rev1)) == SDE_HW_MAJOR_MINOR((rev2)))
  31. #define SDE_HW_VER_170 SDE_HW_VER(1, 7, 0) /* 8996 v1.0 */
  32. #define SDE_HW_VER_171 SDE_HW_VER(1, 7, 1) /* 8996 v2.0 */
  33. #define SDE_HW_VER_172 SDE_HW_VER(1, 7, 2) /* 8996 v3.0 */
  34. #define SDE_HW_VER_300 SDE_HW_VER(3, 0, 0) /* 8998 v1.0 */
  35. #define SDE_HW_VER_301 SDE_HW_VER(3, 0, 1) /* 8998 v1.1 */
  36. #define SDE_HW_VER_400 SDE_HW_VER(4, 0, 0) /* sdm845 v1.0 */
  37. #define SDE_HW_VER_401 SDE_HW_VER(4, 0, 1) /* sdm845 v2.0 */
  38. #define SDE_HW_VER_410 SDE_HW_VER(4, 1, 0) /* sdm670 v1.0 */
  39. #define SDE_HW_VER_500 SDE_HW_VER(5, 0, 0) /* sm8150 v1.0 */
  40. #define SDE_HW_VER_501 SDE_HW_VER(5, 0, 1) /* sm8150 v2.0 */
  41. #define SDE_HW_VER_510 SDE_HW_VER(5, 1, 0) /* sdmshrike v1.0 */
  42. #define SDE_HW_VER_520 SDE_HW_VER(5, 2, 0) /* sdmmagpie v1.0 */
  43. #define SDE_HW_VER_530 SDE_HW_VER(5, 3, 0) /* sm6150 v1.0 */
  44. #define SDE_HW_VER_540 SDE_HW_VER(5, 4, 0) /* sdmtrinket v1.0 */
  45. #define SDE_HW_VER_600 SDE_HW_VER(6, 0, 0) /* kona */
  46. #define SDE_HW_VER_610 SDE_HW_VER(6, 1, 0) /* sm7250 */
  47. #define IS_MSM8996_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_170)
  48. #define IS_MSM8998_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_300)
  49. #define IS_SDM845_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_400)
  50. #define IS_SDM670_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_410)
  51. #define IS_SM8150_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_500)
  52. #define IS_SDMSHRIKE_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_510)
  53. #define IS_SDMMAGPIE_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_520)
  54. #define IS_SM6150_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_530)
  55. #define IS_SDMTRINKET_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_540)
  56. #define IS_KONA_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_600)
  57. #define IS_SAIPAN_TARGET(rev) IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_VER_610)
  58. #define SDE_HW_BLK_NAME_LEN 16
  59. #define MAX_IMG_WIDTH 0x3fff
  60. #define MAX_IMG_HEIGHT 0x3fff
  61. #define CRTC_DUAL_MIXERS 2
  62. #define SDE_COLOR_PROCESS_VER(MAJOR, MINOR) \
  63. ((((MAJOR) & 0xFFFF) << 16) | (((MINOR) & 0xFFFF)))
  64. #define SDE_COLOR_PROCESS_MAJOR(version) (((version) & 0xFFFF0000) >> 16)
  65. #define SDE_COLOR_PROCESS_MINOR(version) ((version) & 0xFFFF)
  66. #define MAX_XIN_COUNT 16
  67. #define SSPP_SUBBLK_COUNT_MAX 2
  68. #define SDE_CTL_CFG_VERSION_1_0_0 0x100
  69. #define MAX_INTF_PER_CTL_V1 2
  70. #define MAX_DSC_PER_CTL_V1 2
  71. #define MAX_CWB_PER_CTL_V1 2
  72. #define MAX_MERGE_3D_PER_CTL_V1 2
  73. #define MAX_WB_PER_CTL_V1 1
  74. #define MAX_CDM_PER_CTL_V1 1
  75. #define IS_SDE_CTL_REV_100(rev) \
  76. ((rev) == SDE_CTL_CFG_VERSION_1_0_0)
  77. /**
  78. * True inline rotation supported versions
  79. */
  80. #define SDE_INLINE_ROT_VERSION_1_0_0 0x100
  81. #define IS_SDE_INLINE_ROT_REV_100(rev) \
  82. ((rev) == SDE_INLINE_ROT_VERSION_1_0_0)
  83. /*
  84. * UIDLE supported versions
  85. */
  86. #define SDE_UIDLE_VERSION_1_0_0 0x100
  87. #define IS_SDE_UIDLE_REV_100(rev) \
  88. ((rev) == SDE_UIDLE_VERSION_1_0_0)
  89. #define SDE_HW_UBWC_VER(rev) \
  90. SDE_HW_VER((((rev) >> 8) & 0xF), (((rev) >> 4) & 0xF), ((rev) & 0xF))
  91. /**
  92. * Supported UBWC feature versions
  93. */
  94. enum {
  95. SDE_HW_UBWC_VER_10 = SDE_HW_UBWC_VER(0x100),
  96. SDE_HW_UBWC_VER_20 = SDE_HW_UBWC_VER(0x200),
  97. SDE_HW_UBWC_VER_30 = SDE_HW_UBWC_VER(0x300),
  98. SDE_HW_UBWC_VER_40 = SDE_HW_UBWC_VER(0x400),
  99. };
  100. #define IS_UBWC_10_SUPPORTED(rev) \
  101. IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_UBWC_VER_10)
  102. #define IS_UBWC_20_SUPPORTED(rev) \
  103. IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_UBWC_VER_20)
  104. #define IS_UBWC_30_SUPPORTED(rev) \
  105. IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_UBWC_VER_30)
  106. #define IS_UBWC_40_SUPPORTED(rev) \
  107. IS_SDE_MAJOR_MINOR_SAME((rev), SDE_HW_UBWC_VER_40)
  108. /**
  109. * Supported SSPP system cache settings
  110. */
  111. #define SSPP_SYS_CACHE_EN_FLAG BIT(0)
  112. #define SSPP_SYS_CACHE_SCID BIT(1)
  113. #define SSPP_SYS_CACHE_OP_MODE BIT(2)
  114. #define SSPP_SYS_CACHE_OP_TYPE BIT(3)
  115. #define SSPP_SYS_CACHE_NO_ALLOC BIT(4)
  116. /**
  117. * SDE INTERRUPTS - maintains the possible hw irq's allowed by HW
  118. * The order in this enum must match the order of the irqs defined
  119. * by 'sde_irq_map'
  120. */
  121. enum sde_intr_enum {
  122. MDSS_INTR_SSPP_TOP0_INTR,
  123. MDSS_INTR_SSPP_TOP0_INTR2,
  124. MDSS_INTF_TEAR_1_INTR,
  125. MDSS_INTF_TEAR_2_INTR,
  126. MDSS_INTR_SSPP_TOP0_HIST_INTR,
  127. MDSS_INTR_INTF_0_INTR,
  128. MDSS_INTR_INTF_1_INTR,
  129. MDSS_INTR_INTF_2_INTR,
  130. MDSS_INTR_INTF_3_INTR,
  131. MDSS_INTR_INTF_4_INTR,
  132. MDSS_INTR_AD4_0_INTR,
  133. MDSS_INTR_AD4_1_INTR,
  134. MDSS_INTR_LTM_0_INTR,
  135. MDSS_INTR_LTM_1_INTR,
  136. MDSS_INTR_MAX
  137. };
  138. /**
  139. * MDP TOP BLOCK features
  140. * @SDE_MDP_PANIC_PER_PIPE Panic configuration needs to be be done per pipe
  141. * @SDE_MDP_10BIT_SUPPORT, Chipset supports 10 bit pixel formats
  142. * @SDE_MDP_BWC, MDSS HW supports Bandwidth compression.
  143. * @SDE_MDP_UBWC_1_0, This chipsets supports Universal Bandwidth
  144. * compression initial revision
  145. * @SDE_MDP_UBWC_1_5, Universal Bandwidth compression version 1.5
  146. * @SDE_MDP_VSYNC_SEL Vsync selection for command mode panels
  147. * @SDE_MDP_DHDR_MEMPOOL Dynamic HDR Metadata mempool present
  148. * @SDE_MDP_MAX Maximum value
  149. */
  150. enum {
  151. SDE_MDP_PANIC_PER_PIPE = 0x1,
  152. SDE_MDP_10BIT_SUPPORT,
  153. SDE_MDP_BWC,
  154. SDE_MDP_UBWC_1_0,
  155. SDE_MDP_UBWC_1_5,
  156. SDE_MDP_VSYNC_SEL,
  157. SDE_MDP_DHDR_MEMPOOL,
  158. SDE_MDP_MAX
  159. };
  160. /**
  161. * SSPP sub-blocks/features
  162. * @SDE_SSPP_SRC Src and fetch part of the pipes,
  163. * @SDE_SSPP_SCALER_QSEED2, QSEED2 algorithm support
  164. * @SDE_SSPP_SCALER_QSEED3, QSEED3 alogorithm support
  165. * @SDE_SSPP_SCALER_RGB, RGB Scaler, supported by RGB pipes
  166. * @SDE_SSPP_CSC, Support of Color space converion
  167. * @SDE_SSPP_CSC_10BIT, Support of 10-bit Color space conversion
  168. * @SDE_SSPP_HSIC, Global HSIC control
  169. * @SDE_SSPP_MEMCOLOR Memory Color Support
  170. * @SDE_SSPP_PCC, Color correction support
  171. * @SDE_SSPP_CURSOR, SSPP can be used as a cursor layer
  172. * @SDE_SSPP_EXCL_RECT, SSPP supports exclusion rect
  173. * @SDE_SSPP_SMART_DMA_V1, SmartDMA 1.0 support
  174. * @SDE_SSPP_SMART_DMA_V2, SmartDMA 2.0 support
  175. * @SDE_SSPP_SMART_DMA_V2p5, SmartDMA 2.5 support
  176. * @SDE_SSPP_VIG_IGC, VIG 1D LUT IGC
  177. * @SDE_SSPP_VIG_GAMUT, VIG 3D LUT Gamut
  178. * @SDE_SSPP_DMA_IGC, DMA 1D LUT IGC
  179. * @SDE_SSPP_DMA_GC, DMA 1D LUT GC
  180. * @SDE_SSPP_INVERSE_PMA Alpha unmultiply (PMA) support
  181. * @SDE_SSPP_DGM_INVERSE_PMA Alpha unmultiply (PMA) support in DGM block
  182. * @SDE_SSPP_DGM_CSC Support of color space conversion in DGM block
  183. * @SDE_SSPP_SEC_UI_ALLOWED Allows secure-ui layers
  184. * @SDE_SSPP_BLOCK_SEC_UI Blocks secure-ui layers
  185. * @SDE_SSPP_SCALER_QSEED3LITE Qseed3lite algorithm support
  186. * @SDE_SSPP_TRUE_INLINE_ROT_V1, Support of SSPP true inline rotation v1
  187. * @SDE_SSPP_MAX maximum value
  188. */
  189. enum {
  190. SDE_SSPP_SRC = 0x1,
  191. SDE_SSPP_SCALER_QSEED2,
  192. SDE_SSPP_SCALER_QSEED3,
  193. SDE_SSPP_SCALER_RGB,
  194. SDE_SSPP_CSC,
  195. SDE_SSPP_CSC_10BIT,
  196. SDE_SSPP_HSIC,
  197. SDE_SSPP_MEMCOLOR,
  198. SDE_SSPP_PCC,
  199. SDE_SSPP_CURSOR,
  200. SDE_SSPP_EXCL_RECT,
  201. SDE_SSPP_SMART_DMA_V1,
  202. SDE_SSPP_SMART_DMA_V2,
  203. SDE_SSPP_SMART_DMA_V2p5,
  204. SDE_SSPP_VIG_IGC,
  205. SDE_SSPP_VIG_GAMUT,
  206. SDE_SSPP_DMA_IGC,
  207. SDE_SSPP_DMA_GC,
  208. SDE_SSPP_INVERSE_PMA,
  209. SDE_SSPP_DGM_INVERSE_PMA,
  210. SDE_SSPP_DGM_CSC,
  211. SDE_SSPP_SEC_UI_ALLOWED,
  212. SDE_SSPP_BLOCK_SEC_UI,
  213. SDE_SSPP_SCALER_QSEED3LITE,
  214. SDE_SSPP_TRUE_INLINE_ROT_V1,
  215. SDE_SSPP_MAX
  216. };
  217. /**
  218. * SDE performance features
  219. * @SDE_PERF_SSPP_QOS, SSPP support QoS control, danger/safe/creq
  220. * @SDE_PERF_SSPP_QOS_8LVL, SSPP support 8-level QoS control
  221. * @SDE_PERF_SSPP_TS_PREFILL Supports prefill with traffic shaper
  222. * @SDE_PERF_SSPP_TS_PREFILL_REC1 Supports prefill with traffic shaper multirec
  223. * @SDE_PERF_SSPP_CDP Supports client driven prefetch
  224. * @SDE_PERF_SSPP_QOS_FL_NOCALC Avoid fill level calc for QoS/danger/safe
  225. * @SDE_PERF_SSPP_SYS_CACHE, SSPP supports system cache
  226. * @SDE_PERF_SSPP_UIDLE, sspp supports uidle
  227. * @SDE_PERF_SSPP_MAX Maximum value
  228. */
  229. enum {
  230. SDE_PERF_SSPP_QOS = 0x1,
  231. SDE_PERF_SSPP_QOS_8LVL,
  232. SDE_PERF_SSPP_TS_PREFILL,
  233. SDE_PERF_SSPP_TS_PREFILL_REC1,
  234. SDE_PERF_SSPP_CDP,
  235. SDE_PERF_SSPP_QOS_FL_NOCALC,
  236. SDE_PERF_SSPP_SYS_CACHE,
  237. SDE_PERF_SSPP_UIDLE,
  238. SDE_PERF_SSPP_MAX
  239. };
  240. /*
  241. * MIXER sub-blocks/features
  242. * @SDE_MIXER_LAYER Layer mixer layer blend configuration,
  243. * @SDE_MIXER_SOURCESPLIT Layer mixer supports source-split configuration
  244. * @SDE_MIXER_GC Gamma correction block
  245. * @SDE_DIM_LAYER Layer mixer supports dim layer
  246. * @SDE_DISP_CWB_PREF Layer mixer preferred for CWB
  247. * @SDE_DISP_PRIMARY_PREF Layer mixer preferred for primary display
  248. * @SDE_DISP_SECONDARY_PREF Layer mixer preferred for secondary display
  249. * @SDE_MIXER_MAX maximum value
  250. */
  251. enum {
  252. SDE_MIXER_LAYER = 0x1,
  253. SDE_MIXER_SOURCESPLIT,
  254. SDE_MIXER_GC,
  255. SDE_DIM_LAYER,
  256. SDE_DISP_PRIMARY_PREF,
  257. SDE_DISP_SECONDARY_PREF,
  258. SDE_DISP_CWB_PREF,
  259. SDE_MIXER_MAX
  260. };
  261. /**
  262. * DSPP sub-blocks
  263. * @SDE_DSPP_IGC DSPP Inverse gamma correction block
  264. * @SDE_DSPP_PCC Panel color correction block
  265. * @SDE_DSPP_GC Gamma correction block
  266. * @SDE_DSPP_HSIC Global HSIC block
  267. * @SDE_DSPP_MEMCOLOR Memory Color block
  268. * @SDE_DSPP_SIXZONE Six zone block
  269. * @SDE_DSPP_GAMUT Gamut bloc
  270. * @SDE_DSPP_DITHER Dither block
  271. * @SDE_DSPP_HIST Histogram block
  272. * @SDE_DSPP_VLUT PA VLUT block
  273. * @SDE_DSPP_AD AD block
  274. * @SDE_DSPP_LTM LTM block
  275. * @SDE_DSPP_MAX maximum value
  276. */
  277. enum {
  278. SDE_DSPP_IGC = 0x1,
  279. SDE_DSPP_PCC,
  280. SDE_DSPP_GC,
  281. SDE_DSPP_HSIC,
  282. SDE_DSPP_MEMCOLOR,
  283. SDE_DSPP_SIXZONE,
  284. SDE_DSPP_GAMUT,
  285. SDE_DSPP_DITHER,
  286. SDE_DSPP_HIST,
  287. SDE_DSPP_VLUT,
  288. SDE_DSPP_AD,
  289. SDE_DSPP_LTM,
  290. SDE_DSPP_MAX
  291. };
  292. /**
  293. * LTM sub-features
  294. * @SDE_LTM_INIT LTM INIT feature
  295. * @SDE_LTM_ROI LTM ROI feature
  296. * @SDE_LTM_VLUT LTM VLUT feature
  297. * @SDE_LTM_MAX maximum value
  298. */
  299. enum {
  300. SDE_LTM_INIT = 0x1,
  301. SDE_LTM_ROI,
  302. SDE_LTM_VLUT,
  303. SDE_LTM_MAX
  304. };
  305. /**
  306. * PINGPONG sub-blocks
  307. * @SDE_PINGPONG_TE Tear check block
  308. * @SDE_PINGPONG_TE2 Additional tear check block for split pipes
  309. * @SDE_PINGPONG_SPLIT PP block supports split fifo
  310. * @SDE_PINGPONG_SLAVE PP block is a suitable slave for split fifo
  311. * @SDE_PINGPONG_DSC, Display stream compression blocks
  312. * @SDE_PINGPONG_DITHER, Dither blocks
  313. * @SDE_PINGPONG_MERGE_3D, Separate MERGE_3D block exists
  314. * @SDE_PINGPONG_MAX
  315. */
  316. enum {
  317. SDE_PINGPONG_TE = 0x1,
  318. SDE_PINGPONG_TE2,
  319. SDE_PINGPONG_SPLIT,
  320. SDE_PINGPONG_SLAVE,
  321. SDE_PINGPONG_DSC,
  322. SDE_PINGPONG_DITHER,
  323. SDE_PINGPONG_MERGE_3D,
  324. SDE_PINGPONG_MAX
  325. };
  326. /** DSC sub-blocks
  327. * @SDE_DSC_OUTPUT_CTRL Supports the control of the pp id which gets
  328. * the pixel output from this DSC.
  329. * @SDE_DSC_MAX
  330. */
  331. enum {
  332. SDE_DSC_OUTPUT_CTRL = 0x1,
  333. SDE_DSC_MAX
  334. };
  335. /**
  336. * CTL sub-blocks
  337. * @SDE_CTL_SPLIT_DISPLAY CTL supports video mode split display
  338. * @SDE_CTL_PINGPONG_SPLIT CTL supports pingpong split
  339. * @SDE_CTL_PRIMARY_PREF CTL preferred for primary display
  340. * @SDE_CTL_ACTIVE_CFG CTL configuration is specified using active
  341. * blocks
  342. * @SDE_CTL_UIDLE CTL supports uidle
  343. * @SDE_CTL_MAX
  344. */
  345. enum {
  346. SDE_CTL_SPLIT_DISPLAY = 0x1,
  347. SDE_CTL_PINGPONG_SPLIT,
  348. SDE_CTL_PRIMARY_PREF,
  349. SDE_CTL_ACTIVE_CFG,
  350. SDE_CTL_UIDLE,
  351. SDE_CTL_MAX
  352. };
  353. /**
  354. * INTF sub-blocks
  355. * @SDE_INTF_INPUT_CTRL Supports the setting of pp block from which
  356. * pixel data arrives to this INTF
  357. * @SDE_INTF_TE INTF block has TE configuration support
  358. * @SDE_INTF_MAX
  359. */
  360. enum {
  361. SDE_INTF_INPUT_CTRL = 0x1,
  362. SDE_INTF_TE,
  363. SDE_INTF_MAX
  364. };
  365. /**
  366. * WB sub-blocks and features
  367. * @SDE_WB_LINE_MODE Writeback module supports line/linear mode
  368. * @SDE_WB_BLOCK_MODE Writeback module supports block mode read
  369. * @SDE_WB_ROTATE rotation support,this is available if writeback
  370. * supports block mode read
  371. * @SDE_WB_CSC Writeback color conversion block support
  372. * @SDE_WB_CHROMA_DOWN, Writeback chroma down block,
  373. * @SDE_WB_DOWNSCALE, Writeback integer downscaler,
  374. * @SDE_WB_DITHER, Dither block
  375. * @SDE_WB_TRAFFIC_SHAPER, Writeback traffic shaper bloc
  376. * @SDE_WB_UBWC, Writeback Universal bandwidth compression
  377. * @SDE_WB_YUV_CONFIG Writeback supports output of YUV colorspace
  378. * @SDE_WB_PIPE_ALPHA Writeback supports pipe alpha
  379. * @SDE_WB_XY_ROI_OFFSET Writeback supports x/y-offset of out ROI in
  380. * the destination image
  381. * @SDE_WB_QOS, Writeback supports QoS control, danger/safe/creq
  382. * @SDE_WB_QOS_8LVL, Writeback supports 8-level QoS control
  383. * @SDE_WB_CDP Writeback supports client driven prefetch
  384. * @SDE_WB_INPUT_CTRL Writeback supports from which pp block input pixel
  385. * data arrives.
  386. * @SDE_WB_HAS_CWB Writeback block supports concurrent writeback
  387. * @SDE_WB_CWB_CTRL Separate CWB control is available for configuring
  388. * @SDE_WB_MAX maximum value
  389. */
  390. enum {
  391. SDE_WB_LINE_MODE = 0x1,
  392. SDE_WB_BLOCK_MODE,
  393. SDE_WB_ROTATE = SDE_WB_BLOCK_MODE,
  394. SDE_WB_CSC,
  395. SDE_WB_CHROMA_DOWN,
  396. SDE_WB_DOWNSCALE,
  397. SDE_WB_DITHER,
  398. SDE_WB_TRAFFIC_SHAPER,
  399. SDE_WB_UBWC,
  400. SDE_WB_YUV_CONFIG,
  401. SDE_WB_PIPE_ALPHA,
  402. SDE_WB_XY_ROI_OFFSET,
  403. SDE_WB_QOS,
  404. SDE_WB_QOS_8LVL,
  405. SDE_WB_CDP,
  406. SDE_WB_INPUT_CTRL,
  407. SDE_WB_HAS_CWB,
  408. SDE_WB_CWB_CTRL,
  409. SDE_WB_MAX
  410. };
  411. /* CDM features
  412. * @SDE_CDM_INPUT_CTRL CDM supports from which pp block intput pixel data
  413. * arrives
  414. * @SDE_CDM_MAX maximum value
  415. */
  416. enum {
  417. SDE_CDM_INPUT_CTRL = 0x1,
  418. SDE_CDM_MAX
  419. };
  420. /**
  421. * VBIF sub-blocks and features
  422. * @SDE_VBIF_QOS_OTLIM VBIF supports OT Limit
  423. * @SDE_VBIF_QOS_REMAP VBIF supports QoS priority remap
  424. * @SDE_VBIF_MAX maximum value
  425. */
  426. enum {
  427. SDE_VBIF_QOS_OTLIM = 0x1,
  428. SDE_VBIF_QOS_REMAP,
  429. SDE_VBIF_MAX
  430. };
  431. /**
  432. * MACRO SDE_HW_BLK_INFO - information of HW blocks inside SDE
  433. * @name: string name for debug purposes
  434. * @id: enum identifying this block
  435. * @base: register base offset to mdss
  436. * @len: length of hardware block
  437. * @features bit mask identifying sub-blocks/features
  438. * @perf_features bit mask identifying performance sub-blocks/features
  439. */
  440. #define SDE_HW_BLK_INFO \
  441. char name[SDE_HW_BLK_NAME_LEN]; \
  442. u32 id; \
  443. u32 base; \
  444. u32 len; \
  445. unsigned long features; \
  446. unsigned long perf_features
  447. /**
  448. * MACRO SDE_HW_SUBBLK_INFO - information of HW sub-block inside SDE
  449. * @name: string name for debug purposes
  450. * @id: enum identifying this sub-block
  451. * @base: offset of this sub-block relative to the block
  452. * offset
  453. * @len register block length of this sub-block
  454. */
  455. #define SDE_HW_SUBBLK_INFO \
  456. char name[SDE_HW_BLK_NAME_LEN]; \
  457. u32 id; \
  458. u32 base; \
  459. u32 len
  460. /**
  461. * struct sde_src_blk: SSPP part of the source pipes
  462. * @info: HW register and features supported by this sub-blk
  463. */
  464. struct sde_src_blk {
  465. SDE_HW_SUBBLK_INFO;
  466. };
  467. /**
  468. * struct sde_scaler_blk: Scaler information
  469. * @info: HW register and features supported by this sub-blk
  470. * @version: qseed block revision
  471. * @h_preload: horizontal preload
  472. * @v_preload: vertical preload
  473. */
  474. struct sde_scaler_blk {
  475. SDE_HW_SUBBLK_INFO;
  476. u32 version;
  477. u32 h_preload;
  478. u32 v_preload;
  479. };
  480. struct sde_csc_blk {
  481. SDE_HW_SUBBLK_INFO;
  482. };
  483. /**
  484. * struct sde_pp_blk : Pixel processing sub-blk information
  485. * @info: HW register and features supported by this sub-blk
  486. * @version: HW Algorithm version
  487. */
  488. struct sde_pp_blk {
  489. SDE_HW_SUBBLK_INFO;
  490. u32 version;
  491. };
  492. /**
  493. * struct sde_format_extended - define sde specific pixel format+modifier
  494. * @fourcc_format: Base FOURCC pixel format code
  495. * @modifier: 64-bit drm format modifier, same modifier must be applied to all
  496. * framebuffer planes
  497. */
  498. struct sde_format_extended {
  499. uint32_t fourcc_format;
  500. uint64_t modifier;
  501. };
  502. /**
  503. * enum sde_qos_lut_usage - define QoS LUT use cases
  504. */
  505. enum sde_qos_lut_usage {
  506. SDE_QOS_LUT_USAGE_LINEAR,
  507. SDE_QOS_LUT_USAGE_MACROTILE,
  508. SDE_QOS_LUT_USAGE_NRT,
  509. SDE_QOS_LUT_USAGE_CWB,
  510. SDE_QOS_LUT_USAGE_MACROTILE_QSEED,
  511. SDE_QOS_LUT_USAGE_MAX,
  512. };
  513. /**
  514. * struct sde_qos_lut_entry - define QoS LUT table entry
  515. * @fl: fill level, or zero on last entry to indicate default lut
  516. * @lut: lut to use if equal to or less than fill level
  517. */
  518. struct sde_qos_lut_entry {
  519. u32 fl;
  520. u64 lut;
  521. };
  522. /**
  523. * struct sde_qos_lut_tbl - define QoS LUT table
  524. * @nentry: number of entry in this table
  525. * @entries: Pointer to table entries
  526. */
  527. struct sde_qos_lut_tbl {
  528. u32 nentry;
  529. struct sde_qos_lut_entry *entries;
  530. };
  531. /**
  532. * struct sde_sspp_sub_blks : SSPP sub-blocks
  533. * @maxdwnscale: max downscale ratio supported(without DECIMATION)
  534. * @maxupscale: maxupscale ratio supported
  535. * @maxwidth: max pixelwidth supported by this pipe
  536. * @creq_vblank: creq priority during vertical blanking
  537. * @danger_vblank: danger priority during vertical blanking
  538. * @pixel_ram_size: size of latency hiding and de-tiling buffer in bytes
  539. * @smart_dma_priority: hw priority of rect1 of multirect pipe
  540. * @max_per_pipe_bw: maximum allowable bandwidth of this pipe in kBps
  541. * @max_per_pipe_bw_high: maximum allowable bandwidth of this pipe in kBps
  542. * in case of no VFE
  543. * @src_blk:
  544. * @scaler_blk:
  545. * @csc_blk:
  546. * @hsic:
  547. * @memcolor:
  548. * @pcc_blk:
  549. * @gamut_blk: 3D LUT gamut block
  550. * @num_igc_blk: number of IGC block
  551. * @igc_blk: 1D LUT IGC block
  552. * @num_gc_blk: number of GC block
  553. * @gc_blk: 1D LUT GC block
  554. * @num_dgm_csc_blk: number of DGM CSC blocks
  555. * @dgm_csc_blk: DGM CSC blocks
  556. * @format_list: Pointer to list of supported formats
  557. * @virt_format_list: Pointer to list of supported formats for virtual planes
  558. * @in_rot_format_list: Pointer to list of supported formats for inline rotation
  559. * @in_rot_maxdwnscale_rt_num: max downscale ratio for inline rotation
  560. * rt clients - numerator
  561. * @in_rot_maxdwnscale_rt_denom: max downscale ratio for inline rotation
  562. * rt clients - denominator
  563. * @in_rot_maxdwnscale_nrt: max downscale ratio for inline rotation nrt clients
  564. * @in_rot_maxheight: max pre rotated height for inline rotation
  565. * @in_rot_prefill_fudge_lines: prefill fudge lines for inline rotation
  566. * @in_rot_prefill_lines_mv12: prefill lines for nv12 format inline rotation
  567. * @in_rot_prefill_lines: prefill lines for inline rotation
  568. * @llcc_scid: scid for the system cache
  569. * @llcc_slice size: slice size of the system cache
  570. */
  571. struct sde_sspp_sub_blks {
  572. u32 maxlinewidth;
  573. u32 creq_vblank;
  574. u32 danger_vblank;
  575. u32 pixel_ram_size;
  576. u32 maxdwnscale;
  577. u32 maxupscale;
  578. u32 maxhdeciexp; /* max decimation is 2^value */
  579. u32 maxvdeciexp; /* max decimation is 2^value */
  580. u32 smart_dma_priority;
  581. u32 max_per_pipe_bw;
  582. u32 max_per_pipe_bw_high;
  583. struct sde_src_blk src_blk;
  584. struct sde_scaler_blk scaler_blk;
  585. struct sde_pp_blk csc_blk;
  586. struct sde_pp_blk hsic_blk;
  587. struct sde_pp_blk memcolor_blk;
  588. struct sde_pp_blk pcc_blk;
  589. struct sde_pp_blk gamut_blk;
  590. u32 num_igc_blk;
  591. struct sde_pp_blk igc_blk[SSPP_SUBBLK_COUNT_MAX];
  592. u32 num_gc_blk;
  593. struct sde_pp_blk gc_blk[SSPP_SUBBLK_COUNT_MAX];
  594. u32 num_dgm_csc_blk;
  595. struct sde_pp_blk dgm_csc_blk[SSPP_SUBBLK_COUNT_MAX];
  596. const struct sde_format_extended *format_list;
  597. const struct sde_format_extended *virt_format_list;
  598. const struct sde_format_extended *in_rot_format_list;
  599. u32 in_rot_maxdwnscale_rt_num;
  600. u32 in_rot_maxdwnscale_rt_denom;
  601. u32 in_rot_maxdwnscale_nrt;
  602. u32 in_rot_maxheight;
  603. u32 in_rot_prefill_fudge_lines;
  604. u32 in_rot_prefill_lines_nv12;
  605. u32 in_rot_prefill_lines;
  606. int llcc_scid;
  607. size_t llcc_slice_size;
  608. };
  609. /**
  610. * struct sde_lm_sub_blks: information of mixer block
  611. * @maxwidth: Max pixel width supported by this mixer
  612. * @maxblendstages: Max number of blend-stages supported
  613. * @blendstage_base: Blend-stage register base offset
  614. * @gc: gamma correction block
  615. */
  616. struct sde_lm_sub_blks {
  617. u32 maxwidth;
  618. u32 maxblendstages;
  619. u32 blendstage_base[MAX_BLOCKS];
  620. struct sde_pp_blk gc;
  621. };
  622. struct sde_dspp_sub_blks {
  623. struct sde_pp_blk igc;
  624. struct sde_pp_blk pcc;
  625. struct sde_pp_blk gc;
  626. struct sde_pp_blk hsic;
  627. struct sde_pp_blk memcolor;
  628. struct sde_pp_blk sixzone;
  629. struct sde_pp_blk gamut;
  630. struct sde_pp_blk dither;
  631. struct sde_pp_blk hist;
  632. struct sde_pp_blk ad;
  633. struct sde_pp_blk ltm;
  634. struct sde_pp_blk vlut;
  635. };
  636. struct sde_pingpong_sub_blks {
  637. struct sde_pp_blk te;
  638. struct sde_pp_blk te2;
  639. struct sde_pp_blk dsc;
  640. struct sde_pp_blk dither;
  641. };
  642. struct sde_wb_sub_blocks {
  643. u32 maxlinewidth;
  644. };
  645. struct sde_mdss_base_cfg {
  646. SDE_HW_BLK_INFO;
  647. };
  648. /**
  649. * sde_clk_ctrl_type - Defines top level clock control signals
  650. */
  651. enum sde_clk_ctrl_type {
  652. SDE_CLK_CTRL_NONE,
  653. SDE_CLK_CTRL_VIG0,
  654. SDE_CLK_CTRL_VIG1,
  655. SDE_CLK_CTRL_VIG2,
  656. SDE_CLK_CTRL_VIG3,
  657. SDE_CLK_CTRL_VIG4,
  658. SDE_CLK_CTRL_RGB0,
  659. SDE_CLK_CTRL_RGB1,
  660. SDE_CLK_CTRL_RGB2,
  661. SDE_CLK_CTRL_RGB3,
  662. SDE_CLK_CTRL_DMA0,
  663. SDE_CLK_CTRL_DMA1,
  664. SDE_CLK_CTRL_CURSOR0,
  665. SDE_CLK_CTRL_CURSOR1,
  666. SDE_CLK_CTRL_WB0,
  667. SDE_CLK_CTRL_WB1,
  668. SDE_CLK_CTRL_WB2,
  669. SDE_CLK_CTRL_LUTDMA,
  670. SDE_CLK_CTRL_MAX,
  671. };
  672. /* struct sde_clk_ctrl_reg : Clock control register
  673. * @reg_off: register offset
  674. * @bit_off: bit offset
  675. */
  676. struct sde_clk_ctrl_reg {
  677. u32 reg_off;
  678. u32 bit_off;
  679. };
  680. /* struct sde_mdp_cfg : MDP TOP-BLK instance info
  681. * @id: index identifying this block
  682. * @base: register base offset to mdss
  683. * @features bit mask identifying sub-blocks/features
  684. * @highest_bank_bit: UBWC parameter
  685. * @ubwc_static: ubwc static configuration
  686. * @ubwc_swizzle: ubwc default swizzle setting
  687. * @has_dest_scaler: indicates support of destination scaler
  688. * @smart_panel_align_mode: split display smart panel align modes
  689. * @clk_ctrls clock control register definition
  690. */
  691. struct sde_mdp_cfg {
  692. SDE_HW_BLK_INFO;
  693. u32 highest_bank_bit;
  694. u32 ubwc_static;
  695. u32 ubwc_swizzle;
  696. bool has_dest_scaler;
  697. u32 smart_panel_align_mode;
  698. struct sde_clk_ctrl_reg clk_ctrls[SDE_CLK_CTRL_MAX];
  699. };
  700. /* struct sde_uidle_cfg : MDP TOP-BLK instance info
  701. * @id: index identifying this block
  702. * @base: register base offset to mdss
  703. * @features: bit mask identifying sub-blocks/features
  704. * @fal10_exit_cnt: fal10 exit counter
  705. * @fal10_exit_danger: fal10 exit danger level
  706. * @fal10_danger: fal10 danger level
  707. * @fal10_target_idle_time: fal10 targeted time in uS
  708. * @fal1_target_idle_time: fal1 targeted time in uS
  709. * @fal10_threshold: fal10 threshold value
  710. * @max_downscale: maximum downscaling ratio x1000.
  711. * This ratio is multiplied x1000 to allow
  712. * 3 decimal precision digits.
  713. * @max_fps: maximum fps to allow micro idle
  714. * @uidle_rev: uidle revision supported by the target,
  715. * zero if no support
  716. * @debugfs_perf: enable/disable performance counters and status
  717. * logging
  718. * @debugfs_ctrl: uidle is enabled/disabled through debugfs
  719. * @perf_cntr_en: performance counters are enabled/disabled
  720. */
  721. struct sde_uidle_cfg {
  722. SDE_HW_BLK_INFO;
  723. /* global settings */
  724. u32 fal10_exit_cnt;
  725. u32 fal10_exit_danger;
  726. u32 fal10_danger;
  727. /* per-pipe settings */
  728. u32 fal10_target_idle_time;
  729. u32 fal1_target_idle_time;
  730. u32 fal10_threshold;
  731. u32 max_dwnscale;
  732. u32 max_fps;
  733. u32 uidle_rev;
  734. u32 debugfs_perf;
  735. bool debugfs_ctrl;
  736. bool perf_cntr_en;
  737. };
  738. /* struct sde_mdp_cfg : MDP TOP-BLK instance info
  739. * @id: index identifying this block
  740. * @base: register base offset to mdss
  741. * @features bit mask identifying sub-blocks/features
  742. */
  743. struct sde_ctl_cfg {
  744. SDE_HW_BLK_INFO;
  745. };
  746. /**
  747. * struct sde_sspp_cfg - information of source pipes
  748. * @id: index identifying this block
  749. * @base register offset of this block
  750. * @features bit mask identifying sub-blocks/features
  751. * @sblk: SSPP sub-blocks information
  752. * @xin_id: bus client identifier
  753. * @clk_ctrl clock control identifier
  754. * @type sspp type identifier
  755. */
  756. struct sde_sspp_cfg {
  757. SDE_HW_BLK_INFO;
  758. struct sde_sspp_sub_blks *sblk;
  759. u32 xin_id;
  760. enum sde_clk_ctrl_type clk_ctrl;
  761. u32 type;
  762. };
  763. /**
  764. * struct sde_lm_cfg - information of layer mixer blocks
  765. * @id: index identifying this block
  766. * @base register offset of this block
  767. * @features bit mask identifying sub-blocks/features
  768. * @sblk: LM Sub-blocks information
  769. * @dspp: ID of connected DSPP, DSPP_MAX if unsupported
  770. * @pingpong: ID of connected PingPong, PINGPONG_MAX if unsupported
  771. * @ds: ID of connected DS, DS_MAX if unsupported
  772. * @lm_pair_mask: Bitmask of LMs that can be controlled by same CTL
  773. */
  774. struct sde_lm_cfg {
  775. SDE_HW_BLK_INFO;
  776. const struct sde_lm_sub_blks *sblk;
  777. u32 dspp;
  778. u32 pingpong;
  779. u32 ds;
  780. unsigned long lm_pair_mask;
  781. };
  782. /**
  783. * struct sde_dspp_cfg - information of DSPP top block
  784. * @id enum identifying this block
  785. * @base register offset of this block
  786. * @features bit mask identifying sub-blocks/features
  787. * supported by this block
  788. */
  789. struct sde_dspp_top_cfg {
  790. SDE_HW_BLK_INFO;
  791. };
  792. /**
  793. * struct sde_dspp_cfg - information of DSPP blocks
  794. * @id enum identifying this block
  795. * @base register offset of this block
  796. * @features bit mask identifying sub-blocks/features
  797. * supported by this block
  798. * @sblk sub-blocks information
  799. */
  800. struct sde_dspp_cfg {
  801. SDE_HW_BLK_INFO;
  802. const struct sde_dspp_sub_blks *sblk;
  803. };
  804. /**
  805. * struct sde_ds_top_cfg - information of dest scaler top
  806. * @id enum identifying this block
  807. * @base register offset of this block
  808. * @features bit mask identifying features
  809. * @version hw version of dest scaler
  810. * @maxinputwidth maximum input line width
  811. * @maxoutputwidth maximum output line width
  812. * @maxupscale maximum upscale ratio
  813. */
  814. struct sde_ds_top_cfg {
  815. SDE_HW_BLK_INFO;
  816. u32 version;
  817. u32 maxinputwidth;
  818. u32 maxoutputwidth;
  819. u32 maxupscale;
  820. };
  821. /**
  822. * struct sde_ds_cfg - information of dest scaler blocks
  823. * @id enum identifying this block
  824. * @base register offset wrt DS top offset
  825. * @features bit mask identifying features
  826. * @version hw version of the qseed block
  827. * @top DS top information
  828. */
  829. struct sde_ds_cfg {
  830. SDE_HW_BLK_INFO;
  831. u32 version;
  832. const struct sde_ds_top_cfg *top;
  833. };
  834. /**
  835. * struct sde_pingpong_cfg - information of PING-PONG blocks
  836. * @id enum identifying this block
  837. * @base register offset of this block
  838. * @features bit mask identifying sub-blocks/features
  839. * @sblk sub-blocks information
  840. * @merge_3d_id merge_3d block id
  841. */
  842. struct sde_pingpong_cfg {
  843. SDE_HW_BLK_INFO;
  844. const struct sde_pingpong_sub_blks *sblk;
  845. int merge_3d_id;
  846. };
  847. /**
  848. * struct sde_dsc_cfg - information of DSC blocks
  849. * @id enum identifying this block
  850. * @base register offset of this block
  851. * @len: length of hardware block
  852. * @features bit mask identifying sub-blocks/features
  853. */
  854. struct sde_dsc_cfg {
  855. SDE_HW_BLK_INFO;
  856. };
  857. /**
  858. * struct sde_cdm_cfg - information of chroma down blocks
  859. * @id enum identifying this block
  860. * @base register offset of this block
  861. * @features bit mask identifying sub-blocks/features
  862. * @intf_connect Bitmask of INTF IDs this CDM can connect to
  863. * @wb_connect: Bitmask of Writeback IDs this CDM can connect to
  864. */
  865. struct sde_cdm_cfg {
  866. SDE_HW_BLK_INFO;
  867. unsigned long intf_connect;
  868. unsigned long wb_connect;
  869. };
  870. /**
  871. * struct sde_intf_cfg - information of timing engine blocks
  872. * @id enum identifying this block
  873. * @base register offset of this block
  874. * @features bit mask identifying sub-blocks/features
  875. * @type: Interface type(DSI, DP, HDMI)
  876. * @controller_id: Controller Instance ID in case of multiple of intf type
  877. * @prog_fetch_lines_worst_case Worst case latency num lines needed to prefetch
  878. */
  879. struct sde_intf_cfg {
  880. SDE_HW_BLK_INFO;
  881. u32 type; /* interface type*/
  882. u32 controller_id;
  883. u32 prog_fetch_lines_worst_case;
  884. };
  885. /**
  886. * struct sde_wb_cfg - information of writeback blocks
  887. * @id enum identifying this block
  888. * @base register offset of this block
  889. * @features bit mask identifying sub-blocks/features
  890. * @sblk sub-block information
  891. * @format_list: Pointer to list of supported formats
  892. * @vbif_idx vbif identifier
  893. * @xin_id client interface identifier
  894. * @clk_ctrl clock control identifier
  895. */
  896. struct sde_wb_cfg {
  897. SDE_HW_BLK_INFO;
  898. const struct sde_wb_sub_blocks *sblk;
  899. const struct sde_format_extended *format_list;
  900. u32 vbif_idx;
  901. u32 xin_id;
  902. enum sde_clk_ctrl_type clk_ctrl;
  903. };
  904. /**
  905. * struct sde_merge_3d_cfg - information of merge_3d blocks
  906. * @id enum identifying this block
  907. * @base register offset of this block
  908. * @len: length of hardware block
  909. * @features bit mask identifying sub-blocks/features
  910. */
  911. struct sde_merge_3d_cfg {
  912. SDE_HW_BLK_INFO;
  913. };
  914. /**
  915. * struct sde_qdss_cfg - information of qdss blocks
  916. * @id enum identifying this block
  917. * @base register offset of this block
  918. * @len: length of hardware block
  919. * @features bit mask identifying sub-blocks/features
  920. */
  921. struct sde_qdss_cfg {
  922. SDE_HW_BLK_INFO;
  923. };
  924. /*
  925. * struct sde_vbif_dynamic_ot_cfg - dynamic OT setting
  926. * @pps pixel per seconds
  927. * @ot_limit OT limit to use up to specified pixel per second
  928. */
  929. struct sde_vbif_dynamic_ot_cfg {
  930. u64 pps;
  931. u32 ot_limit;
  932. };
  933. /**
  934. * struct sde_vbif_dynamic_ot_tbl - dynamic OT setting table
  935. * @count length of cfg
  936. * @cfg pointer to array of configuration settings with
  937. * ascending requirements
  938. */
  939. struct sde_vbif_dynamic_ot_tbl {
  940. u32 count;
  941. struct sde_vbif_dynamic_ot_cfg *cfg;
  942. };
  943. /**
  944. * struct sde_vbif_qos_tbl - QoS priority table
  945. * @npriority_lvl num of priority level
  946. * @priority_lvl pointer to array of priority level in ascending order
  947. */
  948. struct sde_vbif_qos_tbl {
  949. u32 npriority_lvl;
  950. u32 *priority_lvl;
  951. };
  952. /**
  953. * enum sde_vbif_client_type
  954. * @VBIF_RT_CLIENT: real time client
  955. * @VBIF_NRT_CLIENT: non-realtime clients like writeback
  956. * @VBIF_CWB_CLIENT: concurrent writeback client
  957. * @VBIF_LUTDMA_CLIENT: LUTDMA client
  958. * @VBIF_MAX_CLIENT: max number of clients
  959. */
  960. enum sde_vbif_client_type {
  961. VBIF_RT_CLIENT,
  962. VBIF_NRT_CLIENT,
  963. VBIF_CWB_CLIENT,
  964. VBIF_LUTDMA_CLIENT,
  965. VBIF_MAX_CLIENT
  966. };
  967. /**
  968. * struct sde_vbif_cfg - information of VBIF blocks
  969. * @id enum identifying this block
  970. * @base register offset of this block
  971. * @features bit mask identifying sub-blocks/features
  972. * @ot_rd_limit default OT read limit
  973. * @ot_wr_limit default OT write limit
  974. * @xin_halt_timeout maximum time (in usec) for xin to halt
  975. * @dynamic_ot_rd_tbl dynamic OT read configuration table
  976. * @dynamic_ot_wr_tbl dynamic OT write configuration table
  977. * @qos_tbl Array of QoS priority table
  978. * @memtype_count number of defined memtypes
  979. * @memtype array of xin memtype definitions
  980. */
  981. struct sde_vbif_cfg {
  982. SDE_HW_BLK_INFO;
  983. u32 default_ot_rd_limit;
  984. u32 default_ot_wr_limit;
  985. u32 xin_halt_timeout;
  986. struct sde_vbif_dynamic_ot_tbl dynamic_ot_rd_tbl;
  987. struct sde_vbif_dynamic_ot_tbl dynamic_ot_wr_tbl;
  988. struct sde_vbif_qos_tbl qos_tbl[VBIF_MAX_CLIENT];
  989. u32 memtype_count;
  990. u32 memtype[MAX_XIN_COUNT];
  991. };
  992. /**
  993. * struct sde_reg_dma_cfg - information of lut dma blocks
  994. * @id enum identifying this block
  995. * @base register offset of this block
  996. * @features bit mask identifying sub-blocks/features
  997. * @version version of lutdma hw block
  998. * @trigger_sel_off offset to trigger select registers of lutdma
  999. * @broadcast_disabled flag indicating if broadcast usage should be avoided
  1000. * @xin_id VBIF xin client-id for LUTDMA
  1001. * @vbif_idx VBIF id (RT/NRT)
  1002. * @clk_ctrl VBIF xin client clk-ctrl
  1003. */
  1004. struct sde_reg_dma_cfg {
  1005. SDE_HW_BLK_INFO;
  1006. u32 version;
  1007. u32 trigger_sel_off;
  1008. u32 broadcast_disabled;
  1009. u32 xin_id;
  1010. u32 vbif_idx;
  1011. enum sde_clk_ctrl_type clk_ctrl;
  1012. };
  1013. /**
  1014. * Define CDP use cases
  1015. * @SDE_PERF_CDP_UDAGE_RT: real-time use cases
  1016. * @SDE_PERF_CDP_USAGE_NRT: non real-time use cases such as WFD
  1017. */
  1018. enum {
  1019. SDE_PERF_CDP_USAGE_RT,
  1020. SDE_PERF_CDP_USAGE_NRT,
  1021. SDE_PERF_CDP_USAGE_MAX
  1022. };
  1023. /**
  1024. * struct sde_perf_cdp_cfg - define CDP use case configuration
  1025. * @rd_enable: true if read pipe CDP is enabled
  1026. * @wr_enable: true if write pipe CDP is enabled
  1027. */
  1028. struct sde_perf_cdp_cfg {
  1029. bool rd_enable;
  1030. bool wr_enable;
  1031. };
  1032. /**
  1033. * struct sde_sc_cfg - define system cache configuration
  1034. * @has_sys_cache: true if system cache is enabled
  1035. * @llcc_scid: scid for the system cache
  1036. * @llcc_slice_size: slice size of the system cache
  1037. */
  1038. struct sde_sc_cfg {
  1039. bool has_sys_cache;
  1040. int llcc_scid;
  1041. size_t llcc_slice_size;
  1042. };
  1043. /**
  1044. * struct sde_perf_cfg - performance control settings
  1045. * @max_bw_low low threshold of maximum bandwidth (kbps)
  1046. * @max_bw_high high threshold of maximum bandwidth (kbps)
  1047. * @min_core_ib minimum bandwidth for core (kbps)
  1048. * @min_core_ib minimum mnoc ib vote in kbps
  1049. * @min_llcc_ib minimum llcc ib vote in kbps
  1050. * @min_dram_ib minimum dram ib vote in kbps
  1051. * @core_ib_ff core instantaneous bandwidth fudge factor
  1052. * @core_clk_ff core clock fudge factor
  1053. * @comp_ratio_rt string of 0 or more of <fourcc>/<ven>/<mod>/<comp ratio>
  1054. * @comp_ratio_nrt string of 0 or more of <fourcc>/<ven>/<mod>/<comp ratio>
  1055. * @undersized_prefill_lines undersized prefill in lines
  1056. * @xtra_prefill_lines extra prefill latency in lines
  1057. * @dest_scale_prefill_lines destination scaler latency in lines
  1058. * @macrotile_perfill_lines macrotile latency in lines
  1059. * @yuv_nv12_prefill_lines yuv_nv12 latency in lines
  1060. * @linear_prefill_lines linear latency in lines
  1061. * @downscaling_prefill_lines downscaling latency in lines
  1062. * @amortizable_theshold minimum y position for traffic shaping prefill
  1063. * @min_prefill_lines minimum pipeline latency in lines
  1064. * @danger_lut_tbl: LUT tables for danger signals
  1065. * @sfe_lut_tbl: LUT tables for safe signals
  1066. * @qos_lut_tbl: LUT tables for QoS signals
  1067. * @cdp_cfg cdp use case configurations
  1068. * @cpu_mask: pm_qos cpu mask value
  1069. * @cpu_dma_latency: pm_qos cpu dma latency value
  1070. * @axi_bus_width: axi bus width value in bytes
  1071. * @num_mnoc_ports: number of mnoc ports
  1072. */
  1073. struct sde_perf_cfg {
  1074. u32 max_bw_low;
  1075. u32 max_bw_high;
  1076. u32 min_core_ib;
  1077. u32 min_llcc_ib;
  1078. u32 min_dram_ib;
  1079. const char *core_ib_ff;
  1080. const char *core_clk_ff;
  1081. const char *comp_ratio_rt;
  1082. const char *comp_ratio_nrt;
  1083. u32 undersized_prefill_lines;
  1084. u32 xtra_prefill_lines;
  1085. u32 dest_scale_prefill_lines;
  1086. u32 macrotile_prefill_lines;
  1087. u32 yuv_nv12_prefill_lines;
  1088. u32 linear_prefill_lines;
  1089. u32 downscaling_prefill_lines;
  1090. u32 amortizable_threshold;
  1091. u32 min_prefill_lines;
  1092. u32 danger_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
  1093. struct sde_qos_lut_tbl sfe_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
  1094. struct sde_qos_lut_tbl qos_lut_tbl[SDE_QOS_LUT_USAGE_MAX];
  1095. struct sde_perf_cdp_cfg cdp_cfg[SDE_PERF_CDP_USAGE_MAX];
  1096. u32 cpu_mask;
  1097. u32 cpu_dma_latency;
  1098. u32 axi_bus_width;
  1099. u32 num_mnoc_ports;
  1100. };
  1101. /**
  1102. * struct sde_mdss_cfg - information of MDSS HW
  1103. * This is the main catalog data structure representing
  1104. * this HW version. Contains number of instances,
  1105. * register offsets, capabilities of the all MDSS HW sub-blocks.
  1106. *
  1107. * @max_sspp_linewidth max source pipe line width support.
  1108. * @max_mixer_width max layer mixer line width support.
  1109. * @max_mixer_blendstages max layer mixer blend stages or
  1110. * supported z order
  1111. * @max_wb_linewidth max writeback line width support.
  1112. * @max_display_width maximum display width support.
  1113. * @max_display_height maximum display height support.
  1114. * @max_lm_per_display maximum layer mixer per display
  1115. * @min_display_width minimum display width support.
  1116. * @min_display_height minimum display height support.
  1117. * @qseed_type qseed2 or qseed3 support.
  1118. * @csc_type csc or csc_10bit support.
  1119. * @smart_dma_rev Supported version of SmartDMA feature.
  1120. * @ctl_rev supported version of control path.
  1121. * @has_src_split source split feature status
  1122. * @has_cdp Client driven prefetch feature status
  1123. * @has_wb_ubwc UBWC feature supported on WB
  1124. * @has_cwb_support indicates if device supports primary capture through CWB
  1125. * @ubwc_version UBWC feature version (0x0 for not supported)
  1126. * @ubwc_bw_calc_version indicate how UBWC BW has to be calculated
  1127. * @has_idle_pc indicate if idle power collapse feature is supported
  1128. * @has_hdr HDR feature support
  1129. * @has_hdr_plus HDR10+ feature support
  1130. * @dma_formats Supported formats for dma pipe
  1131. * @cursor_formats Supported formats for cursor pipe
  1132. * @vig_formats Supported formats for vig pipe
  1133. * @wb_formats Supported formats for wb
  1134. * @virt_vig_formats Supported formats for virtual vig pipe
  1135. * @vbif_qos_nlvl number of vbif QoS priority level
  1136. * @ts_prefill_rev prefill traffic shaper feature revision
  1137. * @true_inline_rot_rev inline rotator feature revision
  1138. * @true_inline_dwnscale_rt_num true inline rotator downscale ratio for rt
  1139. * - numerator
  1140. * @true_inline_dwnscale_rt_denom true inline rot downscale ratio for rt
  1141. * - denominator
  1142. * @true_inline_dwnscale_nrt true inline rotator downscale ratio for nrt
  1143. * @true_inline_prefill_fudge_lines true inline rotator prefill fudge lines
  1144. * @true_inline_prefill_lines_nv12 true inline prefill lines for nv12 format
  1145. * @true_inline_prefill_lines true inline prefill lines
  1146. * @macrotile_mode UBWC parameter for macro tile channel distribution
  1147. * @pipe_order_type indicate if it is required to specify pipe order
  1148. * @delay_prg_fetch_start indicates if throttling the fetch start is required
  1149. * @has_qsync Supports qsync feature
  1150. * @has_3d_merge_reset Supports 3D merge reset
  1151. * @has_decimation Supports decimation
  1152. * @has_qos_fl_nocalc flag to indicate QoS fill level needs no calculation
  1153. * @sc_cfg: system cache configuration
  1154. * @uidle_cfg Settings for uidle feature
  1155. * @sui_misr_supported indicate if secure-ui-misr is supported
  1156. * @sui_block_xin_mask mask of all the xin-clients to be blocked during
  1157. * secure-ui when secure-ui-misr feature is supported
  1158. * @sec_sid_mask_count number of SID masks
  1159. * @sec_sid_mask SID masks used during the scm_call for transition
  1160. * between secure/non-secure sessions
  1161. * @sui_ns_allowed flag to indicate non-secure context banks are allowed
  1162. * during secure-ui session
  1163. * @sui_supported_blendstage secure-ui supported blendstage
  1164. * @has_sui_blendstage flag to indicate secure-ui has a blendstage restriction
  1165. * @has_cursor indicates if hardware cursor is supported
  1166. * @has_vig_p010 indicates if vig pipe supports p010 format
  1167. * @inline_rot_formats formats supported by the inline rotator feature
  1168. * @mdss_irqs bitmap with the irqs supported by the target
  1169. */
  1170. struct sde_mdss_cfg {
  1171. u32 hwversion;
  1172. u32 max_sspp_linewidth;
  1173. u32 max_mixer_width;
  1174. u32 max_mixer_blendstages;
  1175. u32 max_wb_linewidth;
  1176. u32 max_display_width;
  1177. u32 max_display_height;
  1178. u32 min_display_width;
  1179. u32 min_display_height;
  1180. u32 max_lm_per_display;
  1181. u32 qseed_type;
  1182. u32 csc_type;
  1183. u32 smart_dma_rev;
  1184. u32 ctl_rev;
  1185. bool has_src_split;
  1186. bool has_cdp;
  1187. bool has_dim_layer;
  1188. bool has_wb_ubwc;
  1189. bool has_cwb_support;
  1190. u32 ubwc_version;
  1191. u32 ubwc_bw_calc_version;
  1192. bool has_idle_pc;
  1193. u32 vbif_qos_nlvl;
  1194. u32 ts_prefill_rev;
  1195. u32 true_inline_rot_rev;
  1196. u32 true_inline_dwnscale_rt_num;
  1197. u32 true_inline_dwnscale_rt_denom;
  1198. u32 true_inline_dwnscale_nrt;
  1199. u32 true_inline_prefill_fudge_lines;
  1200. u32 true_inline_prefill_lines_nv12;
  1201. u32 true_inline_prefill_lines;
  1202. u32 macrotile_mode;
  1203. u32 pipe_order_type;
  1204. bool delay_prg_fetch_start;
  1205. bool has_qsync;
  1206. bool has_3d_merge_reset;
  1207. bool has_decimation;
  1208. bool has_qos_fl_nocalc;
  1209. struct sde_sc_cfg sc_cfg;
  1210. bool sui_misr_supported;
  1211. u32 sui_block_xin_mask;
  1212. u32 sec_sid_mask_count;
  1213. u32 sec_sid_mask[MAX_BLOCKS];
  1214. u32 sui_ns_allowed;
  1215. u32 sui_supported_blendstage;
  1216. bool has_sui_blendstage;
  1217. bool has_hdr;
  1218. bool has_hdr_plus;
  1219. bool has_cursor;
  1220. bool has_vig_p010;
  1221. u32 mdss_count;
  1222. struct sde_mdss_base_cfg mdss[MAX_BLOCKS];
  1223. u32 mdp_count;
  1224. struct sde_mdp_cfg mdp[MAX_BLOCKS];
  1225. /* uidle is a singleton */
  1226. struct sde_uidle_cfg uidle_cfg;
  1227. u32 ctl_count;
  1228. struct sde_ctl_cfg ctl[MAX_BLOCKS];
  1229. u32 sspp_count;
  1230. struct sde_sspp_cfg sspp[MAX_BLOCKS];
  1231. u32 mixer_count;
  1232. struct sde_lm_cfg mixer[MAX_BLOCKS];
  1233. struct sde_dspp_top_cfg dspp_top;
  1234. u32 dspp_count;
  1235. struct sde_dspp_cfg dspp[MAX_BLOCKS];
  1236. u32 ds_count;
  1237. struct sde_ds_cfg ds[MAX_BLOCKS];
  1238. u32 pingpong_count;
  1239. struct sde_pingpong_cfg pingpong[MAX_BLOCKS];
  1240. u32 dsc_count;
  1241. struct sde_dsc_cfg dsc[MAX_BLOCKS];
  1242. u32 cdm_count;
  1243. struct sde_cdm_cfg cdm[MAX_BLOCKS];
  1244. u32 intf_count;
  1245. struct sde_intf_cfg intf[MAX_BLOCKS];
  1246. u32 wb_count;
  1247. struct sde_wb_cfg wb[MAX_BLOCKS];
  1248. u32 vbif_count;
  1249. struct sde_vbif_cfg vbif[MAX_BLOCKS];
  1250. u32 reg_dma_count;
  1251. struct sde_reg_dma_cfg dma_cfg;
  1252. u32 ad_count;
  1253. u32 ltm_count;
  1254. u32 merge_3d_count;
  1255. struct sde_merge_3d_cfg merge_3d[MAX_BLOCKS];
  1256. u32 qdss_count;
  1257. struct sde_qdss_cfg qdss[MAX_BLOCKS];
  1258. /* Add additional block data structures here */
  1259. struct sde_perf_cfg perf;
  1260. struct sde_format_extended *dma_formats;
  1261. struct sde_format_extended *cursor_formats;
  1262. struct sde_format_extended *vig_formats;
  1263. struct sde_format_extended *wb_formats;
  1264. struct sde_format_extended *virt_vig_formats;
  1265. struct sde_format_extended *inline_rot_formats;
  1266. DECLARE_BITMAP(mdss_irqs, MDSS_INTR_MAX);
  1267. };
  1268. struct sde_mdss_hw_cfg_handler {
  1269. u32 major;
  1270. u32 minor;
  1271. struct sde_mdss_cfg* (*cfg_init)(u32 data);
  1272. };
  1273. /*
  1274. * Access Macros
  1275. */
  1276. #define BLK_MDP(s) ((s)->mdp)
  1277. #define BLK_CTL(s) ((s)->ctl)
  1278. #define BLK_VIG(s) ((s)->vig)
  1279. #define BLK_RGB(s) ((s)->rgb)
  1280. #define BLK_DMA(s) ((s)->dma)
  1281. #define BLK_CURSOR(s) ((s)->cursor)
  1282. #define BLK_MIXER(s) ((s)->mixer)
  1283. #define BLK_DSPP(s) ((s)->dspp)
  1284. #define BLK_DS(s) ((s)->ds)
  1285. #define BLK_PINGPONG(s) ((s)->pingpong)
  1286. #define BLK_CDM(s) ((s)->cdm)
  1287. #define BLK_INTF(s) ((s)->intf)
  1288. #define BLK_WB(s) ((s)->wb)
  1289. #define BLK_AD(s) ((s)->ad)
  1290. #define BLK_LTM(s) ((s)->ltm)
  1291. /**
  1292. * sde_hw_set_preference: populate the individual hw lm preferences,
  1293. * overwrite if exists
  1294. * @sde_cfg: pointer to sspp cfg
  1295. * @num_lm: num lms to set preference
  1296. * @disp_type: is the given display primary/secondary
  1297. */
  1298. void sde_hw_mixer_set_preference(struct sde_mdss_cfg *sde_cfg, u32 num_lm,
  1299. uint32_t disp_type);
  1300. /**
  1301. * sde_hw_catalog_init - sde hardware catalog init API parses dtsi property
  1302. * and stores all parsed offset, hardware capabilities in config structure.
  1303. * @dev: drm device node.
  1304. * @hw_rev: caller needs provide the hardware revision before parsing.
  1305. *
  1306. * Return: parsed sde config structure
  1307. */
  1308. struct sde_mdss_cfg *sde_hw_catalog_init(struct drm_device *dev, u32 hw_rev);
  1309. /**
  1310. * sde_hw_catalog_deinit - sde hardware catalog cleanup
  1311. * @sde_cfg: pointer returned from init function
  1312. */
  1313. void sde_hw_catalog_deinit(struct sde_mdss_cfg *sde_cfg);
  1314. /**
  1315. * sde_hw_sspp_multirect_enabled - check multirect enabled for the sspp
  1316. * @cfg: pointer to sspp cfg
  1317. */
  1318. static inline bool sde_hw_sspp_multirect_enabled(const struct sde_sspp_cfg *cfg)
  1319. {
  1320. return test_bit(SDE_SSPP_SMART_DMA_V1, &cfg->features) ||
  1321. test_bit(SDE_SSPP_SMART_DMA_V2, &cfg->features) ||
  1322. test_bit(SDE_SSPP_SMART_DMA_V2p5, &cfg->features);
  1323. }
  1324. static inline bool sde_hw_intf_te_supported(const struct sde_mdss_cfg *sde_cfg)
  1325. {
  1326. return test_bit(SDE_INTF_TE, &(sde_cfg->intf[0].features));
  1327. }
  1328. #endif /* _SDE_HW_CATALOG_H */