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 | |
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')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 21 |
4 files changed, 28 insertions, 24 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 09c93d7989f1..fcfa98844ccc 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1668,9 +1668,10 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) | |||
1668 | struct drm_i915_private *dev_priv = dev->dev_private; | 1668 | struct drm_i915_private *dev_priv = dev->dev_private; |
1669 | u32 psrstat, psrperf; | 1669 | u32 psrstat, psrperf; |
1670 | 1670 | ||
1671 | if (!IS_HASWELL(dev)) { | 1671 | if (!HAS_PSR(dev)) { |
1672 | seq_puts(m, "PSR not supported on this platform\n"); | 1672 | seq_puts(m, "PSR not supported on this platform\n"); |
1673 | } else if (IS_HASWELL(dev) && I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE) { | 1673 | } else if (HAS_PSR(dev) && |
1674 | I915_READ(EDP_PSR_CTL(dev)) & EDP_PSR_ENABLE) { | ||
1674 | seq_puts(m, "PSR enabled\n"); | 1675 | seq_puts(m, "PSR enabled\n"); |
1675 | } else { | 1676 | } else { |
1676 | seq_puts(m, "PSR disabled: "); | 1677 | seq_puts(m, "PSR disabled: "); |
@@ -1712,7 +1713,7 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) | |||
1712 | return 0; | 1713 | return 0; |
1713 | } | 1714 | } |
1714 | 1715 | ||
1715 | psrstat = I915_READ(EDP_PSR_STATUS_CTL); | 1716 | psrstat = I915_READ(EDP_PSR_STATUS_CTL(dev)); |
1716 | 1717 | ||
1717 | seq_puts(m, "PSR Current State: "); | 1718 | seq_puts(m, "PSR Current State: "); |
1718 | switch (psrstat & EDP_PSR_STATUS_STATE_MASK) { | 1719 | switch (psrstat & EDP_PSR_STATUS_STATE_MASK) { |
@@ -1784,7 +1785,7 @@ static int i915_edp_psr_status(struct seq_file *m, void *data) | |||
1784 | seq_printf(m, "Idle Count: %u\n", | 1785 | seq_printf(m, "Idle Count: %u\n", |
1785 | psrstat & EDP_PSR_STATUS_IDLE_MASK); | 1786 | psrstat & EDP_PSR_STATUS_IDLE_MASK); |
1786 | 1787 | ||
1787 | psrperf = (I915_READ(EDP_PSR_PERF_CNT)) & EDP_PSR_PERF_CNT_MASK; | 1788 | psrperf = (I915_READ(EDP_PSR_PERF_CNT(dev))) & EDP_PSR_PERF_CNT_MASK; |
1788 | seq_printf(m, "Performance Counter: %u\n", psrperf); | 1789 | seq_printf(m, "Performance Counter: %u\n", psrperf); |
1789 | 1790 | ||
1790 | return 0; | 1791 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 07de53c40e57..bbe889dfc0ff 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1684,6 +1684,7 @@ struct drm_i915_file_private { | |||
1684 | #define HAS_DDI(dev) (INTEL_INFO(dev)->has_ddi) | 1684 | #define HAS_DDI(dev) (INTEL_INFO(dev)->has_ddi) |
1685 | #define HAS_POWER_WELL(dev) (IS_HASWELL(dev)) | 1685 | #define HAS_POWER_WELL(dev) (IS_HASWELL(dev)) |
1686 | #define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg) | 1686 | #define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg) |
1687 | #define HAS_PSR(dev) (IS_HASWELL(dev)) | ||
1687 | 1688 | ||
1688 | #define INTEL_PCH_DEVICE_ID_MASK 0xff00 | 1689 | #define INTEL_PCH_DEVICE_ID_MASK 0xff00 |
1689 | #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 | 1690 | #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index c4f9bef6d073..f7ad97572c4d 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1848,7 +1848,8 @@ | |||
1848 | #define VSYNCSHIFT(trans) _TRANSCODER(trans, _VSYNCSHIFT_A, _VSYNCSHIFT_B) | 1848 | #define VSYNCSHIFT(trans) _TRANSCODER(trans, _VSYNCSHIFT_A, _VSYNCSHIFT_B) |
1849 | 1849 | ||
1850 | /* HSW eDP PSR registers */ | 1850 | /* HSW eDP PSR registers */ |
1851 | #define EDP_PSR_CTL 0x64800 | 1851 | #define EDP_PSR_BASE(dev) 0x64800 |
1852 | #define EDP_PSR_CTL(dev) (EDP_PSR_BASE(dev) + 0) | ||
1852 | #define EDP_PSR_ENABLE (1<<31) | 1853 | #define EDP_PSR_ENABLE (1<<31) |
1853 | #define EDP_PSR_LINK_DISABLE (0<<27) | 1854 | #define EDP_PSR_LINK_DISABLE (0<<27) |
1854 | #define EDP_PSR_LINK_STANDBY (1<<27) | 1855 | #define EDP_PSR_LINK_STANDBY (1<<27) |
@@ -1871,16 +1872,16 @@ | |||
1871 | #define EDP_PSR_TP1_TIME_0us (3<<4) | 1872 | #define EDP_PSR_TP1_TIME_0us (3<<4) |
1872 | #define EDP_PSR_IDLE_FRAME_SHIFT 0 | 1873 | #define EDP_PSR_IDLE_FRAME_SHIFT 0 |
1873 | 1874 | ||
1874 | #define EDP_PSR_AUX_CTL 0x64810 | 1875 | #define EDP_PSR_AUX_CTL(dev) (EDP_PSR_BASE(dev) + 0x10) |
1875 | #define EDP_PSR_AUX_DATA1 0x64814 | 1876 | #define EDP_PSR_AUX_DATA1(dev) (EDP_PSR_BASE(dev) + 0x14) |
1876 | #define EDP_PSR_DPCD_COMMAND 0x80060000 | 1877 | #define EDP_PSR_DPCD_COMMAND 0x80060000 |
1877 | #define EDP_PSR_AUX_DATA2 0x64818 | 1878 | #define EDP_PSR_AUX_DATA2(dev) (EDP_PSR_BASE(dev) + 0x18) |
1878 | #define EDP_PSR_DPCD_NORMAL_OPERATION (1<<24) | 1879 | #define EDP_PSR_DPCD_NORMAL_OPERATION (1<<24) |
1879 | #define EDP_PSR_AUX_DATA3 0x6481c | 1880 | #define EDP_PSR_AUX_DATA3(dev) (EDP_PSR_BASE(dev) + 0x1c) |
1880 | #define EDP_PSR_AUX_DATA4 0x64820 | 1881 | #define EDP_PSR_AUX_DATA4(dev) (EDP_PSR_BASE(dev) + 0x20) |
1881 | #define EDP_PSR_AUX_DATA5 0x64824 | 1882 | #define EDP_PSR_AUX_DATA5(dev) (EDP_PSR_BASE(dev) + 0x24) |
1882 | 1883 | ||
1883 | #define EDP_PSR_STATUS_CTL 0x64840 | 1884 | #define EDP_PSR_STATUS_CTL(dev) (EDP_PSR_BASE(dev) + 0x40) |
1884 | #define EDP_PSR_STATUS_STATE_MASK (7<<29) | 1885 | #define EDP_PSR_STATUS_STATE_MASK (7<<29) |
1885 | #define EDP_PSR_STATUS_STATE_IDLE (0<<29) | 1886 | #define EDP_PSR_STATUS_STATE_IDLE (0<<29) |
1886 | #define EDP_PSR_STATUS_STATE_SRDONACK (1<<29) | 1887 | #define EDP_PSR_STATUS_STATE_SRDONACK (1<<29) |
@@ -1904,10 +1905,10 @@ | |||
1904 | #define EDP_PSR_STATUS_SENDING_TP1 (1<<4) | 1905 | #define EDP_PSR_STATUS_SENDING_TP1 (1<<4) |
1905 | #define EDP_PSR_STATUS_IDLE_MASK 0xf | 1906 | #define EDP_PSR_STATUS_IDLE_MASK 0xf |
1906 | 1907 | ||
1907 | #define EDP_PSR_PERF_CNT 0x64844 | 1908 | #define EDP_PSR_PERF_CNT(dev) (EDP_PSR_BASE(dev) + 0x44) |
1908 | #define EDP_PSR_PERF_CNT_MASK 0xffffff | 1909 | #define EDP_PSR_PERF_CNT_MASK 0xffffff |
1909 | 1910 | ||
1910 | #define EDP_PSR_DEBUG_CTL 0x64860 | 1911 | #define EDP_PSR_DEBUG_CTL(dev) (EDP_PSR_BASE(dev) + 0x60) |
1911 | #define EDP_PSR_DEBUG_MASK_LPSP (1<<27) | 1912 | #define EDP_PSR_DEBUG_MASK_LPSP (1<<27) |
1912 | #define EDP_PSR_DEBUG_MASK_MEMUP (1<<26) | 1913 | #define EDP_PSR_DEBUG_MASK_MEMUP (1<<26) |
1913 | #define EDP_PSR_DEBUG_MASK_HPD (1<<25) | 1914 | #define EDP_PSR_DEBUG_MASK_HPD (1<<25) |
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 | } |