aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c74
1 files changed, 36 insertions, 38 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e1c6a5547f68..6d4093974297 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -47,8 +47,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on);
47 47
48static void i9xx_crtc_clock_get(struct intel_crtc *crtc, 48static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
49 struct intel_crtc_config *pipe_config); 49 struct intel_crtc_config *pipe_config);
50static void ironlake_crtc_clock_get(struct intel_crtc *crtc, 50static void ironlake_pch_clock_get(struct intel_crtc *crtc,
51 struct intel_crtc_config *pipe_config); 51 struct intel_crtc_config *pipe_config);
52 52
53static int intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, 53static int intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
54 int x, int y, struct drm_framebuffer *old_fb); 54 int x, int y, struct drm_framebuffer *old_fb);
@@ -5068,6 +5068,8 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc,
5068 DPLL_PORTB_READY_MASK); 5068 DPLL_PORTB_READY_MASK);
5069 } 5069 }
5070 5070
5071 i9xx_crtc_clock_get(crtc, pipe_config);
5072
5071 return true; 5073 return true;
5072} 5074}
5073 5075
@@ -6026,6 +6028,8 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc,
6026 pipe_config->pixel_multiplier = 6028 pipe_config->pixel_multiplier =
6027 ((tmp & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK) 6029 ((tmp & PLL_REF_SDVO_HDMI_MULTIPLIER_MASK)
6028 >> PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) + 1; 6030 >> PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT) + 1;
6031
6032 ironlake_pch_clock_get(crtc, pipe_config);
6029 } else { 6033 } else {
6030 pipe_config->pixel_multiplier = 1; 6034 pipe_config->pixel_multiplier = 1;
6031 } 6035 }
@@ -7433,7 +7437,12 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
7433 i9xx_clock(refclk, &clock); 7437 i9xx_clock(refclk, &clock);
7434 } 7438 }
7435 7439
7436 pipe_config->adjusted_mode.clock = clock.dot; 7440 /*
7441 * This value includes pixel_multiplier. We will use
7442 * port_clock to compute adjusted_mode.clock in the
7443 * encoder's get_config() function.
7444 */
7445 pipe_config->port_clock = clock.dot;
7437} 7446}
7438 7447
7439int intel_dotclock_calculate(int link_freq, 7448int intel_dotclock_calculate(int link_freq,
@@ -7455,31 +7464,23 @@ int intel_dotclock_calculate(int link_freq,
7455 return div_u64((u64)m_n->link_m * link_freq, m_n->link_n); 7464 return div_u64((u64)m_n->link_m * link_freq, m_n->link_n);
7456} 7465}
7457 7466
7458static void ironlake_crtc_clock_get(struct intel_crtc *crtc, 7467static void ironlake_pch_clock_get(struct intel_crtc *crtc,
7459 struct intel_crtc_config *pipe_config) 7468 struct intel_crtc_config *pipe_config)
7460{ 7469{
7461 struct drm_device *dev = crtc->base.dev; 7470 struct drm_device *dev = crtc->base.dev;
7462 int link_freq; 7471
7472 /* read out port_clock from the DPLL */
7473 i9xx_crtc_clock_get(crtc, pipe_config);
7463 7474
7464 /* 7475 /*
7465 * We need to get the FDI or DP link clock here to derive 7476 * This value does not include pixel_multiplier.
7466 * the M/N dividers. 7477 * We will check that port_clock and adjusted_mode.clock
7467 * 7478 * agree once we know their relationship in the encoder's
7468 * For FDI, we read it from the BIOS or use a fixed 2.7GHz. 7479 * get_config() function.
7469 * For DP, it's either 1.62GHz or 2.7GHz.
7470 * We do our calculations in 10*MHz since we don't need much precison.
7471 */ 7480 */
7472 if (pipe_config->has_pch_encoder) { 7481 pipe_config->adjusted_mode.clock =
7473 link_freq = intel_fdi_link_freq(dev) * 10000; 7482 intel_dotclock_calculate(intel_fdi_link_freq(dev) * 10000,
7474 7483 &pipe_config->fdi_m_n);
7475 pipe_config->adjusted_mode.clock =
7476 intel_dotclock_calculate(link_freq, &pipe_config->fdi_m_n);
7477 } else {
7478 link_freq = pipe_config->port_clock;
7479
7480 pipe_config->adjusted_mode.clock =
7481 intel_dotclock_calculate(link_freq, &pipe_config->dp_m_n);
7482 }
7483} 7484}
7484 7485
7485/** Returns the currently programmed mode of the given pipe. */ 7486/** Returns the currently programmed mode of the given pipe. */
@@ -8895,9 +8896,6 @@ check_crtc_state(struct drm_device *dev)
8895 encoder->get_config(encoder, &pipe_config); 8896 encoder->get_config(encoder, &pipe_config);
8896 } 8897 }
8897 8898
8898 if (dev_priv->display.get_clock)
8899 dev_priv->display.get_clock(crtc, &pipe_config);
8900
8901 WARN(crtc->active != active, 8899 WARN(crtc->active != active,
8902 "crtc active state doesn't match with hw state " 8900 "crtc active state doesn't match with hw state "
8903 "(expected %i, found %i)\n", crtc->active, active); 8901 "(expected %i, found %i)\n", crtc->active, active);
@@ -8972,6 +8970,18 @@ intel_modeset_check_state(struct drm_device *dev)
8972 check_shared_dpll_state(dev); 8970 check_shared_dpll_state(dev);
8973} 8971}
8974 8972
8973void ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
8974 int dotclock)
8975{
8976 /*
8977 * FDI already provided one idea for the dotclock.
8978 * Yell if the encoder disagrees.
8979 */
8980 WARN(!intel_fuzzy_clock_check(pipe_config->adjusted_mode.clock, dotclock),
8981 "FDI dotclock and encoder dotclock mismatch, fdi: %i, encoder: %i\n",
8982 pipe_config->adjusted_mode.clock, dotclock);
8983}
8984
8975static int __intel_set_mode(struct drm_crtc *crtc, 8985static int __intel_set_mode(struct drm_crtc *crtc,
8976 struct drm_display_mode *mode, 8986 struct drm_display_mode *mode,
8977 int x, int y, struct drm_framebuffer *fb) 8987 int x, int y, struct drm_framebuffer *fb)
@@ -9923,7 +9933,6 @@ static void intel_init_display(struct drm_device *dev)
9923 dev_priv->display.update_plane = ironlake_update_plane; 9933 dev_priv->display.update_plane = ironlake_update_plane;
9924 } else if (HAS_PCH_SPLIT(dev)) { 9934 } else if (HAS_PCH_SPLIT(dev)) {
9925 dev_priv->display.get_pipe_config = ironlake_get_pipe_config; 9935 dev_priv->display.get_pipe_config = ironlake_get_pipe_config;
9926 dev_priv->display.get_clock = ironlake_crtc_clock_get;
9927 dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set; 9936 dev_priv->display.crtc_mode_set = ironlake_crtc_mode_set;
9928 dev_priv->display.crtc_enable = ironlake_crtc_enable; 9937 dev_priv->display.crtc_enable = ironlake_crtc_enable;
9929 dev_priv->display.crtc_disable = ironlake_crtc_disable; 9938 dev_priv->display.crtc_disable = ironlake_crtc_disable;
@@ -9931,7 +9940,6 @@ static void intel_init_display(struct drm_device *dev)
9931 dev_priv->display.update_plane = ironlake_update_plane; 9940 dev_priv->display.update_plane = ironlake_update_plane;
9932 } else if (IS_VALLEYVIEW(dev)) { 9941 } else if (IS_VALLEYVIEW(dev)) {
9933 dev_priv->display.get_pipe_config = i9xx_get_pipe_config; 9942 dev_priv->display.get_pipe_config = i9xx_get_pipe_config;
9934 dev_priv->display.get_clock = i9xx_crtc_clock_get;
9935 dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; 9943 dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set;
9936 dev_priv->display.crtc_enable = valleyview_crtc_enable; 9944 dev_priv->display.crtc_enable = valleyview_crtc_enable;
9937 dev_priv->display.crtc_disable = i9xx_crtc_disable; 9945 dev_priv->display.crtc_disable = i9xx_crtc_disable;
@@ -9939,7 +9947,6 @@ static void intel_init_display(struct drm_device *dev)
9939 dev_priv->display.update_plane = i9xx_update_plane; 9947 dev_priv->display.update_plane = i9xx_update_plane;
9940 } else { 9948 } else {
9941 dev_priv->display.get_pipe_config = i9xx_get_pipe_config; 9949 dev_priv->display.get_pipe_config = i9xx_get_pipe_config;
9942 dev_priv->display.get_clock = i9xx_crtc_clock_get;
9943 dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set; 9950 dev_priv->display.crtc_mode_set = i9xx_crtc_mode_set;
9944 dev_priv->display.crtc_enable = i9xx_crtc_enable; 9951 dev_priv->display.crtc_enable = i9xx_crtc_enable;
9945 dev_priv->display.crtc_disable = i9xx_crtc_disable; 9952 dev_priv->display.crtc_disable = i9xx_crtc_disable;
@@ -10553,15 +10560,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
10553 pipe); 10560 pipe);
10554 } 10561 }
10555 10562
10556 list_for_each_entry(crtc, &dev->mode_config.crtc_list,
10557 base.head) {
10558 if (!crtc->active)
10559 continue;
10560 if (dev_priv->display.get_clock)
10561 dev_priv->display.get_clock(crtc,
10562 &crtc->config);
10563 }
10564
10565 list_for_each_entry(connector, &dev->mode_config.connector_list, 10563 list_for_each_entry(connector, &dev->mode_config.connector_list,
10566 base.head) { 10564 base.head) {
10567 if (connector->get_hw_state(connector)) { 10565 if (connector->get_hw_state(connector)) {