sde_hw_vbif.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_VBIF_H
  6. #define _SDE_HW_VBIF_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. struct sde_hw_vbif;
  11. /**
  12. * struct sde_hw_vbif_ops : Interface to the VBIF hardware driver functions
  13. * Assumption is these functions will be called after clocks are enabled
  14. */
  15. struct sde_hw_vbif_ops {
  16. /**
  17. * set_limit_conf - set transaction limit config
  18. * @vbif: vbif context driver
  19. * @xin_id: client interface identifier
  20. * @rd: true for read limit; false for write limit
  21. * @limit: outstanding transaction limit
  22. */
  23. void (*set_limit_conf)(struct sde_hw_vbif *vbif,
  24. u32 xin_id, bool rd, u32 limit);
  25. /**
  26. * get_limit_conf - get transaction limit config
  27. * @vbif: vbif context driver
  28. * @xin_id: client interface identifier
  29. * @rd: true for read limit; false for write limit
  30. * @return: outstanding transaction limit
  31. */
  32. u32 (*get_limit_conf)(struct sde_hw_vbif *vbif,
  33. u32 xin_id, bool rd);
  34. /**
  35. * set_xin_halt - set xin client halt control
  36. * @vbif: vbif context driver
  37. * @xin_id: client interface identifier
  38. * @enable: halt control enable
  39. */
  40. void (*set_xin_halt)(struct sde_hw_vbif *vbif,
  41. u32 xin_id, bool enable);
  42. /**
  43. * get_xin_halt_status - get xin client halt control
  44. * @vbif: vbif context driver
  45. * @xin_id: client interface identifier
  46. * @return: halt control enable
  47. */
  48. bool (*get_xin_halt_status)(struct sde_hw_vbif *vbif,
  49. u32 xin_id);
  50. /**
  51. * set_axi_halt - set axi port halt control
  52. * @vbif: vbif context driver
  53. */
  54. void (*set_axi_halt)(struct sde_hw_vbif *vbif);
  55. /**
  56. * get_axi_halt_status - get axi port halt control status
  57. * @vbif: vbif context driver
  58. */
  59. int (*get_axi_halt_status)(struct sde_hw_vbif *vbif);
  60. /**
  61. * set_qos_remap - set QoS priority remap
  62. * @vbif: vbif context driver
  63. * @xin_id: client interface identifier
  64. * @level: priority level
  65. * @remap_level: remapped level
  66. */
  67. void (*set_qos_remap)(struct sde_hw_vbif *vbif,
  68. u32 xin_id, u32 level, u32 remap_level);
  69. /**
  70. * set_mem_type - set memory type
  71. * @vbif: vbif context driver
  72. * @xin_id: client interface identifier
  73. * @value: memory type value
  74. */
  75. void (*set_mem_type)(struct sde_hw_vbif *vbif,
  76. u32 xin_id, u32 value);
  77. /**
  78. * clear_errors - clear any vbif errors
  79. * This function clears any detected pending/source errors
  80. * on the VBIF interface, and optionally returns the detected
  81. * error mask(s).
  82. * @vbif: vbif context driver
  83. * @pnd_errors: pointer to pending error reporting variable
  84. * @src_errors: pointer to source error reporting variable
  85. */
  86. void (*clear_errors)(struct sde_hw_vbif *vbif,
  87. u32 *pnd_errors, u32 *src_errors);
  88. /**
  89. * set_write_gather_en - set write_gather enable
  90. * @vbif: vbif context driver
  91. * @xin_id: client interface identifier
  92. */
  93. void (*set_write_gather_en)(struct sde_hw_vbif *vbif, u32 xin_id);
  94. };
  95. struct sde_hw_vbif {
  96. /* base */
  97. struct sde_hw_blk_reg_map hw;
  98. /* vbif */
  99. enum sde_vbif idx;
  100. const struct sde_vbif_cfg *cap;
  101. /* ops */
  102. struct sde_hw_vbif_ops ops;
  103. /*
  104. * vbif is common across all displays, lock to serialize access.
  105. * must be take by client before using any ops
  106. */
  107. struct mutex mutex;
  108. };
  109. /**
  110. * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx
  111. * @idx: Interface index for which driver object is required
  112. * @addr: Mapped register io address of MDSS
  113. * @m: Pointer to mdss catalog data
  114. */
  115. struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx,
  116. void __iomem *addr,
  117. const struct sde_mdss_cfg *m);
  118. void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif);
  119. #endif /*_SDE_HW_VBIF_H */