This collects and adapts several upstream fixes to make i915 and related
DRM subsystem build and function.
The upstream fix HPD polling("drm/i915: Fix HPD polling, reenabling the output 
poll work as needed")
and its dependencies could not be directly backported due to extensive code 
differences.

Upstream commits:
drm/i915: Fix HPD polling, reenabling the output poll work as needed(commit 
50452f2f76852322620b63e62922b85e955abe9)
drm: Add an HPD poll helper to reschedule the poll work(commit 
fe2352fd64029918174de4b460dfe6df0c6911cd)
drm/probe_helper: extract two helper functions(commit 
cbf143b282c64e59559cc8351c0b5b1ab4bbdcbe)
drm/probe-helper: enable and disable HPD on connectors(commit 
c8268795c9a9cc7be50f78d4502fad83a2a4f8df)
...

Due to significant codebase divergence and numerous dependencies, it was not
possible to cherry-pick these commits cleanly. Instead, this will resolve 
compile-time
errors and fixes the hot plug mechanism. Developed with uspstream as a 
guideline,
with the goal of addressing the defect while maintaining the stability.

Auxiliary fixes in upstream commits were not ported here as this would require
substantial work and dependency tracking.

Cc: sta...@vger.kernel.org # 6.1.y
Cc: dri-de...@lists.freedesktop.org
Cc: Imre Deak <imre.d...@intel.com>
Signed-off-by: Nicusor Huhulea <nicusor.huhu...@siemens.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c 
b/drivers/gpu/drm/drm_probe_helper.c
index 938649e3a282..9dc7505f20ff 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -304,8 +304,6 @@ static bool drm_kms_helper_enable_hpd(struct drm_device 
*dev)
 void drm_kms_helper_poll_enable(struct drm_device *dev)
 {
 
-       struct drm_connector *connector;
-       struct drm_connector_list_iter conn_iter;
 
        if (drm_WARN_ON_ONCE(dev, !dev->mode_config.poll_enabled) ||
            !drm_kms_helper_poll || dev->mode_config.poll_running)
@@ -779,8 +777,11 @@ static void output_poll_execute(struct work_struct *work)
        changed = dev->mode_config.delayed_event;
        dev->mode_config.delayed_event = false;
 
-       if (!drm_kms_helper_poll)
+       if (!drm_kms_helper_poll && dev->mode_config.poll_running) {
+               drm_kms_helper_disable_hpd(dev);
+               dev->mode_config.poll_running = false;
                goto out;
+       }
 
        if (!mutex_trylock(&dev->mode_config.mutex)) {
                repoll = true;
@@ -897,9 +898,14 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker);
 void drm_kms_helper_poll_disable(struct drm_device *dev)
 {
        if (drm_WARN_ON(dev, !dev->mode_config.poll_enabled))
-               return;
+               pr_warn("%s: called with poll_enabled = false\n", __func__);
+
+       if (dev->mode_config.poll_running)
+               drm_kms_helper_disable_hpd(dev);
 
        cancel_delayed_work_sync(&dev->mode_config.output_poll_work);
+
+       dev->mode_config.poll_running = false;
 }
 EXPORT_SYMBOL(drm_kms_helper_poll_disable);
 
-- 
2.39.2

Reply via email to