Lines Matching full:hotplug
37 * DOC: Hotplug
39 * Simply put, hotplug occurs when a display is connected to or disconnected
43 * Hotplug in i915 is handled in many different levels of abstraction.
47 * handlers gather the hotplug detect (HPD) information from relevant registers
48 * into a platform independent mask of hotplug pins that have fired.
51 * intel_hotplug.c does hotplug irq storm detection and mitigation, and passes
53 * regular hotplug).
57 * pulses, with failures and non-MST long pulses triggering regular hotplug
60 * The regular hotplug work function i915_hotplug_work_func() calls connector
61 * detect hooks, and, if connector status changes, triggers sending of hotplug
65 * the hotplug uevent, disabling or enabling the crtc as needed.
67 * The hotplug interrupt storm detection and mitigation code keeps track of the
68 * number of interrupts per hotplug pin per a period of time, and if the number
74 * Current implementation expects that hotplug interrupt storm will not be
130 * stored in @dev_priv->display.hotplug.hpd_storm_threshold which defaults to
136 * &dev_priv->display.hotplug.hpd_storm_threshold. However, some older systems also
144 * and should only be adjusted for automated hotplug testing.
151 struct intel_hotplug *hpd = &dev_priv->display.hotplug; in intel_hpd_irq_storm_detect()
159 (!long_hpd && !dev_priv->display.hotplug.hpd_short_storm_enabled)) in intel_hpd_irq_storm_detect()
187 return i915->display.hotplug.detection_work_enabled; in detection_work_enabled()
241 dev_priv->display.hotplug.stats[pin].state != HPD_MARK_DISABLED) in intel_hpd_irq_storm_switch_to_polling()
246 "switching from hotplug detection to polling\n", in intel_hpd_irq_storm_switch_to_polling()
249 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_irq_storm_switch_to_polling()
256 /* Enable polling and queue hotplug re-enabling. */ in intel_hpd_irq_storm_switch_to_polling()
260 &dev_priv->display.hotplug.reenable_work, in intel_hpd_irq_storm_switch_to_polling()
269 display.hotplug.reenable_work.work); in intel_hpd_irq_storm_reenable_work()
283 dev_priv->display.hotplug.stats[pin].state != HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
295 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
296 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_irq_storm_reenable_work()
355 container_of(work, struct drm_i915_private, display.hotplug.dig_port_work); in i915_digport_work_func()
361 long_port_mask = dev_priv->display.hotplug.long_port_mask; in i915_digport_work_func()
362 dev_priv->display.hotplug.long_port_mask = 0; in i915_digport_work_func()
363 short_port_mask = dev_priv->display.hotplug.short_port_mask; in i915_digport_work_func()
364 dev_priv->display.hotplug.short_port_mask = 0; in i915_digport_work_func()
393 dev_priv->display.hotplug.event_bits |= old_bits; in i915_digport_work_func()
395 &dev_priv->display.hotplug.hotplug_work, 0); in i915_digport_work_func()
412 i915->display.hotplug.short_port_mask |= BIT(dig_port->base.port); in intel_hpd_trigger_irq()
415 queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work); in intel_hpd_trigger_irq()
419 * Handle hotplug events outside the interrupt handler proper.
425 display.hotplug.hotplug_work.work); in i915_hotplug_work_func()
435 drm_dbg_kms(&dev_priv->drm, "running encoder hotplug functions\n"); in i915_hotplug_work_func()
439 hpd_event_bits = dev_priv->display.hotplug.event_bits; in i915_hotplug_work_func()
440 dev_priv->display.hotplug.event_bits = 0; in i915_hotplug_work_func()
441 hpd_retry_bits = dev_priv->display.hotplug.retry_bits; in i915_hotplug_work_func()
442 dev_priv->display.hotplug.retry_bits = 0; in i915_hotplug_work_func()
449 /* Skip calling encode hotplug handlers if ignore long HPD set*/ in i915_hotplug_work_func()
450 if (dev_priv->display.hotplug.ignore_long_hpd) { in i915_hotplug_work_func()
451 drm_dbg_kms(&dev_priv->drm, "Ignore HPD flag on - skip encoder hotplug handlers\n"); in i915_hotplug_work_func()
476 "Connector %s (pin %i) received hotplug event. (retry %d)\n", in i915_hotplug_work_func()
480 switch (encoder->hotplug(encoder, connector)) { in i915_hotplug_work_func()
512 dev_priv->display.hotplug.retry_bits |= retry; in i915_hotplug_work_func()
515 &dev_priv->display.hotplug.hotplug_work, in i915_hotplug_work_func()
523 * intel_hpd_irq_handler - main hotplug irq handler
528 * This is the main hotplug irq handler for all platforms. The platform specific
529 * irq handlers call the platform specific hotplug irq handlers, which read and
535 * Here, we do hotplug irq storm detection and mitigation, and pass further
580 dev_priv->display.hotplug.long_port_mask |= BIT(port); in intel_hpd_irq_handler()
583 dev_priv->display.hotplug.short_port_mask |= BIT(port); in intel_hpd_irq_handler()
594 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) { in intel_hpd_irq_handler()
598 * hotplug bits itself. So only WARN about unexpected in intel_hpd_irq_handler()
607 if (dev_priv->display.hotplug.stats[pin].state != HPD_ENABLED) in intel_hpd_irq_handler()
618 dev_priv->display.hotplug.event_bits |= BIT(pin); in intel_hpd_irq_handler()
624 dev_priv->display.hotplug.event_bits &= ~BIT(pin); in intel_hpd_irq_handler()
632 * happens later in our hotplug work. in intel_hpd_irq_handler()
638 * Our hotplug handler can grab modeset locks (by calling down into the in intel_hpd_irq_handler()
644 queue_work(dev_priv->display.hotplug.dp_wq, &dev_priv->display.hotplug.dig_port_work); in intel_hpd_irq_handler()
647 &dev_priv->display.hotplug.hotplug_work, 0); in intel_hpd_irq_handler()
656 * This function enables the hotplug support. It requires that interrupts have
657 * already been enabled with intel_irq_init_hw(). From this point on hotplug and
674 dev_priv->display.hotplug.stats[i].count = 0; in intel_hpd_init()
675 dev_priv->display.hotplug.stats[i].state = HPD_ENABLED; in intel_hpd_init()
734 display.hotplug.poll_init_work); in i915_hpd_poll_init_work()
742 enabled = READ_ONCE(dev_priv->display.hotplug.poll_enabled); in i915_hpd_poll_init_work()
753 READ_ONCE(dev_priv->display.hotplug.poll_enabled)); in i915_hpd_poll_init_work()
754 cancel_work(&dev_priv->display.hotplug.poll_init_work); in i915_hpd_poll_init_work()
767 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) in i915_hpd_poll_init_work()
809 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
822 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true); in intel_hpd_poll_enable()
832 &dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_enable()
847 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
860 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, false); in intel_hpd_poll_disable()
864 &dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_disable()
870 INIT_DELAYED_WORK(&i915->display.hotplug.hotplug_work, in intel_hpd_init_early()
872 INIT_WORK(&i915->display.hotplug.dig_port_work, i915_digport_work_func); in intel_hpd_init_early()
873 INIT_WORK(&i915->display.hotplug.poll_init_work, i915_hpd_poll_init_work); in intel_hpd_init_early()
874 INIT_DELAYED_WORK(&i915->display.hotplug.reenable_work, in intel_hpd_init_early()
877 i915->display.hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD; in intel_hpd_init_early()
884 i915->display.hotplug.hpd_short_storm_enabled = !HAS_DP_MST(i915); in intel_hpd_init_early()
891 if (cancel_delayed_work_sync(&i915->display.hotplug.hotplug_work)) in cancel_all_detection_work()
893 if (cancel_work_sync(&i915->display.hotplug.poll_init_work)) in cancel_all_detection_work()
895 if (cancel_delayed_work_sync(&i915->display.hotplug.reenable_work)) in cancel_all_detection_work()
908 dev_priv->display.hotplug.long_port_mask = 0; in intel_hpd_cancel_work()
909 dev_priv->display.hotplug.short_port_mask = 0; in intel_hpd_cancel_work()
910 dev_priv->display.hotplug.event_bits = 0; in intel_hpd_cancel_work()
911 dev_priv->display.hotplug.retry_bits = 0; in intel_hpd_cancel_work()
915 cancel_work_sync(&dev_priv->display.hotplug.dig_port_work); in intel_hpd_cancel_work()
918 * All other work triggered by hotplug events should be canceled by in intel_hpd_cancel_work()
922 drm_dbg_kms(&dev_priv->drm, "Hotplug detection work still active\n"); in intel_hpd_cancel_work()
933 if (dev_priv->display.hotplug.stats[pin].state == HPD_ENABLED) { in intel_hpd_disable()
934 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_disable()
948 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_enable()
959 if (i915->display.hotplug.event_bits || in queue_work_for_missed_irqs()
960 i915->display.hotplug.retry_bits) in queue_work_for_missed_irqs()
964 switch (i915->display.hotplug.stats[pin].state) { in queue_work_for_missed_irqs()
971 MISSING_CASE(i915->display.hotplug.stats[pin].state); in queue_work_for_missed_irqs()
976 queue_delayed_detection_work(i915, &i915->display.hotplug.hotplug_work, 0); in queue_work_for_missed_irqs()
982 i915->display.hotplug.detection_work_enabled = true; in intel_hpd_enable_detection_work()
990 i915->display.hotplug.detection_work_enabled = false; in intel_hpd_disable_detection_work()
1002 ret = queue_delayed_detection_work(i915, &i915->display.hotplug.hotplug_work, 0); in intel_hpd_schedule_detection()
1011 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_storm_ctl_show() local
1017 flush_work(&dev_priv->display.hotplug.dig_port_work); in i915_hpd_storm_ctl_show()
1018 flush_delayed_work(&dev_priv->display.hotplug.hotplug_work); in i915_hpd_storm_ctl_show()
1020 seq_printf(m, "Threshold: %d\n", hotplug->hpd_storm_threshold); in i915_hpd_storm_ctl_show()
1022 str_yes_no(delayed_work_pending(&hotplug->reenable_work))); in i915_hpd_storm_ctl_show()
1033 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_storm_ctl_write() local
1065 hotplug->hpd_storm_threshold = new_threshold; in i915_hpd_storm_ctl_write()
1068 hotplug->stats[i].count = 0; in i915_hpd_storm_ctl_write()
1072 flush_delayed_work(&dev_priv->display.hotplug.reenable_work); in i915_hpd_storm_ctl_write()
1096 str_yes_no(dev_priv->display.hotplug.hpd_short_storm_enabled)); in i915_hpd_short_storm_ctl_show()
1114 struct intel_hotplug *hotplug = &dev_priv->display.hotplug; in i915_hpd_short_storm_ctl_write() local
1143 hotplug->hpd_short_storm_enabled = new_state; in i915_hpd_short_storm_ctl_write()
1146 hotplug->stats[i].count = 0; in i915_hpd_short_storm_ctl_write()
1150 flush_delayed_work(&dev_priv->display.hotplug.reenable_work); in i915_hpd_short_storm_ctl_write()
1173 &i915->display.hotplug.ignore_long_hpd); in intel_hpd_debugfs_register()