sde_hw_lm.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. /* setup_noise_layer: enables/disables noise layer */
  72. int (*setup_noise_layer)(struct sde_hw_mixer *ctx,
  73. struct sde_hw_noise_layer_cfg *cfg);
  74. };
  75. struct sde_hw_mixer {
  76. struct sde_hw_blk base;
  77. struct sde_hw_blk_reg_map hw;
  78. /* lm */
  79. enum sde_lm idx;
  80. const struct sde_lm_cfg *cap;
  81. const struct sde_mdp_cfg *mdp;
  82. const struct sde_ctl_cfg *ctl;
  83. /* ops */
  84. struct sde_hw_lm_ops ops;
  85. /* store mixer info specific to display */
  86. struct sde_hw_mixer_cfg cfg;
  87. };
  88. /**
  89. * to_sde_hw_mixer - convert base object sde_hw_base to container
  90. * @hw: Pointer to base hardware block
  91. * return: Pointer to hardware block container
  92. */
  93. static inline struct sde_hw_mixer *to_sde_hw_mixer(struct sde_hw_blk *hw)
  94. {
  95. return container_of(hw, struct sde_hw_mixer, base);
  96. }
  97. /**
  98. * sde_hw_lm_init(): Initializes the mixer hw driver object.
  99. * should be called once before accessing every mixer.
  100. * @idx: mixer index for which driver object is required
  101. * @addr: mapped register io address of MDP
  102. * @m : pointer to mdss catalog data
  103. */
  104. struct sde_hw_mixer *sde_hw_lm_init(enum sde_lm idx,
  105. void __iomem *addr,
  106. struct sde_mdss_cfg *m);
  107. /**
  108. * sde_hw_lm_destroy(): Destroys layer mixer driver context
  109. * @lm: Pointer to LM driver context
  110. */
  111. void sde_hw_lm_destroy(struct sde_hw_mixer *lm);
  112. #endif /*_SDE_HW_LM_H */