sde_hw_lm.h 3.3 KB

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