drm/msm/hdmi: Enable HPD after HDMI IRQ is set up
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / intel_hotplug.c
blob9a801813023728e2e0a05bb5feba1f8415eb3269
1 /*
2 * Copyright © 2015 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
24 #include <linux/kernel.h>
26 #include <drm/drmP.h>
27 #include <drm/i915_drm.h>
29 #include "i915_drv.h"
30 #include "intel_drv.h"
32 /**
33 * DOC: Hotplug
35 * Simply put, hotplug occurs when a display is connected to or disconnected
36 * from the system. However, there may be adapters and docking stations and
37 * Display Port short pulses and MST devices involved, complicating matters.
39 * Hotplug in i915 is handled in many different levels of abstraction.
41 * The platform dependent interrupt handling code in i915_irq.c enables,
42 * disables, and does preliminary handling of the interrupts. The interrupt
43 * handlers gather the hotplug detect (HPD) information from relevant registers
44 * into a platform independent mask of hotplug pins that have fired.
46 * The platform independent interrupt handler intel_hpd_irq_handler() in
47 * intel_hotplug.c does hotplug irq storm detection and mitigation, and passes
48 * further processing to appropriate bottom halves (Display Port specific and
49 * regular hotplug).
51 * The Display Port work function i915_digport_work_func() calls into
52 * intel_dp_hpd_pulse() via hooks, which handles DP short pulses and DP MST long
53 * pulses, with failures and non-MST long pulses triggering regular hotplug
54 * processing on the connector.
56 * The regular hotplug work function i915_hotplug_work_func() calls connector
57 * detect hooks, and, if connector status changes, triggers sending of hotplug
58 * uevent to userspace via drm_kms_helper_hotplug_event().
60 * Finally, the userspace is responsible for triggering a modeset upon receiving
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
65 * of interrupts exceeds a certain threshold, the interrupt is disabled for a
66 * while before being re-enabled. The intention is to mitigate issues raising
67 * from broken hardware triggering massive amounts of interrupts and grinding
68 * the system to a halt.
70 * Current implementation expects that hotplug interrupt storm will not be
71 * seen when display port sink is connected, hence on platforms whose DP
72 * callback is handled by i915_digport_work_func reenabling of hpd is not
73 * performed (it was never expected to be disabled in the first place ;) )
74 * this is specific to DP sinks handled by this routine and any other display
75 * such as HDMI or DVI enabled on the same port will have proper logic since
76 * it will use i915_hotplug_work_func where this logic is handled.
79 /**
80 * intel_hpd_pin_default - return default pin associated with certain port.
81 * @dev_priv: private driver data pointer
82 * @port: the hpd port to get associated pin
84 * It is only valid and used by digital port encoder.
86 * Return pin that is associatade with @port and HDP_NONE if no pin is
87 * hard associated with that @port.
89 enum hpd_pin intel_hpd_pin_default(struct drm_i915_private *dev_priv,
90 enum port port)
92 switch (port) {
93 case PORT_A:
94 return HPD_PORT_A;
95 case PORT_B:
96 return HPD_PORT_B;
97 case PORT_C:
98 return HPD_PORT_C;
99 case PORT_D:
100 return HPD_PORT_D;
101 case PORT_E:
102 return HPD_PORT_E;
103 case PORT_F:
104 if (IS_CNL_WITH_PORT_F(dev_priv))
105 return HPD_PORT_E;
106 return HPD_PORT_F;
107 default:
108 MISSING_CASE(port);
109 return HPD_NONE;
113 #define HPD_STORM_DETECT_PERIOD 1000
114 #define HPD_STORM_REENABLE_DELAY (2 * 60 * 1000)
117 * intel_hpd_irq_storm_detect - gather stats and detect HPD irq storm on a pin
118 * @dev_priv: private driver data pointer
119 * @pin: the pin to gather stats on
121 * Gather stats about HPD irqs from the specified @pin, and detect irq
122 * storms. Only the pin specific stats and state are changed, the caller is
123 * responsible for further action.
125 * The number of irqs that are allowed within @HPD_STORM_DETECT_PERIOD is
126 * stored in @dev_priv->hotplug.hpd_storm_threshold which defaults to
127 * @HPD_STORM_DEFAULT_THRESHOLD. If this threshold is exceeded, it's
128 * considered an irq storm and the irq state is set to @HPD_MARK_DISABLED.
130 * The HPD threshold can be controlled through i915_hpd_storm_ctl in debugfs,
131 * and should only be adjusted for automated hotplug testing.
133 * Return true if an irq storm was detected on @pin.
135 static bool intel_hpd_irq_storm_detect(struct drm_i915_private *dev_priv,
136 enum hpd_pin pin)
138 unsigned long start = dev_priv->hotplug.stats[pin].last_jiffies;
139 unsigned long end = start + msecs_to_jiffies(HPD_STORM_DETECT_PERIOD);
140 const int threshold = dev_priv->hotplug.hpd_storm_threshold;
141 bool storm = false;
143 if (!time_in_range(jiffies, start, end)) {
144 dev_priv->hotplug.stats[pin].last_jiffies = jiffies;
145 dev_priv->hotplug.stats[pin].count = 0;
146 DRM_DEBUG_KMS("Received HPD interrupt on PIN %d - cnt: 0\n", pin);
147 } else if (dev_priv->hotplug.stats[pin].count > threshold &&
148 threshold) {
149 dev_priv->hotplug.stats[pin].state = HPD_MARK_DISABLED;
150 DRM_DEBUG_KMS("HPD interrupt storm detected on PIN %d\n", pin);
151 storm = true;
152 } else {
153 dev_priv->hotplug.stats[pin].count++;
154 DRM_DEBUG_KMS("Received HPD interrupt on PIN %d - cnt: %d\n", pin,
155 dev_priv->hotplug.stats[pin].count);
158 return storm;
161 static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv)
163 struct drm_device *dev = &dev_priv->drm;
164 struct intel_connector *intel_connector;
165 struct intel_encoder *intel_encoder;
166 struct drm_connector *connector;
167 struct drm_connector_list_iter conn_iter;
168 enum hpd_pin pin;
169 bool hpd_disabled = false;
171 lockdep_assert_held(&dev_priv->irq_lock);
173 drm_connector_list_iter_begin(dev, &conn_iter);
174 drm_for_each_connector_iter(connector, &conn_iter) {
175 if (connector->polled != DRM_CONNECTOR_POLL_HPD)
176 continue;
178 intel_connector = to_intel_connector(connector);
179 intel_encoder = intel_connector->encoder;
180 if (!intel_encoder)
181 continue;
183 pin = intel_encoder->hpd_pin;
184 if (pin == HPD_NONE ||
185 dev_priv->hotplug.stats[pin].state != HPD_MARK_DISABLED)
186 continue;
188 DRM_INFO("HPD interrupt storm detected on connector %s: "
189 "switching from hotplug detection to polling\n",
190 connector->name);
192 dev_priv->hotplug.stats[pin].state = HPD_DISABLED;
193 connector->polled = DRM_CONNECTOR_POLL_CONNECT
194 | DRM_CONNECTOR_POLL_DISCONNECT;
195 hpd_disabled = true;
197 drm_connector_list_iter_end(&conn_iter);
199 /* Enable polling and queue hotplug re-enabling. */
200 if (hpd_disabled) {
201 drm_kms_helper_poll_enable(dev);
202 mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work,
203 msecs_to_jiffies(HPD_STORM_REENABLE_DELAY));
207 static void intel_hpd_irq_storm_reenable_work(struct work_struct *work)
209 struct drm_i915_private *dev_priv =
210 container_of(work, typeof(*dev_priv),
211 hotplug.reenable_work.work);
212 struct drm_device *dev = &dev_priv->drm;
213 enum hpd_pin pin;
215 intel_runtime_pm_get(dev_priv);
217 spin_lock_irq(&dev_priv->irq_lock);
218 for_each_hpd_pin(pin) {
219 struct drm_connector *connector;
220 struct drm_connector_list_iter conn_iter;
222 if (dev_priv->hotplug.stats[pin].state != HPD_DISABLED)
223 continue;
225 dev_priv->hotplug.stats[pin].state = HPD_ENABLED;
227 drm_connector_list_iter_begin(dev, &conn_iter);
228 drm_for_each_connector_iter(connector, &conn_iter) {
229 struct intel_connector *intel_connector = to_intel_connector(connector);
231 /* Don't check MST ports, they don't have pins */
232 if (!intel_connector->mst_port &&
233 intel_connector->encoder->hpd_pin == pin) {
234 if (connector->polled != intel_connector->polled)
235 DRM_DEBUG_DRIVER("Reenabling HPD on connector %s\n",
236 connector->name);
237 connector->polled = intel_connector->polled;
238 if (!connector->polled)
239 connector->polled = DRM_CONNECTOR_POLL_HPD;
242 drm_connector_list_iter_end(&conn_iter);
244 if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup)
245 dev_priv->display.hpd_irq_setup(dev_priv);
246 spin_unlock_irq(&dev_priv->irq_lock);
248 intel_runtime_pm_put(dev_priv);
251 bool intel_encoder_hotplug(struct intel_encoder *encoder,
252 struct intel_connector *connector)
254 struct drm_device *dev = connector->base.dev;
255 enum drm_connector_status old_status;
257 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
258 old_status = connector->base.status;
260 connector->base.status =
261 drm_helper_probe_detect(&connector->base, NULL, false);
263 if (old_status == connector->base.status)
264 return false;
266 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
267 connector->base.base.id,
268 connector->base.name,
269 drm_get_connector_status_name(old_status),
270 drm_get_connector_status_name(connector->base.status));
272 return true;
275 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
277 return intel_encoder_is_dig_port(encoder) &&
278 enc_to_dig_port(&encoder->base)->hpd_pulse != NULL;
281 static void i915_digport_work_func(struct work_struct *work)
283 struct drm_i915_private *dev_priv =
284 container_of(work, struct drm_i915_private, hotplug.dig_port_work);
285 u32 long_port_mask, short_port_mask;
286 struct intel_encoder *encoder;
287 u32 old_bits = 0;
289 spin_lock_irq(&dev_priv->irq_lock);
290 long_port_mask = dev_priv->hotplug.long_port_mask;
291 dev_priv->hotplug.long_port_mask = 0;
292 short_port_mask = dev_priv->hotplug.short_port_mask;
293 dev_priv->hotplug.short_port_mask = 0;
294 spin_unlock_irq(&dev_priv->irq_lock);
296 for_each_intel_encoder(&dev_priv->drm, encoder) {
297 struct intel_digital_port *dig_port;
298 enum port port = encoder->port;
299 bool long_hpd, short_hpd;
300 enum irqreturn ret;
302 if (!intel_encoder_has_hpd_pulse(encoder))
303 continue;
305 long_hpd = long_port_mask & BIT(port);
306 short_hpd = short_port_mask & BIT(port);
308 if (!long_hpd && !short_hpd)
309 continue;
311 dig_port = enc_to_dig_port(&encoder->base);
313 ret = dig_port->hpd_pulse(dig_port, long_hpd);
314 if (ret == IRQ_NONE) {
315 /* fall back to old school hpd */
316 old_bits |= BIT(encoder->hpd_pin);
320 if (old_bits) {
321 spin_lock_irq(&dev_priv->irq_lock);
322 dev_priv->hotplug.event_bits |= old_bits;
323 spin_unlock_irq(&dev_priv->irq_lock);
324 schedule_work(&dev_priv->hotplug.hotplug_work);
329 * Handle hotplug events outside the interrupt handler proper.
331 static void i915_hotplug_work_func(struct work_struct *work)
333 struct drm_i915_private *dev_priv =
334 container_of(work, struct drm_i915_private, hotplug.hotplug_work);
335 struct drm_device *dev = &dev_priv->drm;
336 struct intel_connector *intel_connector;
337 struct intel_encoder *intel_encoder;
338 struct drm_connector *connector;
339 struct drm_connector_list_iter conn_iter;
340 bool changed = false;
341 u32 hpd_event_bits;
343 mutex_lock(&dev->mode_config.mutex);
344 DRM_DEBUG_KMS("running encoder hotplug functions\n");
346 spin_lock_irq(&dev_priv->irq_lock);
348 hpd_event_bits = dev_priv->hotplug.event_bits;
349 dev_priv->hotplug.event_bits = 0;
351 /* Disable hotplug on connectors that hit an irq storm. */
352 intel_hpd_irq_storm_disable(dev_priv);
354 spin_unlock_irq(&dev_priv->irq_lock);
356 drm_connector_list_iter_begin(dev, &conn_iter);
357 drm_for_each_connector_iter(connector, &conn_iter) {
358 intel_connector = to_intel_connector(connector);
359 if (!intel_connector->encoder)
360 continue;
361 intel_encoder = intel_connector->encoder;
362 if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
363 DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
364 connector->name, intel_encoder->hpd_pin);
366 changed |= intel_encoder->hotplug(intel_encoder,
367 intel_connector);
370 drm_connector_list_iter_end(&conn_iter);
371 mutex_unlock(&dev->mode_config.mutex);
373 if (changed)
374 drm_kms_helper_hotplug_event(dev);
379 * intel_hpd_irq_handler - main hotplug irq handler
380 * @dev_priv: drm_i915_private
381 * @pin_mask: a mask of hpd pins that have triggered the irq
382 * @long_mask: a mask of hpd pins that may be long hpd pulses
384 * This is the main hotplug irq handler for all platforms. The platform specific
385 * irq handlers call the platform specific hotplug irq handlers, which read and
386 * decode the appropriate registers into bitmasks about hpd pins that have
387 * triggered (@pin_mask), and which of those pins may be long pulses
388 * (@long_mask). The @long_mask is ignored if the port corresponding to the pin
389 * is not a digital port.
391 * Here, we do hotplug irq storm detection and mitigation, and pass further
392 * processing to appropriate bottom halves.
394 void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
395 u32 pin_mask, u32 long_mask)
397 struct intel_encoder *encoder;
398 bool storm_detected = false;
399 bool queue_dig = false, queue_hp = false;
400 u32 long_hpd_pulse_mask = 0;
401 u32 short_hpd_pulse_mask = 0;
402 enum hpd_pin pin;
404 if (!pin_mask)
405 return;
407 spin_lock(&dev_priv->irq_lock);
410 * Determine whether ->hpd_pulse() exists for each pin, and
411 * whether we have a short or a long pulse. This is needed
412 * as each pin may have up to two encoders (HDMI and DP) and
413 * only the one of them (DP) will have ->hpd_pulse().
415 for_each_intel_encoder(&dev_priv->drm, encoder) {
416 bool has_hpd_pulse = intel_encoder_has_hpd_pulse(encoder);
417 enum port port = encoder->port;
418 bool long_hpd;
420 pin = encoder->hpd_pin;
421 if (!(BIT(pin) & pin_mask))
422 continue;
424 if (!has_hpd_pulse)
425 continue;
427 long_hpd = long_mask & BIT(pin);
429 DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port),
430 long_hpd ? "long" : "short");
431 queue_dig = true;
433 if (long_hpd) {
434 long_hpd_pulse_mask |= BIT(pin);
435 dev_priv->hotplug.long_port_mask |= BIT(port);
436 } else {
437 short_hpd_pulse_mask |= BIT(pin);
438 dev_priv->hotplug.short_port_mask |= BIT(port);
442 /* Now process each pin just once */
443 for_each_hpd_pin(pin) {
444 bool long_hpd;
446 if (!(BIT(pin) & pin_mask))
447 continue;
449 if (dev_priv->hotplug.stats[pin].state == HPD_DISABLED) {
451 * On GMCH platforms the interrupt mask bits only
452 * prevent irq generation, not the setting of the
453 * hotplug bits itself. So only WARN about unexpected
454 * interrupts on saner platforms.
456 WARN_ONCE(!HAS_GMCH_DISPLAY(dev_priv),
457 "Received HPD interrupt on pin %d although disabled\n", pin);
458 continue;
461 if (dev_priv->hotplug.stats[pin].state != HPD_ENABLED)
462 continue;
465 * Delegate to ->hpd_pulse() if one of the encoders for this
466 * pin has it, otherwise let the hotplug_work deal with this
467 * pin directly.
469 if (((short_hpd_pulse_mask | long_hpd_pulse_mask) & BIT(pin))) {
470 long_hpd = long_hpd_pulse_mask & BIT(pin);
471 } else {
472 dev_priv->hotplug.event_bits |= BIT(pin);
473 long_hpd = true;
474 queue_hp = true;
477 if (!long_hpd)
478 continue;
480 if (intel_hpd_irq_storm_detect(dev_priv, pin)) {
481 dev_priv->hotplug.event_bits &= ~BIT(pin);
482 storm_detected = true;
486 if (storm_detected && dev_priv->display_irqs_enabled)
487 dev_priv->display.hpd_irq_setup(dev_priv);
488 spin_unlock(&dev_priv->irq_lock);
491 * Our hotplug handler can grab modeset locks (by calling down into the
492 * fb helpers). Hence it must not be run on our own dev-priv->wq work
493 * queue for otherwise the flush_work in the pageflip code will
494 * deadlock.
496 if (queue_dig)
497 queue_work(dev_priv->hotplug.dp_wq, &dev_priv->hotplug.dig_port_work);
498 if (queue_hp)
499 schedule_work(&dev_priv->hotplug.hotplug_work);
503 * intel_hpd_init - initializes and enables hpd support
504 * @dev_priv: i915 device instance
506 * This function enables the hotplug support. It requires that interrupts have
507 * already been enabled with intel_irq_init_hw(). From this point on hotplug and
508 * poll request can run concurrently to other code, so locking rules must be
509 * obeyed.
511 * This is a separate step from interrupt enabling to simplify the locking rules
512 * in the driver load and resume code.
514 * Also see: intel_hpd_poll_init(), which enables connector polling
516 void intel_hpd_init(struct drm_i915_private *dev_priv)
518 int i;
520 for_each_hpd_pin(i) {
521 dev_priv->hotplug.stats[i].count = 0;
522 dev_priv->hotplug.stats[i].state = HPD_ENABLED;
525 WRITE_ONCE(dev_priv->hotplug.poll_enabled, false);
526 schedule_work(&dev_priv->hotplug.poll_init_work);
529 * Interrupt setup is already guaranteed to be single-threaded, this is
530 * just to make the assert_spin_locked checks happy.
532 if (dev_priv->display_irqs_enabled && dev_priv->display.hpd_irq_setup) {
533 spin_lock_irq(&dev_priv->irq_lock);
534 if (dev_priv->display_irqs_enabled)
535 dev_priv->display.hpd_irq_setup(dev_priv);
536 spin_unlock_irq(&dev_priv->irq_lock);
540 static void i915_hpd_poll_init_work(struct work_struct *work)
542 struct drm_i915_private *dev_priv =
543 container_of(work, struct drm_i915_private,
544 hotplug.poll_init_work);
545 struct drm_device *dev = &dev_priv->drm;
546 struct drm_connector *connector;
547 struct drm_connector_list_iter conn_iter;
548 bool enabled;
550 mutex_lock(&dev->mode_config.mutex);
552 enabled = READ_ONCE(dev_priv->hotplug.poll_enabled);
554 drm_connector_list_iter_begin(dev, &conn_iter);
555 drm_for_each_connector_iter(connector, &conn_iter) {
556 struct intel_connector *intel_connector =
557 to_intel_connector(connector);
558 connector->polled = intel_connector->polled;
560 /* MST has a dynamic intel_connector->encoder and it's reprobing
561 * is all handled by the MST helpers. */
562 if (intel_connector->mst_port)
563 continue;
565 if (!connector->polled && I915_HAS_HOTPLUG(dev_priv) &&
566 intel_connector->encoder->hpd_pin > HPD_NONE) {
567 connector->polled = enabled ?
568 DRM_CONNECTOR_POLL_CONNECT |
569 DRM_CONNECTOR_POLL_DISCONNECT :
570 DRM_CONNECTOR_POLL_HPD;
573 drm_connector_list_iter_end(&conn_iter);
575 if (enabled)
576 drm_kms_helper_poll_enable(dev);
578 mutex_unlock(&dev->mode_config.mutex);
581 * We might have missed any hotplugs that happened while we were
582 * in the middle of disabling polling
584 if (!enabled)
585 drm_helper_hpd_irq_event(dev);
589 * intel_hpd_poll_init - enables/disables polling for connectors with hpd
590 * @dev_priv: i915 device instance
592 * This function enables polling for all connectors, regardless of whether or
593 * not they support hotplug detection. Under certain conditions HPD may not be
594 * functional. On most Intel GPUs, this happens when we enter runtime suspend.
595 * On Valleyview and Cherryview systems, this also happens when we shut off all
596 * of the powerwells.
598 * Since this function can get called in contexts where we're already holding
599 * dev->mode_config.mutex, we do the actual hotplug enabling in a seperate
600 * worker.
602 * Also see: intel_hpd_init(), which restores hpd handling.
604 void intel_hpd_poll_init(struct drm_i915_private *dev_priv)
606 WRITE_ONCE(dev_priv->hotplug.poll_enabled, true);
609 * We might already be holding dev->mode_config.mutex, so do this in a
610 * seperate worker
611 * As well, there's no issue if we race here since we always reschedule
612 * this worker anyway
614 schedule_work(&dev_priv->hotplug.poll_init_work);
617 void intel_hpd_init_work(struct drm_i915_private *dev_priv)
619 INIT_WORK(&dev_priv->hotplug.hotplug_work, i915_hotplug_work_func);
620 INIT_WORK(&dev_priv->hotplug.dig_port_work, i915_digport_work_func);
621 INIT_WORK(&dev_priv->hotplug.poll_init_work, i915_hpd_poll_init_work);
622 INIT_DELAYED_WORK(&dev_priv->hotplug.reenable_work,
623 intel_hpd_irq_storm_reenable_work);
626 void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
628 spin_lock_irq(&dev_priv->irq_lock);
630 dev_priv->hotplug.long_port_mask = 0;
631 dev_priv->hotplug.short_port_mask = 0;
632 dev_priv->hotplug.event_bits = 0;
634 spin_unlock_irq(&dev_priv->irq_lock);
636 cancel_work_sync(&dev_priv->hotplug.dig_port_work);
637 cancel_work_sync(&dev_priv->hotplug.hotplug_work);
638 cancel_work_sync(&dev_priv->hotplug.poll_init_work);
639 cancel_delayed_work_sync(&dev_priv->hotplug.reenable_work);
642 bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin)
644 bool ret = false;
646 if (pin == HPD_NONE)
647 return false;
649 spin_lock_irq(&dev_priv->irq_lock);
650 if (dev_priv->hotplug.stats[pin].state == HPD_ENABLED) {
651 dev_priv->hotplug.stats[pin].state = HPD_DISABLED;
652 ret = true;
654 spin_unlock_irq(&dev_priv->irq_lock);
656 return ret;
659 void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin)
661 if (pin == HPD_NONE)
662 return;
664 spin_lock_irq(&dev_priv->irq_lock);
665 dev_priv->hotplug.stats[pin].state = HPD_ENABLED;
666 spin_unlock_irq(&dev_priv->irq_lock);