aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rv770.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2013-02-14 10:04:02 -0500
committerAlex Deucher <alexander.deucher@amd.com>2013-02-20 08:51:20 -0500
commit454d2e2a32f02a4f8e0364ba0e8ce4f8dbe9810c (patch)
treec9727360424260a40aba4b037bbca4457efe4c1d /drivers/gpu/drm/radeon/rv770.c
parent0e34d0945ed16aeb72c863be4efe4cd0c62f9c53 (diff)
drm/radeon: add a asic callback to get the xclk
This is required to get the reference clock used by the gfx engine for things like timestamps. Fixes support for GL extensions the use timestamps on certain boards. Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/rv770.c')
-rw-r--r--drivers/gpu/drm/radeon/rv770.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 1b2444f4d8f4..d63fe1d0f53f 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -43,6 +43,31 @@ static void rv770_gpu_init(struct radeon_device *rdev);
43void rv770_fini(struct radeon_device *rdev); 43void rv770_fini(struct radeon_device *rdev);
44static void rv770_pcie_gen2_enable(struct radeon_device *rdev); 44static void rv770_pcie_gen2_enable(struct radeon_device *rdev);
45 45
46#define PCIE_BUS_CLK 10000
47#define TCLK (PCIE_BUS_CLK / 10)
48
49/**
50 * rv770_get_xclk - get the xclk
51 *
52 * @rdev: radeon_device pointer
53 *
54 * Returns the reference clock used by the gfx engine
55 * (r7xx-cayman).
56 */
57u32 rv770_get_xclk(struct radeon_device *rdev)
58{
59 u32 reference_clock = rdev->clock.spll.reference_freq;
60 u32 tmp = RREG32(CG_CLKPIN_CNTL);
61
62 if (tmp & MUX_TCLK_TO_XCLK)
63 return TCLK;
64
65 if (tmp & XTALIN_DIVIDE)
66 return reference_clock / 4;
67
68 return reference_clock;
69}
70
46u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) 71u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
47{ 72{
48 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; 73 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];