Skip to content

Commit da4a1ef

Browse files
vsyrjaladanvet
authored andcommitted
drm/i915: Make i9xx_crtc_clock_get() work for PCH DPLLs
Add the 120MHz refernce clock case for PCH DPLLs. Also determine the reference clock frequency more accurately by checking for the PLLB_REF_INPUT_SPREADSPECTRUMIN refclk input mode. The gen2 code already checked it, but it stil assumed a fixed 66MHz refclk. Instead we need to consult the VBT for the real value. v2: Fix refclk for SSC panel case Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 293623f commit da4a1ef

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

‎drivers/gpu/drm/i915/intel_display.c‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7341,6 +7341,22 @@ void intel_release_load_detect_pipe(struct drm_connector *connector,
73417341
mutex_unlock(&crtc->mutex);
73427342
}
73437343

7344+
static int i9xx_pll_refclk(struct drm_device *dev,
7345+
const struct intel_crtc_config *pipe_config)
7346+
{
7347+
struct drm_i915_private *dev_priv = dev->dev_private;
7348+
u32 dpll = pipe_config->dpll_hw_state.dpll;
7349+
7350+
if ((dpll & PLL_REF_INPUT_MASK) == PLLB_REF_INPUT_SPREADSPECTRUMIN)
7351+
return dev_priv->vbt.lvds_ssc_freq * 1000;
7352+
else if (HAS_PCH_SPLIT(dev))
7353+
return 120000;
7354+
else if (!IS_GEN2(dev))
7355+
return 96000;
7356+
else
7357+
return 48000;
7358+
}
7359+
73447360
/* Returns the clock of the currently programmed mode of the given pipe. */
73457361
static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
73467362
struct intel_crtc_config *pipe_config)
@@ -7351,6 +7367,7 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
73517367
u32 dpll = pipe_config->dpll_hw_state.dpll;
73527368
u32 fp;
73537369
intel_clock_t clock;
7370+
int refclk = i9xx_pll_refclk(dev, pipe_config);
73547371

73557372
if ((dpll & DISPLAY_RATE_SELECT_FPA1) == 0)
73567373
fp = pipe_config->dpll_hw_state.fp0;
@@ -7390,23 +7407,16 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
73907407
}
73917408

73927409
if (IS_PINEVIEW(dev))
7393-
pineview_clock(96000, &clock);
7410+
pineview_clock(refclk, &clock);
73947411
else
7395-
i9xx_clock(96000, &clock);
7412+
i9xx_clock(refclk, &clock);
73967413
} else {
73977414
bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN);
73987415

73997416
if (is_lvds) {
74007417
clock.p1 = ffs((dpll & DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS) >>
74017418
DPLL_FPA01_P1_POST_DIV_SHIFT);
74027419
clock.p2 = 14;
7403-
7404-
if ((dpll & PLL_REF_INPUT_MASK) ==
7405-
PLLB_REF_INPUT_SPREADSPECTRUMIN) {
7406-
/* XXX: might not be 66MHz */
7407-
i9xx_clock(66000, &clock);
7408-
} else
7409-
i9xx_clock(48000, &clock);
74107420
} else {
74117421
if (dpll & PLL_P1_DIVIDE_BY_TWO)
74127422
clock.p1 = 2;
@@ -7418,9 +7428,9 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
74187428
clock.p2 = 4;
74197429
else
74207430
clock.p2 = 2;
7421-
7422-
i9xx_clock(48000, &clock);
74237431
}
7432+
7433+
i9xx_clock(refclk, &clock);
74247434
}
74257435

74267436
pipe_config->adjusted_mode.clock = clock.dot;

0 commit comments

Comments
 (0)