dpu_hw_top.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef _DPU_HW_TOP_H
  13. #define _DPU_HW_TOP_H
  14. #include "dpu_hw_catalog.h"
  15. #include "dpu_hw_mdss.h"
  16. #include "dpu_hw_util.h"
  17. #include "dpu_hw_blk.h"
  18. struct dpu_hw_mdp;
  19. /**
  20. * struct traffic_shaper_cfg: traffic shaper configuration
  21. * @en : enable/disable traffic shaper
  22. * @rd_client : true if read client; false if write client
  23. * @client_id : client identifier
  24. * @bpc_denom : denominator of byte per clk
  25. * @bpc_numer : numerator of byte per clk
  26. */
  27. struct traffic_shaper_cfg {
  28. bool en;
  29. bool rd_client;
  30. u32 client_id;
  31. u32 bpc_denom;
  32. u64 bpc_numer;
  33. };
  34. /**
  35. * struct split_pipe_cfg - pipe configuration for dual display panels
  36. * @en : Enable/disable dual pipe confguration
  37. * @mode : Panel interface mode
  38. * @intf : Interface id for main control path
  39. * @split_flush_en: Allows both the paths to be flushed when master path is
  40. * flushed
  41. */
  42. struct split_pipe_cfg {
  43. bool en;
  44. enum dpu_intf_mode mode;
  45. enum dpu_intf intf;
  46. bool split_flush_en;
  47. };
  48. /**
  49. * struct dpu_danger_safe_status: danger and safe status signals
  50. * @mdp: top level status
  51. * @sspp: source pipe status
  52. */
  53. struct dpu_danger_safe_status {
  54. u8 mdp;
  55. u8 sspp[SSPP_MAX];
  56. };
  57. /**
  58. * struct dpu_vsync_source_cfg - configure vsync source and configure the
  59. * watchdog timers if required.
  60. * @pp_count: number of ping pongs active
  61. * @frame_rate: Display frame rate
  62. * @ppnumber: ping pong index array
  63. * @vsync_source: vsync source selection
  64. */
  65. struct dpu_vsync_source_cfg {
  66. u32 pp_count;
  67. u32 frame_rate;
  68. u32 ppnumber[PINGPONG_MAX];
  69. u32 vsync_source;
  70. };
  71. /**
  72. * struct dpu_hw_mdp_ops - interface to the MDP TOP Hw driver functions
  73. * Assumption is these functions will be called after clocks are enabled.
  74. * @setup_split_pipe : Programs the pipe control registers
  75. * @setup_pp_split : Programs the pp split control registers
  76. * @setup_traffic_shaper : programs traffic shaper control
  77. */
  78. struct dpu_hw_mdp_ops {
  79. /** setup_split_pipe() : Regsiters are not double buffered, thisk
  80. * function should be called before timing control enable
  81. * @mdp : mdp top context driver
  82. * @cfg : upper and lower part of pipe configuration
  83. */
  84. void (*setup_split_pipe)(struct dpu_hw_mdp *mdp,
  85. struct split_pipe_cfg *p);
  86. /**
  87. * setup_traffic_shaper() : Setup traffic shaper control
  88. * @mdp : mdp top context driver
  89. * @cfg : traffic shaper configuration
  90. */
  91. void (*setup_traffic_shaper)(struct dpu_hw_mdp *mdp,
  92. struct traffic_shaper_cfg *cfg);
  93. /**
  94. * setup_clk_force_ctrl - set clock force control
  95. * @mdp: mdp top context driver
  96. * @clk_ctrl: clock to be controlled
  97. * @enable: force on enable
  98. * @return: if the clock is forced-on by this function
  99. */
  100. bool (*setup_clk_force_ctrl)(struct dpu_hw_mdp *mdp,
  101. enum dpu_clk_ctrl_type clk_ctrl, bool enable);
  102. /**
  103. * get_danger_status - get danger status
  104. * @mdp: mdp top context driver
  105. * @status: Pointer to danger safe status
  106. */
  107. void (*get_danger_status)(struct dpu_hw_mdp *mdp,
  108. struct dpu_danger_safe_status *status);
  109. /**
  110. * setup_vsync_source - setup vsync source configuration details
  111. * @mdp: mdp top context driver
  112. * @cfg: vsync source selection configuration
  113. */
  114. void (*setup_vsync_source)(struct dpu_hw_mdp *mdp,
  115. struct dpu_vsync_source_cfg *cfg);
  116. /**
  117. * get_safe_status - get safe status
  118. * @mdp: mdp top context driver
  119. * @status: Pointer to danger safe status
  120. */
  121. void (*get_safe_status)(struct dpu_hw_mdp *mdp,
  122. struct dpu_danger_safe_status *status);
  123. /**
  124. * reset_ubwc - reset top level UBWC configuration
  125. * @mdp: mdp top context driver
  126. * @m: pointer to mdss catalog data
  127. */
  128. void (*reset_ubwc)(struct dpu_hw_mdp *mdp, struct dpu_mdss_cfg *m);
  129. /**
  130. * intf_audio_select - select the external interface for audio
  131. * @mdp: mdp top context driver
  132. */
  133. void (*intf_audio_select)(struct dpu_hw_mdp *mdp);
  134. };
  135. struct dpu_hw_mdp {
  136. struct dpu_hw_blk base;
  137. struct dpu_hw_blk_reg_map hw;
  138. /* top */
  139. enum dpu_mdp idx;
  140. const struct dpu_mdp_cfg *caps;
  141. /* ops */
  142. struct dpu_hw_mdp_ops ops;
  143. };
  144. /**
  145. * to_dpu_hw_mdp - convert base object dpu_hw_base to container
  146. * @hw: Pointer to base hardware block
  147. * return: Pointer to hardware block container
  148. */
  149. static inline struct dpu_hw_mdp *to_dpu_hw_mdp(struct dpu_hw_blk *hw)
  150. {
  151. return container_of(hw, struct dpu_hw_mdp, base);
  152. }
  153. /**
  154. * dpu_hw_mdptop_init - initializes the top driver for the passed idx
  155. * @idx: Interface index for which driver object is required
  156. * @addr: Mapped register io address of MDP
  157. * @m: Pointer to mdss catalog data
  158. */
  159. struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
  160. void __iomem *addr,
  161. const struct dpu_mdss_cfg *m);
  162. void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp);
  163. #endif /*_DPU_HW_TOP_H */