mdp5_ctl.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2014 The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __MDP5_CTL_H__
  14. #define __MDP5_CTL_H__
  15. #include "msm_drv.h"
  16. /*
  17. * CTL Manager prototypes:
  18. * mdp5_ctlm_init() returns a ctlm (CTL Manager) handler,
  19. * which is then used to call the other mdp5_ctlm_*(ctlm, ...) functions.
  20. */
  21. struct mdp5_ctl_manager;
  22. struct mdp5_ctl_manager *mdp5_ctlm_init(struct drm_device *dev,
  23. void __iomem *mmio_base, const struct mdp5_cfg_hw *hw_cfg);
  24. void mdp5_ctlm_hw_reset(struct mdp5_ctl_manager *ctlm);
  25. void mdp5_ctlm_destroy(struct mdp5_ctl_manager *ctlm);
  26. /*
  27. * CTL prototypes:
  28. * mdp5_ctl_request(ctlm, ...) returns a ctl (CTL resource) handler,
  29. * which is then used to call the other mdp5_ctl_*(ctl, ...) functions.
  30. */
  31. struct mdp5_ctl *mdp5_ctlm_request(struct mdp5_ctl_manager *ctlm, struct drm_crtc *crtc);
  32. int mdp5_ctl_get_ctl_id(struct mdp5_ctl *ctl);
  33. struct mdp5_interface;
  34. int mdp5_ctl_set_intf(struct mdp5_ctl *ctl, struct mdp5_interface *intf);
  35. int mdp5_ctl_set_encoder_state(struct mdp5_ctl *ctl, bool enabled);
  36. int mdp5_ctl_set_cursor(struct mdp5_ctl *ctl, int cursor_id, bool enable);
  37. /*
  38. * blend_cfg (LM blender config):
  39. *
  40. * The function below allows the caller of mdp5_ctl_blend() to specify how pipes
  41. * are being blended according to their stage (z-order), through @blend_cfg arg.
  42. */
  43. static inline u32 mdp_ctl_blend_mask(enum mdp5_pipe pipe,
  44. enum mdp_mixer_stage_id stage)
  45. {
  46. switch (pipe) {
  47. case SSPP_VIG0: return MDP5_CTL_LAYER_REG_VIG0(stage);
  48. case SSPP_VIG1: return MDP5_CTL_LAYER_REG_VIG1(stage);
  49. case SSPP_VIG2: return MDP5_CTL_LAYER_REG_VIG2(stage);
  50. case SSPP_RGB0: return MDP5_CTL_LAYER_REG_RGB0(stage);
  51. case SSPP_RGB1: return MDP5_CTL_LAYER_REG_RGB1(stage);
  52. case SSPP_RGB2: return MDP5_CTL_LAYER_REG_RGB2(stage);
  53. case SSPP_DMA0: return MDP5_CTL_LAYER_REG_DMA0(stage);
  54. case SSPP_DMA1: return MDP5_CTL_LAYER_REG_DMA1(stage);
  55. case SSPP_VIG3: return MDP5_CTL_LAYER_REG_VIG3(stage);
  56. case SSPP_RGB3: return MDP5_CTL_LAYER_REG_RGB3(stage);
  57. default: return 0;
  58. }
  59. }
  60. /*
  61. * mdp5_ctl_blend() - Blend multiple layers on a Layer Mixer (LM)
  62. *
  63. * @blend_cfg: see LM blender config definition below
  64. *
  65. * Note:
  66. * CTL registers need to be flushed after calling this function
  67. * (call mdp5_ctl_commit() with mdp_ctl_flush_mask_ctl() mask)
  68. */
  69. int mdp5_ctl_blend(struct mdp5_ctl *ctl, u32 lm, u32 blend_cfg);
  70. /**
  71. * mdp_ctl_flush_mask...() - Register FLUSH masks
  72. *
  73. * These masks are used to specify which block(s) need to be flushed
  74. * through @flush_mask parameter in mdp5_ctl_commit(.., flush_mask).
  75. */
  76. u32 mdp_ctl_flush_mask_lm(int lm);
  77. u32 mdp_ctl_flush_mask_pipe(enum mdp5_pipe pipe);
  78. u32 mdp_ctl_flush_mask_cursor(int cursor_id);
  79. u32 mdp_ctl_flush_mask_encoder(struct mdp5_interface *intf);
  80. /* @flush_mask: see CTL flush masks definitions below */
  81. int mdp5_ctl_commit(struct mdp5_ctl *ctl, u32 flush_mask);
  82. void mdp5_ctl_release(struct mdp5_ctl *ctl);
  83. #endif /* __MDP5_CTL_H__ */