Skip to content

Commit 257a7ff

Browse files
committed
drm/i915: fix pnv display core clock readout out
We need the correct clock to accurately assess whether we need to enable the double wide pipe mode or not. Cc: Chris Wilson <[email protected]> Cc: Stéphane Marchesin <[email protected]> Cc: Stuart Abercrombie <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent de51f04 commit 257a7ff

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
#define GC_LOW_FREQUENCY_ENABLE (1 << 7)
6262
#define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
6363
#define GC_DISPLAY_CLOCK_333_MHZ (4 << 4)
64+
#define GC_DISPLAY_CLOCK_267_MHZ_PNV (0 << 4)
65+
#define GC_DISPLAY_CLOCK_333_MHZ_PNV (1 << 4)
66+
#define GC_DISPLAY_CLOCK_444_MHZ_PNV (2 << 4)
67+
#define GC_DISPLAY_CLOCK_200_MHZ_PNV (5 << 4)
68+
#define GC_DISPLAY_CLOCK_133_MHZ_PNV (6 << 4)
69+
#define GC_DISPLAY_CLOCK_167_MHZ_PNV (7 << 4)
6470
#define GC_DISPLAY_CLOCK_MASK (7 << 4)
6571
#define GM45_GC_RENDER_CLOCK_MASK (0xf << 0)
6672
#define GM45_GC_RENDER_CLOCK_266_MHZ (8 << 0)

drivers/gpu/drm/i915/intel_display.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4163,6 +4163,30 @@ static int i9xx_misc_get_display_clock_speed(struct drm_device *dev)
41634163
return 200000;
41644164
}
41654165

4166+
static int pnv_get_display_clock_speed(struct drm_device *dev)
4167+
{
4168+
u16 gcfgc = 0;
4169+
4170+
pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
4171+
4172+
switch (gcfgc & GC_DISPLAY_CLOCK_MASK) {
4173+
case GC_DISPLAY_CLOCK_267_MHZ_PNV:
4174+
return 267000;
4175+
case GC_DISPLAY_CLOCK_333_MHZ_PNV:
4176+
return 333000;
4177+
case GC_DISPLAY_CLOCK_444_MHZ_PNV:
4178+
return 444000;
4179+
case GC_DISPLAY_CLOCK_200_MHZ_PNV:
4180+
return 200000;
4181+
default:
4182+
DRM_ERROR("Unknown pnv display core clock 0x%04x\n", gcfgc);
4183+
case GC_DISPLAY_CLOCK_133_MHZ_PNV:
4184+
return 133000;
4185+
case GC_DISPLAY_CLOCK_167_MHZ_PNV:
4186+
return 167000;
4187+
}
4188+
}
4189+
41664190
static int i915gm_get_display_clock_speed(struct drm_device *dev)
41674191
{
41684192
u16 gcfgc = 0;
@@ -9605,9 +9629,12 @@ static void intel_init_display(struct drm_device *dev)
96059629
else if (IS_I915G(dev))
96069630
dev_priv->display.get_display_clock_speed =
96079631
i915_get_display_clock_speed;
9608-
else if (IS_I945GM(dev) || IS_845G(dev) || IS_PINEVIEW_M(dev))
9632+
else if (IS_I945GM(dev) || IS_845G(dev))
96099633
dev_priv->display.get_display_clock_speed =
96109634
i9xx_misc_get_display_clock_speed;
9635+
else if (IS_PINEVIEW(dev))
9636+
dev_priv->display.get_display_clock_speed =
9637+
pnv_get_display_clock_speed;
96119638
else if (IS_I915GM(dev))
96129639
dev_priv->display.get_display_clock_speed =
96139640
i915gm_get_display_clock_speed;

0 commit comments

Comments
 (0)