sde_hw_dspp.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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_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. /**
  184. * struct sde_hw_dspp - dspp description
  185. * @base: Hardware block base structure
  186. * @hw: Block hardware details
  187. * @hw_top: Block hardware top details
  188. * @idx: DSPP index
  189. * @cap: Pointer to layer_cfg
  190. * @ops: Pointer to operations possible for this DSPP
  191. */
  192. struct sde_hw_dspp {
  193. struct sde_hw_blk base;
  194. struct sde_hw_blk_reg_map hw;
  195. /* dspp top */
  196. struct sde_hw_blk_reg_map hw_top;
  197. /* dspp */
  198. enum sde_dspp idx;
  199. const struct sde_dspp_cfg *cap;
  200. /* Ops */
  201. struct sde_hw_dspp_ops ops;
  202. };
  203. /**
  204. * sde_hw_dspp - convert base object sde_hw_base to container
  205. * @hw: Pointer to base hardware block
  206. * return: Pointer to hardware block container
  207. */
  208. static inline struct sde_hw_dspp *to_sde_hw_dspp(struct sde_hw_blk *hw)
  209. {
  210. return container_of(hw, struct sde_hw_dspp, base);
  211. }
  212. /**
  213. * sde_hw_dspp_init - initializes the dspp hw driver object.
  214. * should be called once before accessing every dspp.
  215. * @idx: DSPP index for which driver object is required
  216. * @addr: Mapped register io address of MDP
  217. * @Return: pointer to structure or ERR_PTR
  218. */
  219. struct sde_hw_dspp *sde_hw_dspp_init(enum sde_dspp idx,
  220. void __iomem *addr,
  221. struct sde_mdss_cfg *m);
  222. /**
  223. * sde_hw_dspp_destroy(): Destroys DSPP driver context
  224. * @dspp: Pointer to DSPP driver context
  225. */
  226. void sde_hw_dspp_destroy(struct sde_hw_dspp *dspp);
  227. #endif /*_SDE_HW_DSPP_H */