diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2014-09-04 07:54:56 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-04 08:55:45 -0400 |
commit | 773538e86081d146e0020435d614f4b96996c1f9 (patch) | |
tree | a66261d8da4c2221de3ef6082c9a04f42e94a82b | |
parent | a4a5d2f8a96e09844a91469e889f15bd5e927399 (diff) |
drm/i915: Reset power sequencer pipe tracking when disp2d is off
The power sequencer loses its state when the disp2d power well is down.
Clear the dev_priv->pps_pipe tracking so that the power sequencer state
gets reinitialized the next time it's needed.
v2: Fix the pps_mutex vs. power_domain mutex deadlock by taking power
domain reference first
v3: Rename from edp_pps_(un)lock() to just pps_(un)lock() for the future,
update due to backlight code changes
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 161 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_pm.c | 2 |
3 files changed, 107 insertions, 57 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index ef6a0a5088fd..83d2f76cf3e2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -290,6 +290,38 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, | |||
290 | struct intel_dp *intel_dp, | 290 | struct intel_dp *intel_dp, |
291 | struct edp_power_seq *out); | 291 | struct edp_power_seq *out); |
292 | 292 | ||
293 | static void pps_lock(struct intel_dp *intel_dp) | ||
294 | { | ||
295 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
296 | struct intel_encoder *encoder = &intel_dig_port->base; | ||
297 | struct drm_device *dev = encoder->base.dev; | ||
298 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
299 | enum intel_display_power_domain power_domain; | ||
300 | |||
301 | /* | ||
302 | * See vlv_power_sequencer_reset() why we need | ||
303 | * a power domain reference here. | ||
304 | */ | ||
305 | power_domain = intel_display_port_power_domain(encoder); | ||
306 | intel_display_power_get(dev_priv, power_domain); | ||
307 | |||
308 | mutex_lock(&dev_priv->pps_mutex); | ||
309 | } | ||
310 | |||
311 | static void pps_unlock(struct intel_dp *intel_dp) | ||
312 | { | ||
313 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
314 | struct intel_encoder *encoder = &intel_dig_port->base; | ||
315 | struct drm_device *dev = encoder->base.dev; | ||
316 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
317 | enum intel_display_power_domain power_domain; | ||
318 | |||
319 | mutex_unlock(&dev_priv->pps_mutex); | ||
320 | |||
321 | power_domain = intel_display_port_power_domain(encoder); | ||
322 | intel_display_power_put(dev_priv, power_domain); | ||
323 | } | ||
324 | |||
293 | static enum pipe | 325 | static enum pipe |
294 | vlv_power_sequencer_pipe(struct intel_dp *intel_dp) | 326 | vlv_power_sequencer_pipe(struct intel_dp *intel_dp) |
295 | { | 327 | { |
@@ -391,6 +423,35 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) | |||
391 | &power_seq); | 423 | &power_seq); |
392 | } | 424 | } |
393 | 425 | ||
426 | void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv) | ||
427 | { | ||
428 | struct drm_device *dev = dev_priv->dev; | ||
429 | struct intel_encoder *encoder; | ||
430 | |||
431 | if (WARN_ON(!IS_VALLEYVIEW(dev))) | ||
432 | return; | ||
433 | |||
434 | /* | ||
435 | * We can't grab pps_mutex here due to deadlock with power_domain | ||
436 | * mutex when power_domain functions are called while holding pps_mutex. | ||
437 | * That also means that in order to use pps_pipe the code needs to | ||
438 | * hold both a power domain reference and pps_mutex, and the power domain | ||
439 | * reference get/put must be done while _not_ holding pps_mutex. | ||
440 | * pps_{lock,unlock}() do these steps in the correct order, so one | ||
441 | * should use them always. | ||
442 | */ | ||
443 | |||
444 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head) { | ||
445 | struct intel_dp *intel_dp; | ||
446 | |||
447 | if (encoder->type != INTEL_OUTPUT_EDP) | ||
448 | continue; | ||
449 | |||
450 | intel_dp = enc_to_intel_dp(&encoder->base); | ||
451 | intel_dp->pps_pipe = INVALID_PIPE; | ||
452 | } | ||
453 | } | ||
454 | |||
394 | static u32 _pp_ctrl_reg(struct intel_dp *intel_dp) | 455 | static u32 _pp_ctrl_reg(struct intel_dp *intel_dp) |
395 | { | 456 | { |
396 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 457 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
@@ -426,7 +487,7 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code, | |||
426 | if (!is_edp(intel_dp) || code != SYS_RESTART) | 487 | if (!is_edp(intel_dp) || code != SYS_RESTART) |
427 | return 0; | 488 | return 0; |
428 | 489 | ||
429 | mutex_lock(&dev_priv->pps_mutex); | 490 | pps_lock(intel_dp); |
430 | 491 | ||
431 | if (IS_VALLEYVIEW(dev)) { | 492 | if (IS_VALLEYVIEW(dev)) { |
432 | enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); | 493 | enum pipe pipe = vlv_power_sequencer_pipe(intel_dp); |
@@ -442,7 +503,7 @@ static int edp_notify_handler(struct notifier_block *this, unsigned long code, | |||
442 | msleep(intel_dp->panel_power_cycle_delay); | 503 | msleep(intel_dp->panel_power_cycle_delay); |
443 | } | 504 | } |
444 | 505 | ||
445 | mutex_unlock(&dev_priv->pps_mutex); | 506 | pps_unlock(intel_dp); |
446 | 507 | ||
447 | return 0; | 508 | return 0; |
448 | } | 509 | } |
@@ -461,15 +522,10 @@ static bool edp_have_panel_vdd(struct intel_dp *intel_dp) | |||
461 | { | 522 | { |
462 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | 523 | struct drm_device *dev = intel_dp_to_dev(intel_dp); |
463 | struct drm_i915_private *dev_priv = dev->dev_private; | 524 | struct drm_i915_private *dev_priv = dev->dev_private; |
464 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
465 | struct intel_encoder *intel_encoder = &intel_dig_port->base; | ||
466 | enum intel_display_power_domain power_domain; | ||
467 | 525 | ||
468 | lockdep_assert_held(&dev_priv->pps_mutex); | 526 | lockdep_assert_held(&dev_priv->pps_mutex); |
469 | 527 | ||
470 | power_domain = intel_display_port_power_domain(intel_encoder); | 528 | return I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD; |
471 | return intel_display_power_enabled(dev_priv, power_domain) && | ||
472 | (I915_READ(_pp_ctrl_reg(intel_dp)) & EDP_FORCE_VDD) != 0; | ||
473 | } | 529 | } |
474 | 530 | ||
475 | static void | 531 | static void |
@@ -617,7 +673,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
617 | bool has_aux_irq = HAS_AUX_IRQ(dev); | 673 | bool has_aux_irq = HAS_AUX_IRQ(dev); |
618 | bool vdd; | 674 | bool vdd; |
619 | 675 | ||
620 | mutex_lock(&dev_priv->pps_mutex); | 676 | pps_lock(intel_dp); |
621 | 677 | ||
622 | /* | 678 | /* |
623 | * We will be called with VDD already enabled for dpcd/edid/oui reads. | 679 | * We will be called with VDD already enabled for dpcd/edid/oui reads. |
@@ -734,7 +790,7 @@ out: | |||
734 | if (vdd) | 790 | if (vdd) |
735 | edp_panel_vdd_off(intel_dp, false); | 791 | edp_panel_vdd_off(intel_dp, false); |
736 | 792 | ||
737 | mutex_unlock(&dev_priv->pps_mutex); | 793 | pps_unlock(intel_dp); |
738 | 794 | ||
739 | return ret; | 795 | return ret; |
740 | } | 796 | } |
@@ -1315,16 +1371,14 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) | |||
1315 | 1371 | ||
1316 | void intel_edp_panel_vdd_on(struct intel_dp *intel_dp) | 1372 | void intel_edp_panel_vdd_on(struct intel_dp *intel_dp) |
1317 | { | 1373 | { |
1318 | struct drm_i915_private *dev_priv = | ||
1319 | intel_dp_to_dev(intel_dp)->dev_private; | ||
1320 | bool vdd; | 1374 | bool vdd; |
1321 | 1375 | ||
1322 | if (!is_edp(intel_dp)) | 1376 | if (!is_edp(intel_dp)) |
1323 | return; | 1377 | return; |
1324 | 1378 | ||
1325 | mutex_lock(&dev_priv->pps_mutex); | 1379 | pps_lock(intel_dp); |
1326 | vdd = edp_panel_vdd_on(intel_dp); | 1380 | vdd = edp_panel_vdd_on(intel_dp); |
1327 | mutex_unlock(&dev_priv->pps_mutex); | 1381 | pps_unlock(intel_dp); |
1328 | 1382 | ||
1329 | WARN(!vdd, "eDP VDD already requested on\n"); | 1383 | WARN(!vdd, "eDP VDD already requested on\n"); |
1330 | } | 1384 | } |
@@ -1373,13 +1427,11 @@ static void edp_panel_vdd_work(struct work_struct *__work) | |||
1373 | { | 1427 | { |
1374 | struct intel_dp *intel_dp = container_of(to_delayed_work(__work), | 1428 | struct intel_dp *intel_dp = container_of(to_delayed_work(__work), |
1375 | struct intel_dp, panel_vdd_work); | 1429 | struct intel_dp, panel_vdd_work); |
1376 | struct drm_i915_private *dev_priv = | ||
1377 | intel_dp_to_dev(intel_dp)->dev_private; | ||
1378 | 1430 | ||
1379 | mutex_lock(&dev_priv->pps_mutex); | 1431 | pps_lock(intel_dp); |
1380 | if (!intel_dp->want_panel_vdd) | 1432 | if (!intel_dp->want_panel_vdd) |
1381 | edp_panel_vdd_off_sync(intel_dp); | 1433 | edp_panel_vdd_off_sync(intel_dp); |
1382 | mutex_unlock(&dev_priv->pps_mutex); | 1434 | pps_unlock(intel_dp); |
1383 | } | 1435 | } |
1384 | 1436 | ||
1385 | static void edp_panel_vdd_schedule_off(struct intel_dp *intel_dp) | 1437 | static void edp_panel_vdd_schedule_off(struct intel_dp *intel_dp) |
@@ -1417,15 +1469,12 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | |||
1417 | 1469 | ||
1418 | static void intel_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) | 1470 | static void intel_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) |
1419 | { | 1471 | { |
1420 | struct drm_i915_private *dev_priv = | ||
1421 | intel_dp_to_dev(intel_dp)->dev_private; | ||
1422 | |||
1423 | if (!is_edp(intel_dp)) | 1472 | if (!is_edp(intel_dp)) |
1424 | return; | 1473 | return; |
1425 | 1474 | ||
1426 | mutex_lock(&dev_priv->pps_mutex); | 1475 | pps_lock(intel_dp); |
1427 | edp_panel_vdd_off(intel_dp, sync); | 1476 | edp_panel_vdd_off(intel_dp, sync); |
1428 | mutex_unlock(&dev_priv->pps_mutex); | 1477 | pps_unlock(intel_dp); |
1429 | } | 1478 | } |
1430 | 1479 | ||
1431 | void intel_edp_panel_on(struct intel_dp *intel_dp) | 1480 | void intel_edp_panel_on(struct intel_dp *intel_dp) |
@@ -1440,7 +1489,7 @@ void intel_edp_panel_on(struct intel_dp *intel_dp) | |||
1440 | 1489 | ||
1441 | DRM_DEBUG_KMS("Turn eDP power on\n"); | 1490 | DRM_DEBUG_KMS("Turn eDP power on\n"); |
1442 | 1491 | ||
1443 | mutex_lock(&dev_priv->pps_mutex); | 1492 | pps_lock(intel_dp); |
1444 | 1493 | ||
1445 | if (edp_have_panel_power(intel_dp)) { | 1494 | if (edp_have_panel_power(intel_dp)) { |
1446 | DRM_DEBUG_KMS("eDP power already on\n"); | 1495 | DRM_DEBUG_KMS("eDP power already on\n"); |
@@ -1475,7 +1524,7 @@ void intel_edp_panel_on(struct intel_dp *intel_dp) | |||
1475 | } | 1524 | } |
1476 | 1525 | ||
1477 | out: | 1526 | out: |
1478 | mutex_unlock(&dev_priv->pps_mutex); | 1527 | pps_unlock(intel_dp); |
1479 | } | 1528 | } |
1480 | 1529 | ||
1481 | void intel_edp_panel_off(struct intel_dp *intel_dp) | 1530 | void intel_edp_panel_off(struct intel_dp *intel_dp) |
@@ -1493,7 +1542,7 @@ void intel_edp_panel_off(struct intel_dp *intel_dp) | |||
1493 | 1542 | ||
1494 | DRM_DEBUG_KMS("Turn eDP power off\n"); | 1543 | DRM_DEBUG_KMS("Turn eDP power off\n"); |
1495 | 1544 | ||
1496 | mutex_lock(&dev_priv->pps_mutex); | 1545 | pps_lock(intel_dp); |
1497 | 1546 | ||
1498 | WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); | 1547 | WARN(!intel_dp->want_panel_vdd, "Need VDD to turn off panel\n"); |
1499 | 1548 | ||
@@ -1517,7 +1566,7 @@ void intel_edp_panel_off(struct intel_dp *intel_dp) | |||
1517 | power_domain = intel_display_port_power_domain(intel_encoder); | 1566 | power_domain = intel_display_port_power_domain(intel_encoder); |
1518 | intel_display_power_put(dev_priv, power_domain); | 1567 | intel_display_power_put(dev_priv, power_domain); |
1519 | 1568 | ||
1520 | mutex_unlock(&dev_priv->pps_mutex); | 1569 | pps_unlock(intel_dp); |
1521 | } | 1570 | } |
1522 | 1571 | ||
1523 | /* Enable backlight in the panel power control. */ | 1572 | /* Enable backlight in the panel power control. */ |
@@ -1537,7 +1586,7 @@ static void _intel_edp_backlight_on(struct intel_dp *intel_dp) | |||
1537 | */ | 1586 | */ |
1538 | wait_backlight_on(intel_dp); | 1587 | wait_backlight_on(intel_dp); |
1539 | 1588 | ||
1540 | mutex_lock(&dev_priv->pps_mutex); | 1589 | pps_lock(intel_dp); |
1541 | 1590 | ||
1542 | pp = ironlake_get_pp_control(intel_dp); | 1591 | pp = ironlake_get_pp_control(intel_dp); |
1543 | pp |= EDP_BLC_ENABLE; | 1592 | pp |= EDP_BLC_ENABLE; |
@@ -1547,7 +1596,7 @@ static void _intel_edp_backlight_on(struct intel_dp *intel_dp) | |||
1547 | I915_WRITE(pp_ctrl_reg, pp); | 1596 | I915_WRITE(pp_ctrl_reg, pp); |
1548 | POSTING_READ(pp_ctrl_reg); | 1597 | POSTING_READ(pp_ctrl_reg); |
1549 | 1598 | ||
1550 | mutex_unlock(&dev_priv->pps_mutex); | 1599 | pps_unlock(intel_dp); |
1551 | } | 1600 | } |
1552 | 1601 | ||
1553 | /* Enable backlight PWM and backlight PP control. */ | 1602 | /* Enable backlight PWM and backlight PP control. */ |
@@ -1573,7 +1622,7 @@ static void _intel_edp_backlight_off(struct intel_dp *intel_dp) | |||
1573 | if (!is_edp(intel_dp)) | 1622 | if (!is_edp(intel_dp)) |
1574 | return; | 1623 | return; |
1575 | 1624 | ||
1576 | mutex_lock(&dev_priv->pps_mutex); | 1625 | pps_lock(intel_dp); |
1577 | 1626 | ||
1578 | pp = ironlake_get_pp_control(intel_dp); | 1627 | pp = ironlake_get_pp_control(intel_dp); |
1579 | pp &= ~EDP_BLC_ENABLE; | 1628 | pp &= ~EDP_BLC_ENABLE; |
@@ -1583,7 +1632,7 @@ static void _intel_edp_backlight_off(struct intel_dp *intel_dp) | |||
1583 | I915_WRITE(pp_ctrl_reg, pp); | 1632 | I915_WRITE(pp_ctrl_reg, pp); |
1584 | POSTING_READ(pp_ctrl_reg); | 1633 | POSTING_READ(pp_ctrl_reg); |
1585 | 1634 | ||
1586 | mutex_unlock(&dev_priv->pps_mutex); | 1635 | pps_unlock(intel_dp); |
1587 | 1636 | ||
1588 | intel_dp->last_backlight_off = jiffies; | 1637 | intel_dp->last_backlight_off = jiffies; |
1589 | edp_wait_backlight_off(intel_dp); | 1638 | edp_wait_backlight_off(intel_dp); |
@@ -1608,13 +1657,12 @@ void intel_edp_backlight_off(struct intel_dp *intel_dp) | |||
1608 | static void intel_edp_backlight_power(struct intel_connector *connector, | 1657 | static void intel_edp_backlight_power(struct intel_connector *connector, |
1609 | bool enable) | 1658 | bool enable) |
1610 | { | 1659 | { |
1611 | struct drm_i915_private *dev_priv = connector->base.dev->dev_private; | ||
1612 | struct intel_dp *intel_dp = intel_attached_dp(&connector->base); | 1660 | struct intel_dp *intel_dp = intel_attached_dp(&connector->base); |
1613 | bool is_enabled; | 1661 | bool is_enabled; |
1614 | 1662 | ||
1615 | mutex_lock(&dev_priv->pps_mutex); | 1663 | pps_lock(intel_dp); |
1616 | is_enabled = ironlake_get_pp_control(intel_dp) & EDP_BLC_ENABLE; | 1664 | is_enabled = ironlake_get_pp_control(intel_dp) & EDP_BLC_ENABLE; |
1617 | mutex_unlock(&dev_priv->pps_mutex); | 1665 | pps_unlock(intel_dp); |
1618 | 1666 | ||
1619 | if (is_enabled == enable) | 1667 | if (is_enabled == enable) |
1620 | return; | 1668 | return; |
@@ -2339,18 +2387,19 @@ static void vlv_steal_power_sequencer(struct drm_device *dev, | |||
2339 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 2387 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
2340 | base.head) { | 2388 | base.head) { |
2341 | struct intel_dp *intel_dp; | 2389 | struct intel_dp *intel_dp; |
2390 | enum port port; | ||
2342 | 2391 | ||
2343 | if (encoder->type != INTEL_OUTPUT_EDP) | 2392 | if (encoder->type != INTEL_OUTPUT_EDP) |
2344 | continue; | 2393 | continue; |
2345 | 2394 | ||
2346 | intel_dp = enc_to_intel_dp(&encoder->base); | 2395 | intel_dp = enc_to_intel_dp(&encoder->base); |
2396 | port = dp_to_dig_port(intel_dp)->port; | ||
2347 | 2397 | ||
2348 | if (intel_dp->pps_pipe != pipe) | 2398 | if (intel_dp->pps_pipe != pipe) |
2349 | continue; | 2399 | continue; |
2350 | 2400 | ||
2351 | DRM_DEBUG_KMS("stealing pipe %c power sequencer from port %c\n", | 2401 | DRM_DEBUG_KMS("stealing pipe %c power sequencer from port %c\n", |
2352 | pipe_name(pipe), | 2402 | pipe_name(pipe), port_name(port)); |
2353 | port_name(dp_to_dig_port(intel_dp)->port)); | ||
2354 | 2403 | ||
2355 | /* make sure vdd is off before we steal it */ | 2404 | /* make sure vdd is off before we steal it */ |
2356 | edp_panel_vdd_off_sync(intel_dp); | 2405 | edp_panel_vdd_off_sync(intel_dp); |
@@ -2426,9 +2475,9 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder) | |||
2426 | mutex_unlock(&dev_priv->dpio_lock); | 2475 | mutex_unlock(&dev_priv->dpio_lock); |
2427 | 2476 | ||
2428 | if (is_edp(intel_dp)) { | 2477 | if (is_edp(intel_dp)) { |
2429 | mutex_lock(&dev_priv->pps_mutex); | 2478 | pps_lock(intel_dp); |
2430 | vlv_init_panel_power_sequencer(intel_dp); | 2479 | vlv_init_panel_power_sequencer(intel_dp); |
2431 | mutex_unlock(&dev_priv->pps_mutex); | 2480 | pps_unlock(intel_dp); |
2432 | } | 2481 | } |
2433 | 2482 | ||
2434 | intel_enable_dp(encoder); | 2483 | intel_enable_dp(encoder); |
@@ -2517,9 +2566,9 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder) | |||
2517 | mutex_unlock(&dev_priv->dpio_lock); | 2566 | mutex_unlock(&dev_priv->dpio_lock); |
2518 | 2567 | ||
2519 | if (is_edp(intel_dp)) { | 2568 | if (is_edp(intel_dp)) { |
2520 | mutex_lock(&dev_priv->pps_mutex); | 2569 | pps_lock(intel_dp); |
2521 | vlv_init_panel_power_sequencer(intel_dp); | 2570 | vlv_init_panel_power_sequencer(intel_dp); |
2522 | mutex_unlock(&dev_priv->pps_mutex); | 2571 | pps_unlock(intel_dp); |
2523 | } | 2572 | } |
2524 | 2573 | ||
2525 | intel_enable_dp(encoder); | 2574 | intel_enable_dp(encoder); |
@@ -4258,17 +4307,16 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
4258 | { | 4307 | { |
4259 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); | 4308 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
4260 | struct intel_dp *intel_dp = &intel_dig_port->dp; | 4309 | struct intel_dp *intel_dp = &intel_dig_port->dp; |
4261 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
4262 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
4263 | 4310 | ||
4264 | drm_dp_aux_unregister(&intel_dp->aux); | 4311 | drm_dp_aux_unregister(&intel_dp->aux); |
4265 | intel_dp_mst_encoder_cleanup(intel_dig_port); | 4312 | intel_dp_mst_encoder_cleanup(intel_dig_port); |
4266 | drm_encoder_cleanup(encoder); | 4313 | drm_encoder_cleanup(encoder); |
4267 | if (is_edp(intel_dp)) { | 4314 | if (is_edp(intel_dp)) { |
4268 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 4315 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
4269 | mutex_lock(&dev_priv->pps_mutex); | 4316 | pps_lock(intel_dp); |
4270 | edp_panel_vdd_off_sync(intel_dp); | 4317 | edp_panel_vdd_off_sync(intel_dp); |
4271 | mutex_unlock(&dev_priv->pps_mutex); | 4318 | pps_unlock(intel_dp); |
4319 | |||
4272 | if (intel_dp->edp_notifier.notifier_call) { | 4320 | if (intel_dp->edp_notifier.notifier_call) { |
4273 | unregister_reboot_notifier(&intel_dp->edp_notifier); | 4321 | unregister_reboot_notifier(&intel_dp->edp_notifier); |
4274 | intel_dp->edp_notifier.notifier_call = NULL; | 4322 | intel_dp->edp_notifier.notifier_call = NULL; |
@@ -4280,15 +4328,13 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
4280 | static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) | 4328 | static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) |
4281 | { | 4329 | { |
4282 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); | 4330 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); |
4283 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
4284 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
4285 | 4331 | ||
4286 | if (!is_edp(intel_dp)) | 4332 | if (!is_edp(intel_dp)) |
4287 | return; | 4333 | return; |
4288 | 4334 | ||
4289 | mutex_lock(&dev_priv->pps_mutex); | 4335 | pps_lock(intel_dp); |
4290 | edp_panel_vdd_off_sync(intel_dp); | 4336 | edp_panel_vdd_off_sync(intel_dp); |
4291 | mutex_unlock(&dev_priv->pps_mutex); | 4337 | pps_unlock(intel_dp); |
4292 | } | 4338 | } |
4293 | 4339 | ||
4294 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) | 4340 | static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
@@ -4767,9 +4813,10 @@ void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder) | |||
4767 | if (intel_encoder->type != INTEL_OUTPUT_EDP) | 4813 | if (intel_encoder->type != INTEL_OUTPUT_EDP) |
4768 | return; | 4814 | return; |
4769 | 4815 | ||
4770 | mutex_lock(&dev_priv->pps_mutex); | ||
4771 | |||
4772 | intel_dp = enc_to_intel_dp(&intel_encoder->base); | 4816 | intel_dp = enc_to_intel_dp(&intel_encoder->base); |
4817 | |||
4818 | pps_lock(intel_dp); | ||
4819 | |||
4773 | if (!edp_have_panel_vdd(intel_dp)) | 4820 | if (!edp_have_panel_vdd(intel_dp)) |
4774 | goto out; | 4821 | goto out; |
4775 | /* | 4822 | /* |
@@ -4784,7 +4831,7 @@ void intel_edp_panel_vdd_sanitize(struct intel_encoder *intel_encoder) | |||
4784 | 4831 | ||
4785 | edp_panel_vdd_schedule_off(intel_dp); | 4832 | edp_panel_vdd_schedule_off(intel_dp); |
4786 | out: | 4833 | out: |
4787 | mutex_unlock(&dev_priv->pps_mutex); | 4834 | pps_unlock(intel_dp); |
4788 | } | 4835 | } |
4789 | 4836 | ||
4790 | static bool intel_edp_init_connector(struct intel_dp *intel_dp, | 4837 | static bool intel_edp_init_connector(struct intel_dp *intel_dp, |
@@ -4826,9 +4873,9 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
4826 | } | 4873 | } |
4827 | 4874 | ||
4828 | /* We now know it's not a ghost, init power sequence regs. */ | 4875 | /* We now know it's not a ghost, init power sequence regs. */ |
4829 | mutex_lock(&dev_priv->pps_mutex); | 4876 | pps_lock(intel_dp); |
4830 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); | 4877 | intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); |
4831 | mutex_unlock(&dev_priv->pps_mutex); | 4878 | pps_unlock(intel_dp); |
4832 | 4879 | ||
4833 | mutex_lock(&dev->mode_config.mutex); | 4880 | mutex_lock(&dev->mode_config.mutex); |
4834 | edid = drm_get_edid(connector, &intel_dp->aux.ddc); | 4881 | edid = drm_get_edid(connector, &intel_dp->aux.ddc); |
@@ -4963,7 +5010,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | |||
4963 | } | 5010 | } |
4964 | 5011 | ||
4965 | if (is_edp(intel_dp)) { | 5012 | if (is_edp(intel_dp)) { |
4966 | mutex_lock(&dev_priv->pps_mutex); | 5013 | pps_lock(intel_dp); |
4967 | if (IS_VALLEYVIEW(dev)) { | 5014 | if (IS_VALLEYVIEW(dev)) { |
4968 | vlv_initial_power_sequencer_setup(intel_dp); | 5015 | vlv_initial_power_sequencer_setup(intel_dp); |
4969 | } else { | 5016 | } else { |
@@ -4971,8 +5018,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | |||
4971 | intel_dp_init_panel_power_sequencer(dev, intel_dp, | 5018 | intel_dp_init_panel_power_sequencer(dev, intel_dp, |
4972 | &power_seq); | 5019 | &power_seq); |
4973 | } | 5020 | } |
5021 | pps_unlock(intel_dp); | ||
4974 | } | 5022 | } |
4975 | mutex_unlock(&dev_priv->pps_mutex); | ||
4976 | 5023 | ||
4977 | intel_dp_aux_init(intel_dp, intel_connector); | 5024 | intel_dp_aux_init(intel_dp, intel_connector); |
4978 | 5025 | ||
@@ -4988,9 +5035,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, | |||
4988 | drm_dp_aux_unregister(&intel_dp->aux); | 5035 | drm_dp_aux_unregister(&intel_dp->aux); |
4989 | if (is_edp(intel_dp)) { | 5036 | if (is_edp(intel_dp)) { |
4990 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 5037 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
4991 | mutex_lock(&dev_priv->pps_mutex); | 5038 | pps_lock(intel_dp); |
4992 | edp_panel_vdd_off_sync(intel_dp); | 5039 | edp_panel_vdd_off_sync(intel_dp); |
4993 | mutex_unlock(&dev_priv->pps_mutex); | 5040 | pps_unlock(intel_dp); |
4994 | } | 5041 | } |
4995 | drm_connector_unregister(connector); | 5042 | drm_connector_unregister(connector); |
4996 | drm_connector_cleanup(connector); | 5043 | drm_connector_cleanup(connector); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1278b2529d6e..a505bf3ef33b 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -946,6 +946,7 @@ void intel_dp_mst_suspend(struct drm_device *dev); | |||
946 | void intel_dp_mst_resume(struct drm_device *dev); | 946 | void intel_dp_mst_resume(struct drm_device *dev); |
947 | int intel_dp_max_link_bw(struct intel_dp *intel_dp); | 947 | int intel_dp_max_link_bw(struct intel_dp *intel_dp); |
948 | void intel_dp_hot_plug(struct intel_encoder *intel_encoder); | 948 | void intel_dp_hot_plug(struct intel_encoder *intel_encoder); |
949 | void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv); | ||
949 | /* intel_dp_mst.c */ | 950 | /* intel_dp_mst.c */ |
950 | int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id); | 951 | int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id); |
951 | void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port); | 952 | void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port); |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 49af81f6b4ad..45f71e6dc544 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -6468,6 +6468,8 @@ static void vlv_display_power_well_disable(struct drm_i915_private *dev_priv, | |||
6468 | spin_unlock_irq(&dev_priv->irq_lock); | 6468 | spin_unlock_irq(&dev_priv->irq_lock); |
6469 | 6469 | ||
6470 | vlv_set_power_well(dev_priv, power_well, false); | 6470 | vlv_set_power_well(dev_priv, power_well, false); |
6471 | |||
6472 | vlv_power_sequencer_reset(dev_priv); | ||
6471 | } | 6473 | } |
6472 | 6474 | ||
6473 | static void vlv_dpio_cmn_power_well_enable(struct drm_i915_private *dev_priv, | 6475 | static void vlv_dpio_cmn_power_well_enable(struct drm_i915_private *dev_priv, |