mdp5_cfg.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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_CFG_H__
  14. #define __MDP5_CFG_H__
  15. #include "msm_drv.h"
  16. /*
  17. * mdp5_cfg
  18. *
  19. * This module configures the dynamic offsets used by mdp5.xml.h
  20. * (initialized in mdp5_cfg.c)
  21. */
  22. extern const struct mdp5_cfg_hw *mdp5_cfg;
  23. #define MAX_CTL 8
  24. #define MAX_BASES 8
  25. #define MAX_SMP_BLOCKS 44
  26. #define MAX_CLIENTS 32
  27. typedef DECLARE_BITMAP(mdp5_smp_state_t, MAX_SMP_BLOCKS);
  28. #define MDP5_SUB_BLOCK_DEFINITION \
  29. int count; \
  30. uint32_t base[MAX_BASES]
  31. struct mdp5_sub_block {
  32. MDP5_SUB_BLOCK_DEFINITION;
  33. };
  34. struct mdp5_lm_block {
  35. MDP5_SUB_BLOCK_DEFINITION;
  36. uint32_t nb_stages; /* number of stages per blender */
  37. uint32_t max_width; /* Maximum output resolution */
  38. uint32_t max_height;
  39. };
  40. struct mdp5_pipe_block {
  41. MDP5_SUB_BLOCK_DEFINITION;
  42. uint32_t caps; /* pipe capabilities */
  43. };
  44. struct mdp5_ctl_block {
  45. MDP5_SUB_BLOCK_DEFINITION;
  46. uint32_t flush_hw_mask; /* FLUSH register's hardware mask */
  47. };
  48. struct mdp5_smp_block {
  49. int mmb_count; /* number of SMP MMBs */
  50. int mmb_size; /* MMB: size in bytes */
  51. uint32_t clients[MAX_CLIENTS]; /* SMP port allocation /pipe */
  52. mdp5_smp_state_t reserved_state;/* SMP MMBs statically allocated */
  53. uint8_t reserved[MAX_CLIENTS]; /* # of MMBs allocated per client */
  54. };
  55. struct mdp5_mdp_block {
  56. MDP5_SUB_BLOCK_DEFINITION;
  57. uint32_t caps; /* MDP capabilities: MDP_CAP_xxx bits */
  58. };
  59. #define MDP5_INTF_NUM_MAX 5
  60. struct mdp5_intf_block {
  61. uint32_t base[MAX_BASES];
  62. u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
  63. };
  64. struct mdp5_cfg_hw {
  65. char *name;
  66. struct mdp5_mdp_block mdp;
  67. struct mdp5_smp_block smp;
  68. struct mdp5_ctl_block ctl;
  69. struct mdp5_pipe_block pipe_vig;
  70. struct mdp5_pipe_block pipe_rgb;
  71. struct mdp5_pipe_block pipe_dma;
  72. struct mdp5_lm_block lm;
  73. struct mdp5_sub_block dspp;
  74. struct mdp5_sub_block ad;
  75. struct mdp5_sub_block pp;
  76. struct mdp5_sub_block dsc;
  77. struct mdp5_sub_block cdm;
  78. struct mdp5_intf_block intf;
  79. uint32_t max_clk;
  80. };
  81. /* platform config data (ie. from DT, or pdata) */
  82. struct mdp5_cfg_platform {
  83. struct iommu_domain *iommu;
  84. };
  85. struct mdp5_cfg {
  86. const struct mdp5_cfg_hw *hw;
  87. struct mdp5_cfg_platform platform;
  88. };
  89. struct mdp5_kms;
  90. struct mdp5_cfg_handler;
  91. const struct mdp5_cfg_hw *mdp5_cfg_get_hw_config(struct mdp5_cfg_handler *cfg_hnd);
  92. struct mdp5_cfg *mdp5_cfg_get_config(struct mdp5_cfg_handler *cfg_hnd);
  93. int mdp5_cfg_get_hw_rev(struct mdp5_cfg_handler *cfg_hnd);
  94. #define mdp5_cfg_intf_is_virtual(intf_type) ({ \
  95. typeof(intf_type) __val = (intf_type); \
  96. (__val) >= INTF_VIRTUAL ? true : false; })
  97. struct mdp5_cfg_handler *mdp5_cfg_init(struct mdp5_kms *mdp5_kms,
  98. uint32_t major, uint32_t minor);
  99. void mdp5_cfg_destroy(struct mdp5_cfg_handler *cfg_hnd);
  100. #endif /* __MDP5_CFG_H__ */