sde_hw_lm.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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_LM_H
  6. #define _SDE_HW_LM_H
  7. #include "sde_hw_mdss.h"
  8. #include "sde_hw_util.h"
  9. #include "sde_hw_blk.h"
  10. struct sde_hw_mixer;
  11. struct sde_hw_mixer_cfg {
  12. u32 out_width;
  13. u32 out_height;
  14. bool right_mixer;
  15. int flags;
  16. };
  17. struct sde_hw_color3_cfg {
  18. u8 keep_fg[SDE_STAGE_MAX];
  19. };
  20. /**
  21. *
  22. * struct sde_hw_lm_ops : Interface to the mixer Hw driver functions
  23. * Assumption is these functions will be called after clocks are enabled
  24. */
  25. struct sde_hw_lm_ops {
  26. /*
  27. * Sets up mixer output width and height
  28. * and border color if enabled
  29. */
  30. void (*setup_mixer_out)(struct sde_hw_mixer *ctx,
  31. struct sde_hw_mixer_cfg *cfg);
  32. /*
  33. * Alpha blending configuration
  34. * for the specified stage
  35. */
  36. void (*setup_blend_config)(struct sde_hw_mixer *ctx, uint32_t stage,
  37. uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op);
  38. /*
  39. * Alpha color component selection from either fg or bg
  40. */
  41. void (*setup_alpha_out)(struct sde_hw_mixer *ctx, uint32_t mixer_op);
  42. /**
  43. * setup_border_color : enable/disable border color
  44. */
  45. void (*setup_border_color)(struct sde_hw_mixer *ctx,
  46. struct sde_mdss_color *color,
  47. u8 border_en);
  48. /**
  49. * setup_gc : enable/disable gamma correction feature
  50. */
  51. void (*setup_gc)(struct sde_hw_mixer *mixer,
  52. void *cfg);
  53. /**
  54. * setup_dim_layer: configure dim layer settings
  55. * @ctx: Pointer to layer mixer context
  56. * @dim_layer: dim layer configs
  57. */
  58. void (*setup_dim_layer)(struct sde_hw_mixer *ctx,
  59. struct sde_hw_dim_layer *dim_layer);
  60. /**
  61. * clear_dim_layer: clear dim layer settings
  62. * @ctx: Pointer to layer mixer context
  63. */
  64. void (*clear_dim_layer)(struct sde_hw_mixer *ctx);
  65. /* setup_misr: enables/disables MISR in HW register */
  66. void (*setup_misr)(struct sde_hw_mixer *ctx,
  67. bool enable, u32 frame_count);
  68. /* collect_misr: reads and stores MISR data from HW register */
  69. int (*collect_misr)(struct sde_hw_mixer *ctx, bool nonblock,
  70. u32 *misr_value);
  71. };
  72. struct sde_hw_mixer {
  73. struct sde_hw_blk base;
  74. struct sde_hw_blk_reg_map hw;
  75. /* lm */
  76. enum sde_lm idx;
  77. const struct sde_lm_cfg *cap;
  78. const struct sde_mdp_cfg *mdp;
  79. const struct sde_ctl_cfg *ctl;
  80. /* ops */
  81. struct sde_hw_lm_ops ops;
  82. /* store mixer info specific to display */
  83. struct sde_hw_mixer_cfg cfg;
  84. };
  85. /**
  86. * to_sde_hw_mixer - convert base object sde_hw_base to container
  87. * @hw: Pointer to base hardware block
  88. * return: Pointer to hardware block container
  89. */
  90. static inline struct sde_hw_mixer *to_sde_hw_mixer(struct sde_hw_blk *hw)
  91. {
  92. return container_of(hw, struct sde_hw_mixer, base);
  93. }
  94. /**
  95. * sde_hw_lm_init(): Initializes the mixer hw driver object.
  96. * should be called once before accessing every mixer.
  97. * @idx: mixer index for which driver object is required
  98. * @addr: mapped register io address of MDP
  99. * @m : pointer to mdss catalog data
  100. */
  101. struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx,
  102. void __iomem *addr,
  103. struct sde_mdss_cfg *m);
  104. /**
  105. * sde_hw_lm_destroy(): Destroys layer mixer driver context
  106. * @lm: Pointer to LM driver context
  107. */
  108. void sde_hw_lm_destroy(struct sde_hw_mixer *lm);
  109. #endif /*_SDE_HW_LM_H */