sde_hw_vbif.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, 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_halt_ctrl - set halt control
  36. * @vbif: vbif context driver
  37. * @xin_id: client interface identifier
  38. * @enable: halt control enable
  39. */
  40. void (*set_halt_ctrl)(struct sde_hw_vbif *vbif,
  41. u32 xin_id, bool enable);
  42. /**
  43. * get_halt_ctrl - get halt control
  44. * @vbif: vbif context driver
  45. * @xin_id: client interface identifier
  46. * @return: halt control enable
  47. */
  48. bool (*get_halt_ctrl)(struct sde_hw_vbif *vbif,
  49. u32 xin_id);
  50. /**
  51. * set_qos_remap - set QoS priority remap
  52. * @vbif: vbif context driver
  53. * @xin_id: client interface identifier
  54. * @level: priority level
  55. * @remap_level: remapped level
  56. */
  57. void (*set_qos_remap)(struct sde_hw_vbif *vbif,
  58. u32 xin_id, u32 level, u32 remap_level);
  59. /**
  60. * set_mem_type - set memory type
  61. * @vbif: vbif context driver
  62. * @xin_id: client interface identifier
  63. * @value: memory type value
  64. */
  65. void (*set_mem_type)(struct sde_hw_vbif *vbif,
  66. u32 xin_id, u32 value);
  67. /**
  68. * clear_errors - clear any vbif errors
  69. * This function clears any detected pending/source errors
  70. * on the VBIF interface, and optionally returns the detected
  71. * error mask(s).
  72. * @vbif: vbif context driver
  73. * @pnd_errors: pointer to pending error reporting variable
  74. * @src_errors: pointer to source error reporting variable
  75. */
  76. void (*clear_errors)(struct sde_hw_vbif *vbif,
  77. u32 *pnd_errors, u32 *src_errors);
  78. /**
  79. * set_write_gather_en - set write_gather enable
  80. * @vbif: vbif context driver
  81. * @xin_id: client interface identifier
  82. */
  83. void (*set_write_gather_en)(struct sde_hw_vbif *vbif, u32 xin_id);
  84. };
  85. struct sde_hw_vbif {
  86. /* base */
  87. struct sde_hw_blk_reg_map hw;
  88. /* vbif */
  89. enum sde_vbif idx;
  90. const struct sde_vbif_cfg *cap;
  91. /* ops */
  92. struct sde_hw_vbif_ops ops;
  93. /*
  94. * vbif is common across all displays, lock to serialize access.
  95. * must be take by client before using any ops
  96. */
  97. struct mutex mutex;
  98. };
  99. /**
  100. * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx
  101. * @idx: Interface index for which driver object is required
  102. * @addr: Mapped register io address of MDSS
  103. * @m: Pointer to mdss catalog data
  104. */
  105. struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx,
  106. void __iomem *addr,
  107. const struct sde_mdss_cfg *m);
  108. void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif);
  109. #endif /*_SDE_HW_VBIF_H */