sde_hw_catalog.h 45 KB

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