sde_hw_dspp.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_DSPP_H
  6. #define _SDE_HW_DSPP_H
  7. struct sde_hw_dspp;
  8. /**
  9. * struct sde_hw_dspp_ops - interface to the dspp hardware driver functions
  10. * Caller must call the init function to get the dspp context for each dspp
  11. * Assumption is these functions will be called after clocks are enabled
  12. */
  13. struct sde_hw_dspp_ops {
  14. /**
  15. * setup_histogram - setup dspp histogram
  16. * @ctx: Pointer to dspp context
  17. * @cfg: Pointer to configuration
  18. */
  19. void (*setup_histogram)(struct sde_hw_dspp *ctx, void *cfg);
  20. /**
  21. * read_histogram - read dspp histogram
  22. * @ctx: Pointer to dspp context
  23. * @cfg: Pointer to configuration
  24. */
  25. void (*read_histogram)(struct sde_hw_dspp *ctx, void *cfg);
  26. /**
  27. * lock_histogram - lock dspp histogram buffer
  28. * @ctx: Pointer to dspp context
  29. * @cfg: Pointer to configuration
  30. */
  31. void (*lock_histogram)(struct sde_hw_dspp *ctx, void *cfg);
  32. /**
  33. * setup_igc - update dspp igc
  34. * @ctx: Pointer to dspp context
  35. * @cfg: Pointer to configuration
  36. */
  37. void (*setup_igc)(struct sde_hw_dspp *ctx, void *cfg);
  38. /**
  39. * setup_pa_hsic - setup dspp pa hsic
  40. * @ctx: Pointer to dspp context
  41. * @cfg: Pointer to configuration
  42. */
  43. void (*setup_pa_hsic)(struct sde_hw_dspp *dspp, void *cfg);
  44. /**
  45. * setup_pcc - setup dspp pcc
  46. * @ctx: Pointer to dspp context
  47. * @cfg: Pointer to configuration
  48. */
  49. void (*setup_pcc)(struct sde_hw_dspp *ctx, void *cfg);
  50. /**
  51. * setup_sharpening - setup dspp sharpening
  52. * @ctx: Pointer to dspp context
  53. * @cfg: Pointer to configuration
  54. */
  55. void (*setup_sharpening)(struct sde_hw_dspp *ctx, void *cfg);
  56. /**
  57. * setup_pa_memcol_skin - setup dspp memcolor skin
  58. * @ctx: Pointer to dspp context
  59. * @cfg: Pointer to configuration
  60. */
  61. void (*setup_pa_memcol_skin)(struct sde_hw_dspp *ctx, void *cfg);
  62. /**
  63. * setup_pa_memcol_sky - setup dspp memcolor sky
  64. * @ctx: Pointer to dspp context
  65. * @cfg: Pointer to configuration
  66. */
  67. void (*setup_pa_memcol_sky)(struct sde_hw_dspp *ctx, void *cfg);
  68. /**
  69. * setup_pa_memcol_foliage - setup dspp memcolor foliage
  70. * @ctx: Pointer to dspp context
  71. * @cfg: Pointer to configuration
  72. */
  73. void (*setup_pa_memcol_foliage)(struct sde_hw_dspp *ctx, void *cfg);
  74. /**
  75. * setup_pa_memcol_prot - setup dspp memcolor protection
  76. * @ctx: Pointer to dspp context
  77. * @cfg: Pointer to configuration
  78. */
  79. void (*setup_pa_memcol_prot)(struct sde_hw_dspp *ctx, void *cfg);
  80. /**
  81. * setup_sixzone - setup dspp six zone
  82. * @ctx: Pointer to dspp context
  83. * @cfg: Pointer to configuration
  84. */
  85. void (*setup_sixzone)(struct sde_hw_dspp *dspp, void *cfg);
  86. /**
  87. * setup_danger_safe - setup danger safe LUTS
  88. * @ctx: Pointer to dspp context
  89. * @cfg: Pointer to configuration
  90. */
  91. void (*setup_danger_safe)(struct sde_hw_dspp *ctx, void *cfg);
  92. /**
  93. * setup_pa_dither - setup dspp PA dither
  94. * @ctx: Pointer to dspp context
  95. * @cfg: Pointer to configuration
  96. */
  97. void (*setup_pa_dither)(struct sde_hw_dspp *ctx, void *cfg);
  98. /**
  99. * setup_vlut - setup dspp PA VLUT
  100. * @ctx: Pointer to dspp context
  101. * @cfg: Pointer to configuration
  102. */
  103. void (*setup_vlut)(struct sde_hw_dspp *ctx, void *cfg);
  104. /**
  105. * setup_gc - update dspp gc
  106. * @ctx: Pointer to dspp context
  107. * @cfg: Pointer to configuration
  108. */
  109. void (*setup_gc)(struct sde_hw_dspp *ctx, void *cfg);
  110. /**
  111. * setup_gamut - update dspp gamut
  112. * @ctx: Pointer to dspp context
  113. * @cfg: Pointer to configuration
  114. */
  115. void (*setup_gamut)(struct sde_hw_dspp *ctx, void *cfg);
  116. /**
  117. * validate_ad - check if ad property can be set
  118. * @ctx: Pointer to dspp context
  119. * @prop: Pointer to ad property being validated
  120. */
  121. int (*validate_ad)(struct sde_hw_dspp *ctx, u32 *prop);
  122. /**
  123. * setup_ad - update the ad property
  124. * @ctx: Pointer to dspp context
  125. * @cfg: Pointer to ad configuration
  126. */
  127. void (*setup_ad)(struct sde_hw_dspp *ctx, void *cfg);
  128. /**
  129. * ad_read_intr_resp - function to get interrupt response for ad
  130. * @event: Event for which response needs to be read
  131. * @resp_in: Pointer to u32 where resp ad4 input value is dumped.
  132. * @resp_out: Pointer to u32 where resp ad4 output value is dumped.
  133. */
  134. void (*ad_read_intr_resp)(struct sde_hw_dspp *ctx, u32 event,
  135. u32 *resp_in, u32 *resp_out);
  136. /**
  137. * setup_ltm_init - setup LTM INIT
  138. * @ctx: Pointer to dspp context
  139. * @cfg: Pointer to configuration
  140. */
  141. void (*setup_ltm_init)(struct sde_hw_dspp *ctx, void *cfg);
  142. /**
  143. * setup_ltm_roi - setup LTM ROI
  144. * @ctx: Pointer to dspp context
  145. * @cfg: Pointer to configuration
  146. */
  147. void (*setup_ltm_roi)(struct sde_hw_dspp *ctx, void *cfg);
  148. /**
  149. * setup_ltm_vlut - setup LTM VLUT
  150. * @ctx: Pointer to dspp context
  151. * @cfg: Pointer to configuration
  152. */
  153. void (*setup_ltm_vlut)(struct sde_hw_dspp *ctx, void *cfg);
  154. /**
  155. * setup_ltm_hist_ctrl - setup LTM histogram control
  156. * @ctx: Pointer to dspp context
  157. * @cfg: Pointer to configuration
  158. * @enable: feature enable/disable value
  159. * @iova: aligned hist buffer address
  160. */
  161. void (*setup_ltm_hist_ctrl)(struct sde_hw_dspp *ctx, void *cfg,
  162. bool enable, u64 iova);
  163. /**
  164. * setup_ltm_hist_buffer - setup LTM histogram buffer
  165. * @ctx: Pointer to dspp context
  166. * @iova: aligned hist buffer address
  167. */
  168. void (*setup_ltm_hist_buffer)(struct sde_hw_dspp *ctx, u64 iova);
  169. /**
  170. * setup_ltm_thresh - setup LTM histogram thresh
  171. * @ctx: Pointer to dspp context
  172. * @cfg: Pointer to configuration
  173. */
  174. void (*setup_ltm_thresh)(struct sde_hw_dspp *ctx, void *cfg);
  175. /**
  176. * ltm_read_intr_status - function to read ltm interrupt status
  177. * @ctx: Pointer to dspp context
  178. * @status: Pointer to u32 where ltm status value is dumped.
  179. */
  180. void (*ltm_read_intr_status)(struct sde_hw_dspp *ctx, u32 *status);
  181. /**
  182. * clear_ltm_merge_mode - clear LTM merge_mode bit
  183. * @ctx: Pointer to dspp context
  184. */
  185. void (*clear_ltm_merge_mode)(struct sde_hw_dspp *ctx);
  186. /**
  187. * validate_rc_mask - Validate RC mask configuration
  188. * @ctx: Pointer to dspp context.
  189. * @cfg: Pointer to configuration.
  190. * Return: 0 on success, non-zero otherwise.
  191. */
  192. int (*validate_rc_mask)(struct sde_hw_dspp *ctx, void *cfg);
  193. /**
  194. * setup_rc_mask - Setup RC mask configuration
  195. * @ctx: Pointer to dspp context.
  196. * @cfg: Pointer to configuration.
  197. * Return: 0 on success, non-zero otherwise.
  198. */
  199. int (*setup_rc_mask)(struct sde_hw_dspp *ctx, void *cfg);
  200. /**
  201. * validate_rc_pu_roi - Validate RC regions in during partial update.
  202. * @ctx: Pointer to dspp context.
  203. * @cfg: Pointer to configuration.
  204. * Return: 0 on success, non-zero otherwise.
  205. */
  206. int (*validate_rc_pu_roi)(struct sde_hw_dspp *ctx, void *cfg);
  207. /**
  208. * setup_rc_pu_roi - Setup RC regions in during partial update.
  209. * @ctx: Pointer to dspp context.
  210. * @cfg: Pointer to configuration.
  211. * Return: 0 on success, non-zero otherwise.
  212. */
  213. int (*setup_rc_pu_roi)(struct sde_hw_dspp *ctx, void *cfg);
  214. /**
  215. * setup_rc_data - Program RC mask data
  216. * @ctx: Pointer to dspp context.
  217. * @cfg: Pointer to configuration.
  218. * Return: 0 on success, non-zero otherwise.
  219. */
  220. int (*setup_rc_data)(struct sde_hw_dspp *ctx, void *cfg);
  221. /**
  222. * setup_spr_init_config - function to configure spr hw block
  223. * @ctx: Pointer to dspp context
  224. * @cfg: Pointer to configuration
  225. */
  226. void (*setup_spr_init_config)(struct sde_hw_dspp *ctx, void *cfg);
  227. /**
  228. * setup_spr_pu_config - function to configure spr hw block pu offsets
  229. * @ctx: Pointer to dspp context
  230. * @cfg: Pointer to configuration
  231. */
  232. void (*setup_spr_pu_config)(struct sde_hw_dspp *ctx, void *cfg);
  233. /**
  234. * setup_demura_cfg - function to program demura cfg
  235. * @ctx: Pointer to dspp context
  236. * @status: Pointer to configuration.
  237. */
  238. void (*setup_demura_cfg)(struct sde_hw_dspp *ctx, void *cfg);
  239. /**
  240. * setup_demura_backlight_cfg - function to program demura backlight
  241. * @ctx: Pointer to dspp context
  242. * @status: Pointer to configuration.
  243. */
  244. void (*setup_demura_backlight_cfg)(struct sde_hw_dspp *ctx, u64 val);
  245. /**
  246. * demura_read_plane_status - Query demura plane status
  247. * @ctx: Pointer to dspp context
  248. * @status: Demura plane used by DSPP. demura_fetch_planes enum value.
  249. */
  250. void (*demura_read_plane_status)(struct sde_hw_dspp *ctx, u32 *status);
  251. /**
  252. * setup_demura_pu_config - function to configure demura hw block pu offsets
  253. * @ctx: Pointer to dspp context
  254. * @cfg: Pointer to configuration
  255. */
  256. void (*setup_demura_pu_config)(struct sde_hw_dspp *ctx, void *cfg);
  257. };
  258. /**
  259. * struct sde_hw_dspp - dspp description
  260. * @base: Hardware block base structure
  261. * @hw: Block hardware details
  262. * @hw_top: Block hardware top details
  263. * @idx: DSPP index
  264. * @cap: Pointer to layer_cfg
  265. * @sb_dma_in_use: hint indicating if sb dma is being used for this dspp
  266. * @ops: Pointer to operations possible for this DSPP
  267. * @ltm_checksum_support: flag to check if checksum present
  268. */
  269. struct sde_hw_dspp {
  270. struct sde_hw_blk_reg_map hw;
  271. /* dspp top */
  272. struct sde_hw_blk_reg_map hw_top;
  273. /* dspp */
  274. enum sde_dspp idx;
  275. const struct sde_dspp_cfg *cap;
  276. bool sb_dma_in_use;
  277. bool ltm_checksum_support;
  278. /* Ops */
  279. struct sde_hw_dspp_ops ops;
  280. };
  281. /**
  282. * to_sde_hw_dspp - convert base hw object to sde_hw_dspp container
  283. * @hw: Pointer to hardware block register map object
  284. * return: Pointer to hardware block container
  285. */
  286. static inline struct sde_hw_dspp *to_sde_hw_dspp(struct sde_hw_blk_reg_map *hw)
  287. {
  288. return container_of(hw, struct sde_hw_dspp, hw);
  289. }
  290. /**
  291. * sde_hw_dspp_init - initializes the dspp hw driver object.
  292. * should be called once before accessing every dspp.
  293. * @idx: DSPP index for which driver object is required
  294. * @addr: Mapped register io address of MDP
  295. * @Return: pointer to structure or ERR_PTR
  296. */
  297. struct sde_hw_blk_reg_map *sde_hw_dspp_init(enum sde_dspp idx,
  298. void __iomem *addr,
  299. struct sde_mdss_cfg *m);
  300. /**
  301. * sde_hw_dspp_destroy(): Destroys DSPP driver context
  302. * @hw: Pointer to hardware block register map object
  303. */
  304. void sde_hw_dspp_destroy(struct sde_hw_blk_reg_map *hw);
  305. #endif /*_SDE_HW_DSPP_H */