Pull drm fixes from Dave Airlie: "i915 and radeon fixes: i915: fix for connector oops regression DDC probing fix radeon: two radeon reverts, along with a freeze workaround and a fix" * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/radeon: Make sure radeon_vm_bo_set_addr always unreserves the BO Revert "drm/radeon: adjust pll when audio is not enabled" Revert "drm/radeon: don't share plls if monitors differ in audio support" drm/radeon: fix freeze for laptop with Turks/Thames GPU. drm/i915: Fix DDC probe for passive adapters drm/i915: Properly initialize SDVO analog connectors
Unified · Split
| @@ -435,7 +435,7 @@ gmbus_xfer(struct i2c_adapter *adapter, · 434 unmodified lines | ||
| 435 | 435 | struct intel_gmbus, |
| 436 | 436 | adapter); |
| 437 | 437 | struct drm_i915_private *dev_priv = bus->dev_priv; |
| 438 | − int i, reg_offset; | |
| 438 | + int i = 0, inc, try = 0, reg_offset; | |
| 439 | 439 | int ret = 0; |
| 440 | 440 | |
| 441 | 441 | intel_aux_display_runtime_get(dev_priv); |
| @@ -448,12 +448,14 @@ gmbus_xfer(struct i2c_adapter *adapter, · 6 unmodified lines | ||
| 448 | 448 | |
| 449 | 449 | reg_offset = dev_priv->gpio_mmio_base; |
| 450 | 450 | |
| 451 | +retry: | |
| 451 | 452 | I915_WRITE(GMBUS0 + reg_offset, bus->reg0); |
| 452 | 453 | |
| 453 | − for (i = 0; i < num; i++) { | |
| 454 | + for (; i < num; i += inc) { | |
| 455 | + inc = 1; | |
| 454 | 456 | if (gmbus_is_index_read(msgs, i, num)) { |
| 455 | 457 | ret = gmbus_xfer_index_read(dev_priv, &msgs[i]); |
| 456 | − i += 1; /* set i to the index of the read xfer */ | |
| 458 | + inc = 2; /* an index read is two msgs */ | |
| 457 | 459 | } else if (msgs[i].flags & I2C_M_RD) { |
| 458 | 460 | ret = gmbus_xfer_read(dev_priv, &msgs[i], 0); |
| 459 | 461 | } else { |
| @@ -525,6 +527,18 @@ clear_err: · 65 unmodified lines | ||
| 525 | 527 | adapter->name, msgs[i].addr, |
| 526 | 528 | (msgs[i].flags & I2C_M_RD) ? 'r' : 'w', msgs[i].len); |
| 527 | 529 | |
| 530 | + /* | |
| 531 | + * Passive adapters sometimes NAK the first probe. Retry the first | |
| 532 | + * message once on -ENXIO for GMBUS transfers; the bit banging algorithm | |
| 533 | + * has retries internally. See also the retry loop in | |
| 534 | + * drm_do_probe_ddc_edid, which bails out on the first -ENXIO. | |
| 535 | + */ | |
| 536 | + if (ret == -ENXIO && i == 0 && try++ == 0) { | |
| 537 | + DRM_DEBUG_KMS("GMBUS [%s] NAK on first message, retry\n", | |
| 538 | + adapter->name); | |
| 539 | + goto retry; | |
| 540 | + } | |
| 541 | + | |
| 528 | 542 | goto out; |
| 529 | 543 | |
| 530 | 544 | timeout: |
| @@ -2550,7 +2550,7 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device) · 2549 unmodified lines | ||
| 2550 | 2550 | |
| 2551 | 2551 | DRM_DEBUG_KMS("initialising analog device %d\n", device); |
| 2552 | 2552 | |
| 2553 | − intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL); | |
| 2553 | + intel_sdvo_connector = intel_sdvo_connector_alloc(); | |
| 2554 | 2554 | if (!intel_sdvo_connector) |
| 2555 | 2555 | return false; |
| 2556 | 2556 | |
| @@ -580,9 +580,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, · 579 unmodified lines | ||
| 580 | 580 | else |
| 581 | 581 | radeon_crtc->pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
| 582 | 582 | |
| 583 | − /* if there is no audio, set MINM_OVER_MAXP */ | |
| 584 | − if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) | |
| 585 | − radeon_crtc->pll_flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | |
| 586 | 583 | if (rdev->family < CHIP_RV770) |
| 587 | 584 | radeon_crtc->pll_flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; |
| 588 | 585 | /* use frac fb div on APUs */ |
| @@ -1798,9 +1795,7 @@ static int radeon_get_shared_nondp_ppll(struct drm_crtc *crtc) · 1209 unmodified lines | ||
| 1798 | 1795 | if ((crtc->mode.clock == test_crtc->mode.clock) && |
| 1799 | 1796 | (adjusted_clock == test_adjusted_clock) && |
| 1800 | 1797 | (radeon_crtc->ss_enabled == test_radeon_crtc->ss_enabled) && |
| 1801 | − (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID) && | |
| 1802 | − (drm_detect_monitor_audio(radeon_connector_edid(test_radeon_crtc->connector)) == | |
| 1803 | − drm_detect_monitor_audio(radeon_connector_edid(radeon_crtc->connector)))) | |
| 1798 | + (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID)) | |
| 1804 | 1799 | return test_radeon_crtc->pll_id; |
| 1805 | 1800 | } |
| 1806 | 1801 | } |
| @@ -1463,6 +1463,21 @@ int radeon_device_init(struct radeon_device *rdev, · 1462 unmodified lines | ||
| 1463 | 1463 | if (r) |
| 1464 | 1464 | DRM_ERROR("ib ring test failed (%d).\n", r); |
| 1465 | 1465 | |
| 1466 | + /* | |
| 1467 | + * Turks/Thames GPU will freeze whole laptop if DPM is not restarted | |
| 1468 | + * after the CP ring have chew one packet at least. Hence here we stop | |
| 1469 | + * and restart DPM after the radeon_ib_ring_tests(). | |
| 1470 | + */ | |
| 1471 | + if (rdev->pm.dpm_enabled && | |
| 1472 | + (rdev->pm.pm_method == PM_METHOD_DPM) && | |
| 1473 | + (rdev->family == CHIP_TURKS) && | |
| 1474 | + (rdev->flags & RADEON_IS_MOBILITY)) { | |
| 1475 | + mutex_lock(&rdev->pm.mutex); | |
| 1476 | + radeon_dpm_disable(rdev); | |
| 1477 | + radeon_dpm_enable(rdev); | |
| 1478 | + mutex_unlock(&rdev->pm.mutex); | |
| 1479 | + } | |
| 1480 | + | |
| 1466 | 1481 | if ((radeon_testing & 1)) { |
| 1467 | 1482 | if (rdev->accel_working) |
| 1468 | 1483 | radeon_test_moves(rdev); |
| @@ -458,14 +458,16 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 457 unmodified lines | ||
| 458 | 458 | /* make sure object fit at this offset */ |
| 459 | 459 | eoffset = soffset + size; |
| 460 | 460 | if (soffset >= eoffset) { |
| 461 | − return -EINVAL; | |
| 461 | + r = -EINVAL; | |
| 462 | + goto error_unreserve; | |
| 462 | 463 | } |
| 463 | 464 | |
| 464 | 465 | last_pfn = eoffset / RADEON_GPU_PAGE_SIZE; |
| 465 | 466 | if (last_pfn > rdev->vm_manager.max_pfn) { |
| 466 | 467 | dev_err(rdev->dev, "va above limit (0x%08X > 0x%08X)\n", |
| 467 | 468 | last_pfn, rdev->vm_manager.max_pfn); |
| 468 | − return -EINVAL; | |
| 469 | + r = -EINVAL; | |
| 470 | + goto error_unreserve; | |
| 469 | 471 | } |
| 470 | 472 | |
| 471 | 473 | } else { |
| @@ -486,7 +488,8 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 14 unmodified lines | ||
| 486 | 488 | "(bo %p 0x%010lx 0x%010lx)\n", bo_va->bo, |
| 487 | 489 | soffset, tmp->bo, tmp->it.start, tmp->it.last); |
| 488 | 490 | mutex_unlock(&vm->mutex); |
| 489 | − return -EINVAL; | |
| 491 | + r = -EINVAL; | |
| 492 | + goto error_unreserve; | |
| 490 | 493 | } |
| 491 | 494 | } |
| 492 | 495 | |
| @@ -497,7 +500,8 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 4 unmodified lines | ||
| 497 | 500 | tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); |
| 498 | 501 | if (!tmp) { |
| 499 | 502 | mutex_unlock(&vm->mutex); |
| 500 | − return -ENOMEM; | |
| 503 | + r = -ENOMEM; | |
| 504 | + goto error_unreserve; | |
| 501 | 505 | } |
| 502 | 506 | tmp->it.start = bo_va->it.start; |
| 503 | 507 | tmp->it.last = bo_va->it.last; |
| @@ -555,7 +559,6 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 51 unmodified lines | ||
| 555 | 559 | r = radeon_vm_clear_bo(rdev, pt); |
| 556 | 560 | if (r) { |
| 557 | 561 | radeon_bo_unref(&pt); |
| 558 | − radeon_bo_reserve(bo_va->bo, false); | |
| 559 | 562 | return r; |
| 560 | 563 | } |
| 561 | 564 | |
| @@ -575,6 +578,10 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, · 13 unmodified lines | ||
| 575 | 578 | |
| 576 | 579 | mutex_unlock(&vm->mutex); |
| 577 | 580 | return 0; |
| 581 | + | |
| 582 | +error_unreserve: | |
| 583 | + radeon_bo_unreserve(bo_va->bo); | |
| 584 | + return r; | |
| 578 | 585 | } |
| 579 | 586 | |
| 580 | 587 | /** |