diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2013-09-20 12:35:30 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-10-01 01:45:12 -0400 |
commit | 18b5992c37560dffc52b84dec7f83738847cf5c7 (patch) | |
tree | f4942bc743519306af364d2d154e3e7ab3786ed6 /drivers/gpu/drm/i915/intel_dp.c | |
parent | 50003939b5a45df44b3b4bd1ccd46e3c50aa5e65 (diff) |
drm/i915: Calculate PSR register offsets from base + gen
Future generations will be changing these registers (thanks to design
for giving us an early heads up). To help abstract, create the
definition of the base of the register block, and define all registers
relative to that.
Design has promised to not change the offsets relative to the base.
v2: Also change IS_HASWELL checks to HAS_PSR
CC: Rodrigo Vivi <rodrigo.vivi@gmail.com>
CC: Intel GFX <intel-gfx@lists.freedesktop.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dp.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 5a937fcd3a69..5e1de353a5b7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1496,10 +1496,10 @@ static bool intel_edp_is_psr_enabled(struct drm_device *dev) | |||
1496 | { | 1496 | { |
1497 | struct drm_i915_private *dev_priv = dev->dev_private; | 1497 | struct drm_i915_private *dev_priv = dev->dev_private; |
1498 | 1498 | ||
1499 | if (!IS_HASWELL(dev)) | 1499 | if (!HAS_PSR(dev)) |
1500 | return false; | 1500 | return false; |
1501 | 1501 | ||
1502 | return I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE; | 1502 | return I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE; |
1503 | } | 1503 | } |
1504 | 1504 | ||
1505 | static void intel_edp_psr_write_vsc(struct intel_dp *intel_dp, | 1505 | static void intel_edp_psr_write_vsc(struct intel_dp *intel_dp, |
@@ -1549,7 +1549,7 @@ static void intel_edp_psr_setup(struct intel_dp *intel_dp) | |||
1549 | intel_edp_psr_write_vsc(intel_dp, &psr_vsc); | 1549 | intel_edp_psr_write_vsc(intel_dp, &psr_vsc); |
1550 | 1550 | ||
1551 | /* Avoid continuous PSR exit by masking memup and hpd */ | 1551 | /* Avoid continuous PSR exit by masking memup and hpd */ |
1552 | I915_WRITE(EDP_PSR_DEBUG_CTL, EDP_PSR_DEBUG_MASK_MEMUP | | 1552 | I915_WRITE(EDP_PSR_DEBUG_CTL(dev), EDP_PSR_DEBUG_MASK_MEMUP | |
1553 | EDP_PSR_DEBUG_MASK_HPD); | 1553 | EDP_PSR_DEBUG_MASK_HPD); |
1554 | 1554 | ||
1555 | intel_dp->psr_setup_done = true; | 1555 | intel_dp->psr_setup_done = true; |
@@ -1574,9 +1574,9 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp) | |||
1574 | DP_PSR_MAIN_LINK_ACTIVE); | 1574 | DP_PSR_MAIN_LINK_ACTIVE); |
1575 | 1575 | ||
1576 | /* Setup AUX registers */ | 1576 | /* Setup AUX registers */ |
1577 | I915_WRITE(EDP_PSR_AUX_DATA1, EDP_PSR_DPCD_COMMAND); | 1577 | I915_WRITE(EDP_PSR_AUX_DATA1(dev), EDP_PSR_DPCD_COMMAND); |
1578 | I915_WRITE(EDP_PSR_AUX_DATA2, EDP_PSR_DPCD_NORMAL_OPERATION); | 1578 | I915_WRITE(EDP_PSR_AUX_DATA2(dev), EDP_PSR_DPCD_NORMAL_OPERATION); |
1579 | I915_WRITE(EDP_PSR_AUX_CTL, | 1579 | I915_WRITE(EDP_PSR_AUX_CTL(dev), |
1580 | DP_AUX_CH_CTL_TIME_OUT_400us | | 1580 | DP_AUX_CH_CTL_TIME_OUT_400us | |
1581 | (msg_size << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) | | 1581 | (msg_size << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) | |
1582 | (precharge << DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT) | | 1582 | (precharge << DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT) | |
@@ -1599,7 +1599,7 @@ static void intel_edp_psr_enable_source(struct intel_dp *intel_dp) | |||
1599 | } else | 1599 | } else |
1600 | val |= EDP_PSR_LINK_DISABLE; | 1600 | val |= EDP_PSR_LINK_DISABLE; |
1601 | 1601 | ||
1602 | I915_WRITE(EDP_PSR_CTL, val | | 1602 | I915_WRITE(EDP_PSR_CTL(dev), val | |
1603 | EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES | | 1603 | EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES | |
1604 | max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | | 1604 | max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT | |
1605 | idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | | 1605 | idle_frames << EDP_PSR_IDLE_FRAME_SHIFT | |
@@ -1616,7 +1616,7 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp) | |||
1616 | struct drm_i915_gem_object *obj = to_intel_framebuffer(crtc->fb)->obj; | 1616 | struct drm_i915_gem_object *obj = to_intel_framebuffer(crtc->fb)->obj; |
1617 | struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; | 1617 | struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; |
1618 | 1618 | ||
1619 | if (!IS_HASWELL(dev)) { | 1619 | if (!HAS_PSR(dev)) { |
1620 | DRM_DEBUG_KMS("PSR not supported on this platform\n"); | 1620 | DRM_DEBUG_KMS("PSR not supported on this platform\n"); |
1621 | dev_priv->no_psr_reason = PSR_NO_SOURCE; | 1621 | dev_priv->no_psr_reason = PSR_NO_SOURCE; |
1622 | return false; | 1622 | return false; |
@@ -1720,10 +1720,11 @@ void intel_edp_psr_disable(struct intel_dp *intel_dp) | |||
1720 | if (!intel_edp_is_psr_enabled(dev)) | 1720 | if (!intel_edp_is_psr_enabled(dev)) |
1721 | return; | 1721 | return; |
1722 | 1722 | ||
1723 | I915_WRITE(EDP_PSR_CTL, I915_READ(EDP_PSR_CTL) & ~EDP_PSR_ENABLE); | 1723 | I915_WRITE(EDP_PSR_CTL(dev), |
1724 | I915_READ(EDP_PSR_CTL(dev)) & ~EDP_PSR_ENABLE); | ||
1724 | 1725 | ||
1725 | /* Wait till PSR is idle */ | 1726 | /* Wait till PSR is idle */ |
1726 | if (_wait_for((I915_READ(EDP_PSR_STATUS_CTL) & | 1727 | if (_wait_for((I915_READ(EDP_PSR_STATUS_CTL(dev)) & |
1727 | EDP_PSR_STATUS_STATE_MASK) == 0, 2000, 10)) | 1728 | EDP_PSR_STATUS_STATE_MASK) == 0, 2000, 10)) |
1728 | DRM_ERROR("Timed out waiting for PSR Idle State\n"); | 1729 | DRM_ERROR("Timed out waiting for PSR Idle State\n"); |
1729 | } | 1730 | } |