Lines Matching full:hotplug
33 * DOC: Hotplug
35 * Simply put, hotplug occurs when a display is connected to or disconnected
39 * Hotplug in i915 is handled in many different levels of abstraction.
43 * handlers gather the hotplug detect (HPD) information from relevant registers
44 * into a platform independent mask of hotplug pins that have fired.
47 * intel_hotplug.c does hotplug irq storm detection and mitigation, and passes
49 * regular hotplug).
53 * pulses, with failures and non-MST long pulses triggering regular hotplug
56 * The regular hotplug work function i915_hotplug_work_func() calls connector
57 * detect hooks, and, if connector status changes, triggers sending of hotplug
61 * the hotplug uevent, disabling or enabling the crtc as needed.
63 * The hotplug interrupt storm detection and mitigation code keeps track of the
64 * number of interrupts per hotplug pin per a period of time, and if the number
70 * Current implementation expects that hotplug interrupt storm will not be
126 * stored in @dev_priv->display.hotplug.hpd_storm_threshold which defaults to
132 * &dev_priv->display.hotplug.hpd_storm_threshold. However, some older systems also
140 * and should only be adjusted for automated hotplug testing.
147 struct intel_hotplug *hpd = &dev_priv->display.hotplug; in intel_hpd_irq_storm_detect()
155 (!long_hpd && !dev_priv->display.hotplug.hpd_short_storm_enabled)) in intel_hpd_irq_storm_detect()
197 dev_priv->display.hotplug.stats[pin].state != HPD_MARK_DISABLED) in intel_hpd_irq_storm_switch_to_polling()
202 "switching from hotplug detection to polling\n", in intel_hpd_irq_storm_switch_to_polling()
205 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_irq_storm_switch_to_polling()
212 /* Enable polling and queue hotplug re-enabling. */ in intel_hpd_irq_storm_switch_to_polling()
216 &dev_priv->display.hotplug.reenable_work, in intel_hpd_irq_storm_switch_to_polling()
225 display.hotplug.reenable_work.work); in intel_hpd_irq_storm_reenable_work()
239 dev_priv->display.hotplug.stats[pin].state != HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
251 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
252 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_irq_storm_reenable_work()
303 container_of(work, struct drm_i915_private, display.hotplug.dig_port_work); in i915_digport_work_func()
309 long_port_mask = dev_priv->display.hotplug.long_port_mask; in i915_digport_work_func()
310 dev_priv->display.hotplug.long_port_mask = 0; in i915_digport_work_func()
311 short_port_mask = dev_priv->display.hotplug.short_port_mask; in i915_digport_work_func()
312 dev_priv->display.hotplug.short_port_mask = 0; in i915_digport_work_func()
341 dev_priv->display.hotplug.event_bits |= old_bits; in i915_digport_work_func()
344 &dev_priv->display.hotplug.hotplug_work, 0); in i915_digport_work_func()
360 i915->display.hotplug.short_port_mask |= BIT(dig_port->base.port); in intel_hpd_trigger_irq()
363 queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work); in intel_hpd_trigger_irq()
367 * Handle hotplug events outside the interrupt handler proper.
373 display.hotplug.hotplug_work.work); in i915_hotplug_work_func()
383 drm_dbg_kms(&dev_priv->drm, "running encoder hotplug functions\n"); in i915_hotplug_work_func()
387 hpd_event_bits = dev_priv->display.hotplug.event_bits; in i915_hotplug_work_func()
388 dev_priv->display.hotplug.event_bits = 0; in i915_hotplug_work_func()
389 hpd_retry_bits = dev_priv->display.hotplug.retry_bits; in i915_hotplug_work_func()
390 dev_priv->display.hotplug.retry_bits = 0; in i915_hotplug_work_func()
397 /* Skip calling encode hotplug handlers if ignore long HPD set*/ in i915_hotplug_work_func()
398 if (dev_priv->display.hotplug.ignore_long_hpd) { in i915_hotplug_work_func()
399 drm_dbg_kms(&dev_priv->drm, "Ignore HPD flag on - skip encoder hotplug handlers\n"); in i915_hotplug_work_func()
424 "Connector %s (pin %i) received hotplug event. (retry %d)\n", in i915_hotplug_work_func()
428 switch (encoder->hotplug(encoder, connector)) { in i915_hotplug_work_func()
460 dev_priv->display.hotplug.retry_bits |= retry; in i915_hotplug_work_func()
464 &dev_priv->display.hotplug.hotplug_work, in i915_hotplug_work_func()
471 * intel_hpd_irq_handler - main hotplug irq handler
476 * This is the main hotplug irq handler for all platforms. The platform specific
477 * irq handlers call the platform specific hotplug irq handlers, which read and
483 * Here, we do hotplug irq storm detection and mitigation, and pass further
528 dev_priv->display.hotplug.long_port_mask |= BIT(port); in intel_hpd_irq_handler()
531 dev_priv->display.hotplug.short_port_mask |= BIT(port); in intel_hpd_irq_handler()
542 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) { in intel_hpd_irq_handler()
546 * hotplug bits itself. So only WARN about unexpected in intel_hpd_irq_handler()
555 if (dev_priv->display.hotplug.stats[pin].state != HPD_ENABLED) in intel_hpd_irq_handler()
566 dev_priv->display.hotplug.event_bits |= BIT(pin); in intel_hpd_irq_handler()
572 dev_priv->display.hotplug.event_bits &= ~BIT(pin); in intel_hpd_irq_handler()
580 * happens later in our hotplug work. in intel_hpd_irq_handler()
587 * Our hotplug handler can grab modeset locks (by calling down into the in intel_hpd_irq_handler()
593 queue_work(dev_priv->display.hotplug.dp_wq, &dev_priv->display.hotplug.dig_port_work); in intel_hpd_irq_handler()
596 &dev_priv->display.hotplug.hotplug_work, 0); in intel_hpd_irq_handler()
603 * This function enables the hotplug support. It requires that interrupts have
604 * already been enabled with intel_irq_init_hw(). From this point on hotplug and
621 dev_priv->display.hotplug.stats[i].count = 0; in intel_hpd_init()
622 dev_priv->display.hotplug.stats[i].state = HPD_ENABLED; in intel_hpd_init()
638 display.hotplug.poll_init_work); in i915_hpd_poll_init_work()
645 enabled = READ_ONCE(dev_priv->display.hotplug.poll_enabled); in i915_hpd_poll_init_work()
687 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
698 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true); in intel_hpd_poll_enable()
707 &dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_enable()
721 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
734 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, false); in intel_hpd_poll_disable()
736 &dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_disable()
741 INIT_DELAYED_WORK(&i915->display.hotplug.hotplug_work, in intel_hpd_init_early()
743 INIT_WORK(&i915->display.hotplug.dig_port_work, i915_digport_work_func); in intel_hpd_init_early()
744 INIT_WORK(&i915->display.hotplug.poll_init_work, i915_hpd_poll_init_work); in intel_hpd_init_early()
745 INIT_DELAYED_WORK(&i915->display.hotplug.reenable_work, in intel_hpd_init_early()
748 i915->display.hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD; in intel_hpd_init_early()
755 i915->display.hotplug.hpd_short_storm_enabled = !HAS_DP_MST(i915); in intel_hpd_init_early()
765 dev_priv->display.hotplug.long_port_mask = 0; in intel_hpd_cancel_work()
766 dev_priv->display.hotplug.short_port_mask = 0; in intel_hpd_cancel_work()
767 dev_priv->display.hotplug.event_bits = 0; in intel_hpd_cancel_work()
768 dev_priv->display.hotplug.retry_bits = 0; in intel_hpd_cancel_work()
772 cancel_work_sync(&dev_priv->display.hotplug.dig_port_work); in intel_hpd_cancel_work()
773 cancel_delayed_work_sync(&dev_priv->display.hotplug.hotplug_work); in intel_hpd_cancel_work()
774 cancel_work_sync(&dev_priv->display.hotplug.poll_init_work); in intel_hpd_cancel_work()
775 cancel_delayed_work_sync(&dev_priv->display.hotplug.reenable_work); in intel_hpd_cancel_work()
786 if (dev_priv->display.hotplug.stats[pin].state == HPD_ENABLED) { in intel_hpd_disable()
787 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_disable()
801 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_enable()
808 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_storm_ctl_show() local
814 flush_work(&dev_priv->display.hotplug.dig_port_work); in i915_hpd_storm_ctl_show()
815 flush_delayed_work(&dev_priv->display.hotplug.hotplug_work); in i915_hpd_storm_ctl_show()
817 seq_printf(m, "Threshold: %d\n", hotplug->hpd_storm_threshold); in i915_hpd_storm_ctl_show()
819 str_yes_no(delayed_work_pending(&hotplug->reenable_work))); in i915_hpd_storm_ctl_show()
830 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_storm_ctl_write() local
862 hotplug->hpd_storm_threshold = new_threshold; in i915_hpd_storm_ctl_write()
865 hotplug->stats[i].count = 0; in i915_hpd_storm_ctl_write()
869 flush_delayed_work(&dev_priv->display.hotplug.reenable_work); in i915_hpd_storm_ctl_write()
893 str_yes_no(dev_priv->display.hotplug.hpd_short_storm_enabled)); in i915_hpd_short_storm_ctl_show()
911 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_short_storm_ctl_write() local
940 hotplug->hpd_short_storm_enabled = new_state; in i915_hpd_short_storm_ctl_write()
943 hotplug->stats[i].count = 0; in i915_hpd_short_storm_ctl_write()
947 flush_delayed_work(&dev_priv->display.hotplug.reenable_work); in i915_hpd_short_storm_ctl_write()
970 &i915->display.hotplug.ignore_long_hpd); in intel_hpd_debugfs_register()