sde_hw_dspp.h 9.1 KB

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