dpu_hw_lm.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_LM_H
  13. #define _DPU_HW_LM_H
  14. #include "dpu_hw_mdss.h"
  15. #include "dpu_hw_util.h"
  16. #include "dpu_hw_blk.h"
  17. struct dpu_hw_mixer;
  18. struct dpu_hw_mixer_cfg {
  19. u32 out_width;
  20. u32 out_height;
  21. bool right_mixer;
  22. int flags;
  23. };
  24. struct dpu_hw_color3_cfg {
  25. u8 keep_fg[DPU_STAGE_MAX];
  26. };
  27. /**
  28. *
  29. * struct dpu_hw_lm_ops : Interface to the mixer Hw driver functions
  30. * Assumption is these functions will be called after clocks are enabled
  31. */
  32. struct dpu_hw_lm_ops {
  33. /*
  34. * Sets up mixer output width and height
  35. * and border color if enabled
  36. */
  37. void (*setup_mixer_out)(struct dpu_hw_mixer *ctx,
  38. struct dpu_hw_mixer_cfg *cfg);
  39. /*
  40. * Alpha blending configuration
  41. * for the specified stage
  42. */
  43. void (*setup_blend_config)(struct dpu_hw_mixer *ctx, uint32_t stage,
  44. uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op);
  45. /*
  46. * Alpha color component selection from either fg or bg
  47. */
  48. void (*setup_alpha_out)(struct dpu_hw_mixer *ctx, uint32_t mixer_op);
  49. /**
  50. * setup_border_color : enable/disable border color
  51. */
  52. void (*setup_border_color)(struct dpu_hw_mixer *ctx,
  53. struct dpu_mdss_color *color,
  54. u8 border_en);
  55. /**
  56. * setup_gc : enable/disable gamma correction feature
  57. */
  58. void (*setup_gc)(struct dpu_hw_mixer *mixer,
  59. void *cfg);
  60. };
  61. struct dpu_hw_mixer {
  62. struct dpu_hw_blk base;
  63. struct dpu_hw_blk_reg_map hw;
  64. /* lm */
  65. enum dpu_lm idx;
  66. const struct dpu_lm_cfg *cap;
  67. const struct dpu_mdp_cfg *mdp;
  68. const struct dpu_ctl_cfg *ctl;
  69. /* ops */
  70. struct dpu_hw_lm_ops ops;
  71. /* store mixer info specific to display */
  72. struct dpu_hw_mixer_cfg cfg;
  73. };
  74. /**
  75. * to_dpu_hw_mixer - convert base object dpu_hw_base to container
  76. * @hw: Pointer to base hardware block
  77. * return: Pointer to hardware block container
  78. */
  79. static inline struct dpu_hw_mixer *to_dpu_hw_mixer(struct dpu_hw_blk *hw)
  80. {
  81. return container_of(hw, struct dpu_hw_mixer, base);
  82. }
  83. /**
  84. * dpu_hw_lm_init(): Initializes the mixer hw driver object.
  85. * should be called once before accessing every mixer.
  86. * @idx: mixer index for which driver object is required
  87. * @addr: mapped register io address of MDP
  88. * @m : pointer to mdss catalog data
  89. */
  90. struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
  91. void __iomem *addr,
  92. struct dpu_mdss_cfg *m);
  93. /**
  94. * dpu_hw_lm_destroy(): Destroys layer mixer driver context
  95. * @lm: Pointer to LM driver context
  96. */
  97. void dpu_hw_lm_destroy(struct dpu_hw_mixer *lm);
  98. #endif /*_DPU_HW_LM_H */