sde_rotator_r1_internal.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __SDE_ROTATOR_R1_INTERNAL_H__
  6. #define __SDE_ROTATOR_R1_INTERNAL_H__
  7. #include <linux/types.h>
  8. #include <linux/file.h>
  9. #include <linux/kref.h>
  10. #include <linux/kernel.h>
  11. #include "sde_rotator_util.h"
  12. /**
  13. * enum sde_commit_stage_type - Indicate different commit stages
  14. */
  15. enum sde_commit_stage_type {
  16. SDE_COMMIT_STAGE_SETUP_DONE,
  17. SDE_COMMIT_STAGE_READY_FOR_KICKOFF,
  18. };
  19. enum sde_mdp_wb_ctl_type {
  20. SDE_MDP_WB_CTL_TYPE_BLOCK = 1,
  21. SDE_MDP_WB_CTL_TYPE_LINE
  22. };
  23. enum sde_mdp_mixer_mux {
  24. SDE_MDP_MIXER_MUX_DEFAULT,
  25. SDE_MDP_MIXER_MUX_LEFT,
  26. SDE_MDP_MIXER_MUX_RIGHT,
  27. };
  28. enum sde_mdp_pipe_type {
  29. SDE_MDP_PIPE_TYPE_UNUSED,
  30. SDE_MDP_PIPE_TYPE_VIG,
  31. SDE_MDP_PIPE_TYPE_RGB,
  32. SDE_MDP_PIPE_TYPE_DMA,
  33. SDE_MDP_PIPE_TYPE_CURSOR,
  34. };
  35. struct sde_mdp_data;
  36. struct sde_mdp_ctl;
  37. struct sde_mdp_pipe;
  38. struct sde_mdp_mixer;
  39. struct sde_mdp_wb;
  40. struct sde_mdp_writeback {
  41. u32 num;
  42. char __iomem *base;
  43. u32 offset;
  44. };
  45. struct sde_mdp_ctl_intfs_ops {
  46. int (*start_fnc)(struct sde_mdp_ctl *ctl);
  47. int (*stop_fnc)(struct sde_mdp_ctl *ctl, int panel_power_state);
  48. int (*prepare_fnc)(struct sde_mdp_ctl *ctl, void *arg);
  49. int (*display_fnc)(struct sde_mdp_ctl *ctl, void *arg);
  50. int (*wait_fnc)(struct sde_mdp_ctl *ctl, void *arg);
  51. };
  52. struct sde_mdp_ctl {
  53. u32 num;
  54. char __iomem *base;
  55. u32 opmode;
  56. u32 flush_bits;
  57. u32 flush_reg_data;
  58. bool is_secure;
  59. struct sde_rot_data_type *mdata;
  60. struct sde_mdp_mixer *mixer_left;
  61. struct sde_mdp_mixer *mixer_right;
  62. void *priv_data;
  63. u32 wb_type;
  64. struct sde_mdp_writeback *wb;
  65. struct sde_mdp_ctl_intfs_ops ops;
  66. u32 offset;
  67. int irq_num;
  68. };
  69. struct sde_mdp_mixer {
  70. u32 num;
  71. char __iomem *base;
  72. u8 rotator_mode;
  73. struct sde_mdp_ctl *ctl;
  74. u32 offset;
  75. };
  76. struct sde_mdp_shared_reg_ctrl {
  77. u32 reg_off;
  78. u32 bit_off;
  79. };
  80. struct sde_mdp_pipe {
  81. u32 num;
  82. u32 type;
  83. u32 ndx;
  84. char __iomem *base;
  85. u32 xin_id;
  86. u32 flags;
  87. u32 bwc_mode;
  88. u16 img_width;
  89. u16 img_height;
  90. u8 horz_deci;
  91. u8 vert_deci;
  92. struct sde_rect src;
  93. struct sde_rect dst;
  94. struct sde_mdp_format_params *src_fmt;
  95. struct sde_mdp_plane_sizes src_planes;
  96. struct sde_mdp_mixer *mixer_left;
  97. struct sde_mdp_mixer *mixer_right;
  98. struct sde_mdp_shared_reg_ctrl clk_ctrl;
  99. u32 params_changed;
  100. u32 offset;
  101. };
  102. struct sde_mdp_writeback_arg {
  103. struct sde_mdp_data *data;
  104. void *priv_data;
  105. };
  106. struct sde_mdp_commit_cb {
  107. void *data;
  108. int (*commit_cb_fnc)(enum sde_commit_stage_type commit_state,
  109. void *data);
  110. };
  111. static inline void sde_mdp_ctl_write(struct sde_mdp_ctl *ctl,
  112. u32 reg, u32 val)
  113. {
  114. SDEROT_DBG("ctl%d:%6.6x:%8.8x\n", ctl->num, ctl->offset + reg, val);
  115. writel_relaxed(val, ctl->base + reg);
  116. }
  117. static inline bool sde_mdp_is_nrt_vbif_client(struct sde_rot_data_type *mdata,
  118. struct sde_mdp_pipe *pipe)
  119. {
  120. return mdata->vbif_nrt_io.base && pipe->mixer_left &&
  121. pipe->mixer_left->rotator_mode;
  122. }
  123. int sde_mdp_set_intr_callback(u32 intr_type, u32 intf_num,
  124. void (*fnc_ptr)(void *), void *arg);
  125. int sde_mdp_display_wait4comp(struct sde_mdp_ctl *ctl);
  126. int sde_mdp_writeback_display_commit(struct sde_mdp_ctl *ctl, void *arg);
  127. int sde_mdp_pipe_queue_data(struct sde_mdp_pipe *pipe,
  128. struct sde_mdp_data *src_data);
  129. struct sde_mdp_ctl *sde_mdp_ctl_alloc(struct sde_rot_data_type *mdata,
  130. u32 off);
  131. struct sde_mdp_writeback *sde_mdp_wb_assign(u32 num, u32 reg_index);
  132. void sde_mdp_wb_free(struct sde_mdp_writeback *wb);
  133. struct sde_mdp_mixer *sde_mdp_mixer_assign(u32 id, bool wb);
  134. int sde_mdp_writeback_start(struct sde_mdp_ctl *ctl);
  135. struct sde_mdp_pipe *sde_mdp_pipe_assign(struct sde_rot_data_type *mdata,
  136. struct sde_mdp_mixer *mixer, u32 ndx);
  137. int sde_mdp_pipe_destroy(struct sde_mdp_pipe *pipe);
  138. int sde_mdp_ctl_free(struct sde_mdp_ctl *ctl);
  139. int sde_mdp_display_commit(struct sde_mdp_ctl *ctl, void *arg,
  140. struct sde_mdp_commit_cb *commit_cb);
  141. int sde_mdp_mixer_pipe_update(struct sde_mdp_pipe *pipe,
  142. struct sde_mdp_mixer *mixer, int params_changed);
  143. int sde_mdp_get_pipe_flush_bits(struct sde_mdp_pipe *pipe);
  144. struct sde_mdp_ctl *sde_mdp_ctl_mixer_switch(struct sde_mdp_ctl *ctl,
  145. u32 return_type);
  146. struct sde_mdp_mixer *sde_mdp_mixer_get(struct sde_mdp_ctl *ctl, int mux);
  147. #endif /* __SDE_ROTATOR_R1_INTERNAL_H__ */