aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/intel_display.c43
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
2 files changed, 24 insertions, 21 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2e74ccce447d..94ef15c87b80 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7427,16 +7427,9 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
7427 pipe_config->adjusted_mode.clock = clock.dot; 7427 pipe_config->adjusted_mode.clock = clock.dot;
7428} 7428}
7429 7429
7430static void ironlake_crtc_clock_get(struct intel_crtc *crtc, 7430int intel_dotclock_calculate(int link_freq,
7431 struct intel_crtc_config *pipe_config) 7431 const struct intel_link_m_n *m_n)
7432{ 7432{
7433 struct drm_device *dev = crtc->base.dev;
7434 struct drm_i915_private *dev_priv = dev->dev_private;
7435 enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
7436 int link_freq;
7437 u64 clock;
7438 u32 link_m, link_n;
7439
7440 /* 7433 /*
7441 * The calculation for the data clock is: 7434 * The calculation for the data clock is:
7442 * pixel_clock = ((m/n)*(link_clock * nr_lanes))/bpp 7435 * pixel_clock = ((m/n)*(link_clock * nr_lanes))/bpp
@@ -7447,6 +7440,18 @@ static void ironlake_crtc_clock_get(struct intel_crtc *crtc,
7447 * link_clock = (m * link_clock) / n 7440 * link_clock = (m * link_clock) / n
7448 */ 7441 */
7449 7442
7443 if (!m_n->link_n)
7444 return 0;
7445
7446 return div_u64((u64)m_n->link_m * link_freq, m_n->link_n);
7447}
7448
7449static void ironlake_crtc_clock_get(struct intel_crtc *crtc,
7450 struct intel_crtc_config *pipe_config)
7451{
7452 struct drm_device *dev = crtc->base.dev;
7453 int link_freq;
7454
7450 /* 7455 /*
7451 * We need to get the FDI or DP link clock here to derive 7456 * We need to get the FDI or DP link clock here to derive
7452 * the M/N dividers. 7457 * the M/N dividers.
@@ -7455,21 +7460,17 @@ static void ironlake_crtc_clock_get(struct intel_crtc *crtc,
7455 * For DP, it's either 1.62GHz or 2.7GHz. 7460 * For DP, it's either 1.62GHz or 2.7GHz.
7456 * We do our calculations in 10*MHz since we don't need much precison. 7461 * We do our calculations in 10*MHz since we don't need much precison.
7457 */ 7462 */
7458 if (pipe_config->has_pch_encoder) 7463 if (pipe_config->has_pch_encoder) {
7459 link_freq = intel_fdi_link_freq(dev) * 10000; 7464 link_freq = intel_fdi_link_freq(dev) * 10000;
7460 else
7461 link_freq = pipe_config->port_clock;
7462 7465
7463 link_m = I915_READ(PIPE_LINK_M1(cpu_transcoder)); 7466 pipe_config->adjusted_mode.clock =
7464 link_n = I915_READ(PIPE_LINK_N1(cpu_transcoder)); 7467 intel_dotclock_calculate(link_freq, &pipe_config->fdi_m_n);
7465 7468 } else {
7466 if (!link_m || !link_n) 7469 link_freq = pipe_config->port_clock;
7467 return;
7468
7469 clock = ((u64)link_m * (u64)link_freq);
7470 do_div(clock, link_n);
7471 7470
7472 pipe_config->adjusted_mode.clock = clock; 7471 pipe_config->adjusted_mode.clock =
7472 intel_dotclock_calculate(link_freq, &pipe_config->dp_m_n);
7473 }
7473} 7474}
7474 7475
7475/** Returns the currently programmed mode of the given pipe. */ 7476/** Returns the currently programmed mode of the given pipe. */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f6d5c920f896..93606949bc91 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -803,5 +803,7 @@ extern void intel_aux_display_runtime_get(struct drm_i915_private *dev_priv);
803extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv); 803extern void intel_aux_display_runtime_put(struct drm_i915_private *dev_priv);
804extern void intel_dp_get_m_n(struct intel_crtc *crtc, 804extern void intel_dp_get_m_n(struct intel_crtc *crtc,
805 struct intel_crtc_config *pipe_config); 805 struct intel_crtc_config *pipe_config);
806extern int intel_dotclock_calculate(int link_freq,
807 const struct intel_link_m_n *m_n);
806 808
807#endif /* __INTEL_DRV_H__ */ 809#endif /* __INTEL_DRV_H__ */