dce_aux.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright 2012-15 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: AMD
  23. *
  24. */
  25. #ifndef __DAL_AUX_ENGINE_DCE110_H__
  26. #define __DAL_AUX_ENGINE_DCE110_H__
  27. #include "aux_engine.h"
  28. #define AUX_COMMON_REG_LIST(id)\
  29. SRI(AUX_CONTROL, DP_AUX, id), \
  30. SRI(AUX_ARB_CONTROL, DP_AUX, id), \
  31. SRI(AUX_SW_DATA, DP_AUX, id), \
  32. SRI(AUX_SW_CONTROL, DP_AUX, id), \
  33. SRI(AUX_INTERRUPT_CONTROL, DP_AUX, id), \
  34. SRI(AUX_SW_STATUS, DP_AUX, id), \
  35. SR(AUXN_IMPCAL), \
  36. SR(AUXP_IMPCAL)
  37. struct dce110_aux_registers {
  38. uint32_t AUX_CONTROL;
  39. uint32_t AUX_ARB_CONTROL;
  40. uint32_t AUX_SW_DATA;
  41. uint32_t AUX_SW_CONTROL;
  42. uint32_t AUX_INTERRUPT_CONTROL;
  43. uint32_t AUX_SW_STATUS;
  44. uint32_t AUXN_IMPCAL;
  45. uint32_t AUXP_IMPCAL;
  46. uint32_t AUX_RESET_MASK;
  47. };
  48. enum { /* This is the timeout as defined in DP 1.2a,
  49. * 2.3.4 "Detailed uPacket TX AUX CH State Description".
  50. */
  51. AUX_TIMEOUT_PERIOD = 400,
  52. /* Ideally, the SW timeout should be just above 550usec
  53. * which is programmed in HW.
  54. * But the SW timeout of 600usec is not reliable,
  55. * because on some systems, delay_in_microseconds()
  56. * returns faster than it should.
  57. * EPR #379763: by trial-and-error on different systems,
  58. * 700usec is the minimum reliable SW timeout for polling
  59. * the AUX_SW_STATUS.AUX_SW_DONE bit.
  60. * This timeout expires *only* when there is
  61. * AUX Error or AUX Timeout conditions - not during normal operation.
  62. * During normal operation, AUX_SW_STATUS.AUX_SW_DONE bit is set
  63. * at most within ~240usec. That means,
  64. * increasing this timeout will not affect normal operation,
  65. * and we'll timeout after
  66. * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec.
  67. * This timeout is especially important for
  68. * resume from S3 and CTS.
  69. */
  70. SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4
  71. };
  72. struct aux_engine_dce110 {
  73. struct aux_engine base;
  74. const struct dce110_aux_registers *regs;
  75. struct {
  76. uint32_t aux_control;
  77. uint32_t aux_arb_control;
  78. uint32_t aux_sw_data;
  79. uint32_t aux_sw_control;
  80. uint32_t aux_interrupt_control;
  81. uint32_t aux_sw_status;
  82. } addr;
  83. uint32_t timeout_period;
  84. };
  85. struct aux_engine_dce110_init_data {
  86. uint32_t engine_id;
  87. uint32_t timeout_period;
  88. struct dc_context *ctx;
  89. const struct dce110_aux_registers *regs;
  90. };
  91. struct aux_engine *dce110_aux_engine_construct(
  92. struct aux_engine_dce110 *aux_engine110,
  93. struct dc_context *ctx,
  94. uint32_t inst,
  95. uint32_t timeout_period,
  96. const struct dce110_aux_registers *regs);
  97. void dce110_engine_destroy(struct aux_engine **engine);
  98. bool dce110_aux_engine_acquire(
  99. struct aux_engine *aux_engine,
  100. struct ddc *ddc);
  101. #endif