From e3a5ec25a88cd44a71c0d991224daafdd36130f5 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Sat, 4 Feb 2017 00:59:07 +0200 Subject: [PATCH] drm/nouveau: Start hpd poll from hpd_work To avoid races when the hpd work runs before the detection has happened. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/nouveau/nouveau_display.c | 7 +++---- drivers/gpu/drm/nouveau/nouveau_drm.c | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index b715647c0623..2f2f3f771c12 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -362,6 +362,9 @@ nouveau_display_hpd_work(struct work_struct *work) pm_runtime_mark_last_busy(drm->dev->dev); pm_runtime_put_sync(drm->dev->dev); + + DRM_DEV_DEBUG_KMS(drm->dev->dev, "BUG98690: poll_enable\n"); + drm_kms_helper_poll_enable(drm->dev); } #ifdef CONFIG_ACPI @@ -416,10 +419,6 @@ nouveau_display_init(struct drm_device *dev) if (ret) return ret; - /* enable polling for external displays */ - DRM_DEV_DEBUG_KMS(dev->dev, "BUG98690: poll_enable\n"); - drm_kms_helper_poll_enable(dev); - /* enable hotplug interrupts */ list_for_each_entry(connector, &dev->mode_config.connector_list, head) { struct nouveau_connector *conn = nouveau_connector(connector); diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index f4c5cea0420e..308e95e252a1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -485,6 +485,8 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) pm_runtime_allow(dev->dev); pm_runtime_mark_last_busy(dev->dev); pm_runtime_put(dev->dev); + } else { + drm_kms_helper_poll_enable(dev); } return 0; @@ -780,8 +782,6 @@ nouveau_pmops_runtime_resume(struct device *dev) pci_set_master(pdev); ret = nouveau_do_resume(drm_dev, true); - DRM_DEV_DEBUG_KMS(drm_dev->dev, "BUG98690: poll_enable\n"); - drm_kms_helper_poll_enable(drm_dev); /* do magic */ nvif_mask(&device->object, 0x088488, (1 << 25), (1 << 25)); vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON); -- 2.11.0