Lines Matching +full:no +full:- +full:hpd
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
42 * handlers gather the hotplug detect (HPD) information from relevant registers
52 * pulses, with failures and non-MST long pulses triggering regular hotplug
65 * while before being re-enabled. The intention is to mitigate issues raising
71 * callback is handled by i915_digport_work_func reenabling of hpd is not
79 * intel_hpd_pin_default - return default pin associated with certain port.
81 * @port: the hpd port to get associated pin
90 return HPD_PORT_A + port - PORT_A; in intel_hpd_pin_default()
108 return encoder ? encoder->hpd_pin : HPD_NONE; in intel_connector_hpd_pin()
112 * intel_hpd_irq_storm_detect - gather stats and detect HPD IRQ storm on a pin
115 * @long_hpd: whether the HPD IRQ was long or short
117 * Gather stats about HPD IRQs from the specified @pin, and detect IRQ
122 * stored in @dev_priv->display.hotplug.hpd_storm_threshold which defaults to
128 * &dev_priv->display.hotplug.hpd_storm_threshold. However, some older systems also
135 * The HPD threshold can be controlled through i915_hpd_storm_ctl in debugfs,
143 struct intel_hotplug *hpd = &dev_priv->display.hotplug; in intel_hpd_irq_storm_detect() local
144 unsigned long start = hpd->stats[pin].last_jiffies; in intel_hpd_irq_storm_detect()
147 const int threshold = hpd->hpd_storm_threshold; in intel_hpd_irq_storm_detect()
151 (!long_hpd && !dev_priv->display.hotplug.hpd_short_storm_enabled)) in intel_hpd_irq_storm_detect()
155 hpd->stats[pin].last_jiffies = jiffies; in intel_hpd_irq_storm_detect()
156 hpd->stats[pin].count = 0; in intel_hpd_irq_storm_detect()
159 hpd->stats[pin].count += increment; in intel_hpd_irq_storm_detect()
160 if (hpd->stats[pin].count > threshold) { in intel_hpd_irq_storm_detect()
161 hpd->stats[pin].state = HPD_MARK_DISABLED; in intel_hpd_irq_storm_detect()
162 drm_dbg_kms(&dev_priv->drm, in intel_hpd_irq_storm_detect()
163 "HPD interrupt storm detected on PIN %d\n", pin); in intel_hpd_irq_storm_detect()
166 drm_dbg_kms(&dev_priv->drm, in intel_hpd_irq_storm_detect()
167 "Received HPD interrupt on PIN %d - cnt: %d\n", in intel_hpd_irq_storm_detect()
169 hpd->stats[pin].count); in intel_hpd_irq_storm_detect()
178 struct drm_device *dev = &dev_priv->drm; in intel_hpd_irq_storm_switch_to_polling()
183 lockdep_assert_held(&dev_priv->irq_lock); in intel_hpd_irq_storm_switch_to_polling()
189 if (connector->base.polled != DRM_CONNECTOR_POLL_HPD) in intel_hpd_irq_storm_switch_to_polling()
194 dev_priv->display.hotplug.stats[pin].state != HPD_MARK_DISABLED) in intel_hpd_irq_storm_switch_to_polling()
197 drm_info(&dev_priv->drm, in intel_hpd_irq_storm_switch_to_polling()
198 "HPD interrupt storm detected on connector %s: " in intel_hpd_irq_storm_switch_to_polling()
200 connector->base.name); in intel_hpd_irq_storm_switch_to_polling()
202 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_irq_storm_switch_to_polling()
203 connector->base.polled = DRM_CONNECTOR_POLL_CONNECT | in intel_hpd_irq_storm_switch_to_polling()
209 /* Enable polling and queue hotplug re-enabling. */ in intel_hpd_irq_storm_switch_to_polling()
212 mod_delayed_work(system_wq, &dev_priv->display.hotplug.reenable_work, in intel_hpd_irq_storm_switch_to_polling()
222 struct drm_device *dev = &dev_priv->drm; in intel_hpd_irq_storm_reenable_work()
228 wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); in intel_hpd_irq_storm_reenable_work()
230 spin_lock_irq(&dev_priv->irq_lock); in intel_hpd_irq_storm_reenable_work()
236 dev_priv->display.hotplug.stats[pin].state != HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
239 if (connector->base.polled != connector->polled) in intel_hpd_irq_storm_reenable_work()
240 drm_dbg(&dev_priv->drm, in intel_hpd_irq_storm_reenable_work()
241 "Reenabling HPD on connector %s\n", in intel_hpd_irq_storm_reenable_work()
242 connector->base.name); in intel_hpd_irq_storm_reenable_work()
243 connector->base.polled = connector->polled; in intel_hpd_irq_storm_reenable_work()
248 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) in intel_hpd_irq_storm_reenable_work()
249 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_irq_storm_reenable_work()
254 spin_unlock_irq(&dev_priv->irq_lock); in intel_hpd_irq_storm_reenable_work()
256 intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); in intel_hpd_irq_storm_reenable_work()
263 struct drm_device *dev = connector->base.dev; in intel_encoder_hotplug()
268 drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex)); in intel_encoder_hotplug()
269 old_status = connector->base.status; in intel_encoder_hotplug()
270 old_epoch_counter = connector->base.epoch_counter; in intel_encoder_hotplug()
272 connector->base.status = in intel_encoder_hotplug()
273 drm_helper_probe_detect(&connector->base, NULL, false); in intel_encoder_hotplug()
275 if (old_epoch_counter != connector->base.epoch_counter) in intel_encoder_hotplug()
279 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] status updated from %s to %s (epoch counter %llu->%llu)\n", in intel_encoder_hotplug()
280 connector->base.base.id, in intel_encoder_hotplug()
281 connector->base.name, in intel_encoder_hotplug()
283 drm_get_connector_status_name(connector->base.status), in intel_encoder_hotplug()
285 connector->base.epoch_counter); in intel_encoder_hotplug()
294 enc_to_dig_port(encoder)->hpd_pulse != NULL; in intel_encoder_has_hpd_pulse()
305 spin_lock_irq(&dev_priv->irq_lock); in i915_digport_work_func()
306 long_port_mask = dev_priv->display.hotplug.long_port_mask; in i915_digport_work_func()
307 dev_priv->display.hotplug.long_port_mask = 0; in i915_digport_work_func()
308 short_port_mask = dev_priv->display.hotplug.short_port_mask; in i915_digport_work_func()
309 dev_priv->display.hotplug.short_port_mask = 0; in i915_digport_work_func()
310 spin_unlock_irq(&dev_priv->irq_lock); in i915_digport_work_func()
312 for_each_intel_encoder(&dev_priv->drm, encoder) { in i915_digport_work_func()
314 enum port port = encoder->port; in i915_digport_work_func()
329 ret = dig_port->hpd_pulse(dig_port, long_hpd); in i915_digport_work_func()
331 /* fall back to old school hpd */ in i915_digport_work_func()
332 old_bits |= BIT(encoder->hpd_pin); in i915_digport_work_func()
337 spin_lock_irq(&dev_priv->irq_lock); in i915_digport_work_func()
338 dev_priv->display.hotplug.event_bits |= old_bits; in i915_digport_work_func()
339 spin_unlock_irq(&dev_priv->irq_lock); in i915_digport_work_func()
340 queue_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work, 0); in i915_digport_work_func()
345 * intel_hpd_trigger_irq - trigger an hpd irq event for a port
348 * Trigger an HPD interrupt event for the given port, emulating a short pulse
353 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); in intel_hpd_trigger_irq()
355 spin_lock_irq(&i915->irq_lock); in intel_hpd_trigger_irq()
356 i915->display.hotplug.short_port_mask |= BIT(dig_port->base.port); in intel_hpd_trigger_irq()
357 spin_unlock_irq(&i915->irq_lock); in intel_hpd_trigger_irq()
359 queue_work(i915->display.hotplug.dp_wq, &i915->display.hotplug.dig_port_work); in intel_hpd_trigger_irq()
370 struct drm_device *dev = &dev_priv->drm; in i915_hotplug_work_func()
377 mutex_lock(&dev->mode_config.mutex); in i915_hotplug_work_func()
378 drm_dbg_kms(&dev_priv->drm, "running encoder hotplug functions\n"); in i915_hotplug_work_func()
380 spin_lock_irq(&dev_priv->irq_lock); in i915_hotplug_work_func()
382 hpd_event_bits = dev_priv->display.hotplug.event_bits; in i915_hotplug_work_func()
383 dev_priv->display.hotplug.event_bits = 0; in i915_hotplug_work_func()
384 hpd_retry_bits = dev_priv->display.hotplug.retry_bits; in i915_hotplug_work_func()
385 dev_priv->display.hotplug.retry_bits = 0; in i915_hotplug_work_func()
387 /* Enable polling for connectors which had HPD IRQ storms */ in i915_hotplug_work_func()
390 spin_unlock_irq(&dev_priv->irq_lock); in i915_hotplug_work_func()
407 connector->hotplug_retries = 0; in i915_hotplug_work_func()
409 connector->hotplug_retries++; in i915_hotplug_work_func()
411 drm_dbg_kms(&dev_priv->drm, in i915_hotplug_work_func()
413 connector->base.name, pin, in i915_hotplug_work_func()
414 connector->hotplug_retries); in i915_hotplug_work_func()
416 switch (encoder->hotplug(encoder, connector)) { in i915_hotplug_work_func()
429 mutex_unlock(&dev->mode_config.mutex); in i915_hotplug_work_func()
434 /* Remove shared HPD pins that have changed */ in i915_hotplug_work_func()
437 spin_lock_irq(&dev_priv->irq_lock); in i915_hotplug_work_func()
438 dev_priv->display.hotplug.retry_bits |= retry; in i915_hotplug_work_func()
439 spin_unlock_irq(&dev_priv->irq_lock); in i915_hotplug_work_func()
441 mod_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work, in i915_hotplug_work_func()
448 * intel_hpd_irq_handler - main hotplug irq handler
450 * @pin_mask: a mask of hpd pins that have triggered the irq
451 * @long_mask: a mask of hpd pins that may be long hpd pulses
455 * decode the appropriate registers into bitmasks about hpd pins that have
476 spin_lock(&dev_priv->irq_lock); in intel_hpd_irq_handler()
479 * Determine whether ->hpd_pulse() exists for each pin, and in intel_hpd_irq_handler()
482 * only the one of them (DP) will have ->hpd_pulse(). in intel_hpd_irq_handler()
484 for_each_intel_encoder(&dev_priv->drm, encoder) { in intel_hpd_irq_handler()
485 enum port port = encoder->port; in intel_hpd_irq_handler()
488 pin = encoder->hpd_pin; in intel_hpd_irq_handler()
497 drm_dbg(&dev_priv->drm, in intel_hpd_irq_handler()
498 "digital hpd on [ENCODER:%d:%s] - %s\n", in intel_hpd_irq_handler()
499 encoder->base.base.id, encoder->base.name, in intel_hpd_irq_handler()
505 dev_priv->display.hotplug.long_port_mask |= BIT(port); in intel_hpd_irq_handler()
508 dev_priv->display.hotplug.short_port_mask |= BIT(port); in intel_hpd_irq_handler()
519 if (dev_priv->display.hotplug.stats[pin].state == HPD_DISABLED) { in intel_hpd_irq_handler()
526 drm_WARN_ONCE(&dev_priv->drm, !HAS_GMCH(dev_priv), in intel_hpd_irq_handler()
527 "Received HPD interrupt on pin %d although disabled\n", in intel_hpd_irq_handler()
532 if (dev_priv->display.hotplug.stats[pin].state != HPD_ENABLED) in intel_hpd_irq_handler()
536 * Delegate to ->hpd_pulse() if one of the encoders for this in intel_hpd_irq_handler()
543 dev_priv->display.hotplug.event_bits |= BIT(pin); in intel_hpd_irq_handler()
549 dev_priv->display.hotplug.event_bits &= ~BIT(pin); in intel_hpd_irq_handler()
561 spin_unlock(&dev_priv->irq_lock); in intel_hpd_irq_handler()
565 * fb helpers). Hence it must not be run on our own dev-priv->wq work in intel_hpd_irq_handler()
570 queue_work(dev_priv->display.hotplug.dp_wq, &dev_priv->display.hotplug.dig_port_work); in intel_hpd_irq_handler()
572 queue_delayed_work(system_wq, &dev_priv->display.hotplug.hotplug_work, 0); in intel_hpd_irq_handler()
576 * intel_hpd_init - initializes and enables hpd support
597 dev_priv->display.hotplug.stats[i].count = 0; in intel_hpd_init()
598 dev_priv->display.hotplug.stats[i].state = HPD_ENABLED; in intel_hpd_init()
602 * Interrupt setup is already guaranteed to be single-threaded, this is in intel_hpd_init()
605 spin_lock_irq(&dev_priv->irq_lock); in intel_hpd_init()
607 spin_unlock_irq(&dev_priv->irq_lock); in intel_hpd_init()
615 struct drm_device *dev = &dev_priv->drm; in i915_hpd_poll_init_work()
620 mutex_lock(&dev->mode_config.mutex); in i915_hpd_poll_init_work()
622 enabled = READ_ONCE(dev_priv->display.hotplug.poll_enabled); in i915_hpd_poll_init_work()
632 connector->base.polled = connector->polled; in i915_hpd_poll_init_work()
634 if (enabled && connector->base.polled == DRM_CONNECTOR_POLL_HPD) in i915_hpd_poll_init_work()
635 connector->base.polled = DRM_CONNECTOR_POLL_CONNECT | in i915_hpd_poll_init_work()
643 mutex_unlock(&dev->mode_config.mutex); in i915_hpd_poll_init_work()
654 * intel_hpd_poll_enable - enable polling for connectors with hpd
657 * This function enables polling for all connectors which support HPD.
658 * Under certain conditions HPD may not be functional. On most Intel GPUs,
664 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
675 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, true); in intel_hpd_poll_enable()
678 * We might already be holding dev->mode_config.mutex, so do this in a in intel_hpd_poll_enable()
680 * As well, there's no issue if we race here since we always reschedule in intel_hpd_poll_enable()
683 schedule_work(&dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_enable()
687 * intel_hpd_poll_disable - disable polling for connectors with hpd
690 * This function disables polling for all connectors which support HPD.
691 * Under certain conditions HPD may not be functional. On most Intel GPUs,
697 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
700 * Also used during driver init to initialize connector->polled
710 WRITE_ONCE(dev_priv->display.hotplug.poll_enabled, false); in intel_hpd_poll_disable()
711 schedule_work(&dev_priv->display.hotplug.poll_init_work); in intel_hpd_poll_disable()
716 INIT_DELAYED_WORK(&dev_priv->display.hotplug.hotplug_work, in intel_hpd_init_work()
718 INIT_WORK(&dev_priv->display.hotplug.dig_port_work, i915_digport_work_func); in intel_hpd_init_work()
719 INIT_WORK(&dev_priv->display.hotplug.poll_init_work, i915_hpd_poll_init_work); in intel_hpd_init_work()
720 INIT_DELAYED_WORK(&dev_priv->display.hotplug.reenable_work, in intel_hpd_init_work()
729 spin_lock_irq(&dev_priv->irq_lock); in intel_hpd_cancel_work()
731 dev_priv->display.hotplug.long_port_mask = 0; in intel_hpd_cancel_work()
732 dev_priv->display.hotplug.short_port_mask = 0; in intel_hpd_cancel_work()
733 dev_priv->display.hotplug.event_bits = 0; in intel_hpd_cancel_work()
734 dev_priv->display.hotplug.retry_bits = 0; in intel_hpd_cancel_work()
736 spin_unlock_irq(&dev_priv->irq_lock); in intel_hpd_cancel_work()
738 cancel_work_sync(&dev_priv->display.hotplug.dig_port_work); in intel_hpd_cancel_work()
739 cancel_delayed_work_sync(&dev_priv->display.hotplug.hotplug_work); in intel_hpd_cancel_work()
740 cancel_work_sync(&dev_priv->display.hotplug.poll_init_work); in intel_hpd_cancel_work()
741 cancel_delayed_work_sync(&dev_priv->display.hotplug.reenable_work); in intel_hpd_cancel_work()
751 spin_lock_irq(&dev_priv->irq_lock); in intel_hpd_disable()
752 if (dev_priv->display.hotplug.stats[pin].state == HPD_ENABLED) { in intel_hpd_disable()
753 dev_priv->display.hotplug.stats[pin].state = HPD_DISABLED; in intel_hpd_disable()
756 spin_unlock_irq(&dev_priv->irq_lock); in intel_hpd_disable()
766 spin_lock_irq(&dev_priv->irq_lock); in intel_hpd_enable()
767 dev_priv->display.hotplug.stats[pin].state = HPD_ENABLED; in intel_hpd_enable()
768 spin_unlock_irq(&dev_priv->irq_lock); in intel_hpd_enable()