0006-drm-i915-Avoid-HPD-poll-detect-triggering-a-new-dete.patch 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Imre Deak <[email protected]>
  3. Date: Mon, 28 Oct 2019 20:15:17 +0200
  4. Subject: [PATCH] drm/i915: Avoid HPD poll detect triggering a new detect cycle
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. For the HPD interrupt functionality the HW depends on power wells in the
  9. display core domain to be on. Accordingly when enabling these power
  10. wells the HPD polling logic will force an HPD detection cycle to account
  11. for hotplug events that may have happened when such a power well was
  12. off.
  13. Thus a detect cycle started by polling could start a new detect cycle if
  14. a power well in the display core domain gets enabled during detect and
  15. stays enabled after detect completes. That in turn can lead to a
  16. detection cycle runaway.
  17. To prevent re-triggering a poll-detect cycle make sure we drop all power
  18. references we acquired during detect synchronously by the end of detect.
  19. This will let the poll-detect logic continue with polling (matching the
  20. off state of the corresponding power wells) instead of scheduling a new
  21. detection cycle.
  22. Fixes: 6cfe7ec02e85 ("drm/i915: Remove the unneeded AUX power ref from intel_dp_detect()")
  23. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=112125
  24. Reported-and-tested-by: Val Kulkov <[email protected]>
  25. Reported-and-tested-by: wangqr <[email protected]>
  26. Cc: Val Kulkov <[email protected]>
  27. Cc: wangqr <[email protected]>
  28. Cc: Ville Syrjälä <[email protected]>
  29. Signed-off-by: Imre Deak <[email protected]>
  30. Reviewed-by: Ville Syrjälä <[email protected]>
  31. Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  32. (cherry picked from commit a8ddac7c9f06a12227a4f5febd1cbe0575a33179)
  33. Signed-off-by: Thomas Lamprecht <[email protected]>
  34. ---
  35. drivers/gpu/drm/i915/display/intel_crt.c | 7 +++++++
  36. drivers/gpu/drm/i915/display/intel_dp.c | 6 ++++++
  37. drivers/gpu/drm/i915/display/intel_hdmi.c | 6 ++++++
  38. 3 files changed, 19 insertions(+)
  39. diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
  40. index 3fcf2f84bcce..da1d6be46a0c 100644
  41. --- a/drivers/gpu/drm/i915/display/intel_crt.c
  42. +++ b/drivers/gpu/drm/i915/display/intel_crt.c
  43. @@ -867,6 +867,13 @@ intel_crt_detect(struct drm_connector *connector,
  44. out:
  45. intel_display_power_put(dev_priv, intel_encoder->power_domain, wakeref);
  46. +
  47. + /*
  48. + * Make sure the refs for power wells enabled during detect are
  49. + * dropped to avoid a new detect cycle triggered by HPD polling.
  50. + */
  51. + intel_display_power_flush_work(dev_priv);
  52. +
  53. return status;
  54. }
  55. diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
  56. index 305abddc274a..dbdd46ba9bfe 100644
  57. --- a/drivers/gpu/drm/i915/display/intel_dp.c
  58. +++ b/drivers/gpu/drm/i915/display/intel_dp.c
  59. @@ -5649,6 +5649,12 @@ intel_dp_detect(struct drm_connector *connector,
  60. if (status != connector_status_connected && !intel_dp->is_mst)
  61. intel_dp_unset_edid(intel_dp);
  62. + /*
  63. + * Make sure the refs for power wells enabled during detect are
  64. + * dropped to avoid a new detect cycle triggered by HPD polling.
  65. + */
  66. + intel_display_power_flush_work(dev_priv);
  67. +
  68. return status;
  69. }
  70. diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
  71. index 7ffdfaae7188..5d5453461a6f 100644
  72. --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
  73. +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
  74. @@ -2571,6 +2571,12 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
  75. if (status != connector_status_connected)
  76. cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);
  77. + /*
  78. + * Make sure the refs for power wells enabled during detect are
  79. + * dropped to avoid a new detect cycle triggered by HPD polling.
  80. + */
  81. + intel_display_power_flush_work(dev_priv);
  82. +
  83. return status;
  84. }