• Lyude's avatar
    drm/i915: Enable polling when we don't have hpd · 84c8e096
    Lyude authored
    Unfortunately, there's two situations where we lose hpd right now:
    - Runtime suspend
    - When we've shut off all of the power wells on Valleyview/Cherryview
    
    While it would be nice if this didn't cause issues, this has the
    ability to get us in some awkward states where a user won't be able to
    get their display to turn on. For instance; if we boot a Valleyview
    system without any monitors connected, it won't need any of it's power
    wells and thus shut them off. Since this causes us to lose HPD, this
    means that unless the user knows how to ssh into their machine and do a
    manual reprobe for monitors, none of the monitors they connect after
    booting will actually work.
    
    Eventually we should come up with a better fix then having to enable
    polling for this, since this makes rpm a lot less useful, but for now
    the infrastructure in i915 just isn't there yet to get hpd in these
    situations.
    
    Changes since v1:
     - Add comment explaining the addition of the if
       (!mode_config->poll_running) in intel_hpd_init()
     - Remove unneeded if (!dev->mode_config.poll_enabled) in
       i915_hpd_poll_init_work()
     - Call to drm_helper_hpd_irq_event() after we disable polling
     - Add cancel_work_sync() call to intel_hpd_cancel_work()
    
    Changes since v2:
     - Apparently dev->mode_config.poll_running doesn't actually reflect
       whether or not a poll is currently in progress, and is actually used
       for dynamic module paramter enabling/disabling. So now we instead
       keep track of our own poll_running variable in dev_priv->hotplug
     - Clean i915_hpd_poll_init_work() a little bit
    
    Changes since v3:
     - Remove the now-redundant connector loop in intel_hpd_init(), just
       rely on intel_hpd_poll_enable() for setting connector->polled
       correctly on each connector
     - Get rid of poll_running
     - Don't assign enabled in i915_hpd_poll_init_work before we actually
       lock dev->mode_config.mutex
     - Wrap enabled assignment in i915_hpd_poll_init_work() in READ_ONCE()
       for doc purposes
     - Do the same for dev_priv->hotplug.poll_enabled with WRITE_ONCE in
       intel_hpd_poll_enable()
     - Add some comments about racing not mattering in intel_hpd_poll_enable
    
    Changes since v4:
     - Rename intel_hpd_poll_enable() to intel_hpd_poll_init()
     - Drop the bool argument from intel_hpd_poll_init()
     - Remove redundant calls to intel_hpd_poll_init()
     - Rename poll_enable_work to poll_init_work
     - Add some kerneldoc for intel_hpd_poll_init()
     - Cross-reference intel_hpd_poll_init() in intel_hpd_init()
     - Just copy the loop from intel_hpd_init() in intel_hpd_poll_init()
    
    Changes since v5:
     - Minor kerneldoc nitpicks
    
    Cc: stable@vger.kernel.org
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: default avatarLyude <cpaul@redhat.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    (cherry picked from commit 19625e85)
    84c8e096
intel_hotplug.c 19 KB