aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorVandana Kannan <vandana.kannan@intel.com>2014-08-05 10:51:22 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-08 11:43:24 -0400
commitf769cd247d2be5af377adf82882eddd1dce183c4 (patch)
tree283fce94ff58babcb01ec26e196441feaf58504c /drivers/gpu/drm
parentbe71eabebaf9f142612d34d42292b454e984dcb5 (diff)
drm/i915: Set M2_N2 registers during mode set
For Gen < 8, set M2_N2 registers on every mode set. This is required to make sure M2_N2 registers are set during boot, resume from sleep for cross- checking the state. The register is set only if DRRS is supported. v2: Patch rebased v3: Daniel's review comments - Removed HAS_DRRS(dev) and added bool has_drrs to pipe_config to track drrs support v4: Jesse's review comments - Made changes to set m2_n2 in intel_dp_set_m_n() Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c28
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c18
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h3
3 files changed, 26 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 018fb7222f60..acee1416eb93 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -91,11 +91,11 @@ static int intel_framebuffer_init(struct drm_device *dev,
91 struct intel_framebuffer *ifb, 91 struct intel_framebuffer *ifb,
92 struct drm_mode_fb_cmd2 *mode_cmd, 92 struct drm_mode_fb_cmd2 *mode_cmd,
93 struct drm_i915_gem_object *obj); 93 struct drm_i915_gem_object *obj);
94static void intel_dp_set_m_n(struct intel_crtc *crtc);
95static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc); 94static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc);
96static void intel_set_pipe_timings(struct intel_crtc *intel_crtc); 95static void intel_set_pipe_timings(struct intel_crtc *intel_crtc);
97static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, 96static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
98 struct intel_link_m_n *m_n); 97 struct intel_link_m_n *m_n,
98 struct intel_link_m_n *m2_n2);
99static void ironlake_set_pipeconf(struct drm_crtc *crtc); 99static void ironlake_set_pipeconf(struct drm_crtc *crtc);
100static void haswell_set_pipeconf(struct drm_crtc *crtc); 100static void haswell_set_pipeconf(struct drm_crtc *crtc);
101static void intel_set_pipe_csc(struct drm_crtc *crtc); 101static void intel_set_pipe_csc(struct drm_crtc *crtc);
@@ -3980,7 +3980,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
3980 3980
3981 if (intel_crtc->config.has_pch_encoder) { 3981 if (intel_crtc->config.has_pch_encoder) {
3982 intel_cpu_transcoder_set_m_n(intel_crtc, 3982 intel_cpu_transcoder_set_m_n(intel_crtc,
3983 &intel_crtc->config.fdi_m_n); 3983 &intel_crtc->config.fdi_m_n, NULL);
3984 } 3984 }
3985 3985
3986 ironlake_set_pipeconf(crtc); 3986 ironlake_set_pipeconf(crtc);
@@ -4093,7 +4093,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
4093 4093
4094 if (intel_crtc->config.has_pch_encoder) { 4094 if (intel_crtc->config.has_pch_encoder) {
4095 intel_cpu_transcoder_set_m_n(intel_crtc, 4095 intel_cpu_transcoder_set_m_n(intel_crtc,
4096 &intel_crtc->config.fdi_m_n); 4096 &intel_crtc->config.fdi_m_n, NULL);
4097 } 4097 }
4098 4098
4099 haswell_set_pipeconf(crtc); 4099 haswell_set_pipeconf(crtc);
@@ -5509,7 +5509,8 @@ static void intel_pch_transcoder_set_m_n(struct intel_crtc *crtc,
5509} 5509}
5510 5510
5511static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc, 5511static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
5512 struct intel_link_m_n *m_n) 5512 struct intel_link_m_n *m_n,
5513 struct intel_link_m_n *m2_n2)
5513{ 5514{
5514 struct drm_device *dev = crtc->base.dev; 5515 struct drm_device *dev = crtc->base.dev;
5515 struct drm_i915_private *dev_priv = dev->dev_private; 5516 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5521,6 +5522,18 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
5521 I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n); 5522 I915_WRITE(PIPE_DATA_N1(transcoder), m_n->gmch_n);
5522 I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m); 5523 I915_WRITE(PIPE_LINK_M1(transcoder), m_n->link_m);
5523 I915_WRITE(PIPE_LINK_N1(transcoder), m_n->link_n); 5524 I915_WRITE(PIPE_LINK_N1(transcoder), m_n->link_n);
5525 /* M2_N2 registers to be set only for gen < 8 (M2_N2 available
5526 * for gen < 8) and if DRRS is supported (to make sure the
5527 * registers are not unnecessarily accessed).
5528 */
5529 if (m2_n2 && INTEL_INFO(dev)->gen < 8 &&
5530 crtc->config.has_drrs) {
5531 I915_WRITE(PIPE_DATA_M2(transcoder),
5532 TU_SIZE(m2_n2->tu) | m2_n2->gmch_m);
5533 I915_WRITE(PIPE_DATA_N2(transcoder), m2_n2->gmch_n);
5534 I915_WRITE(PIPE_LINK_M2(transcoder), m2_n2->link_m);
5535 I915_WRITE(PIPE_LINK_N2(transcoder), m2_n2->link_n);
5536 }
5524 } else { 5537 } else {
5525 I915_WRITE(PIPE_DATA_M_G4X(pipe), TU_SIZE(m_n->tu) | m_n->gmch_m); 5538 I915_WRITE(PIPE_DATA_M_G4X(pipe), TU_SIZE(m_n->tu) | m_n->gmch_m);
5526 I915_WRITE(PIPE_DATA_N_G4X(pipe), m_n->gmch_n); 5539 I915_WRITE(PIPE_DATA_N_G4X(pipe), m_n->gmch_n);
@@ -5529,12 +5542,13 @@ static void intel_cpu_transcoder_set_m_n(struct intel_crtc *crtc,
5529 } 5542 }
5530} 5543}
5531 5544
5532static void intel_dp_set_m_n(struct intel_crtc *crtc) 5545void intel_dp_set_m_n(struct intel_crtc *crtc)
5533{ 5546{
5534 if (crtc->config.has_pch_encoder) 5547 if (crtc->config.has_pch_encoder)
5535 intel_pch_transcoder_set_m_n(crtc, &crtc->config.dp_m_n); 5548 intel_pch_transcoder_set_m_n(crtc, &crtc->config.dp_m_n);
5536 else 5549 else
5537 intel_cpu_transcoder_set_m_n(crtc, &crtc->config.dp_m_n); 5550 intel_cpu_transcoder_set_m_n(crtc, &crtc->config.dp_m_n,
5551 &crtc->config.dp_m2_n2);
5538} 5552}
5539 5553
5540static void vlv_update_pll(struct intel_crtc *crtc) 5554static void vlv_update_pll(struct intel_crtc *crtc)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 805b6f63df0f..3ea5cef9bbe6 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -828,20 +828,6 @@ intel_dp_set_clock(struct intel_encoder *encoder,
828 } 828 }
829} 829}
830 830
831static void
832intel_dp_set_m2_n2(struct intel_crtc *crtc, struct intel_link_m_n *m_n)
833{
834 struct drm_device *dev = crtc->base.dev;
835 struct drm_i915_private *dev_priv = dev->dev_private;
836 enum transcoder transcoder = crtc->config.cpu_transcoder;
837
838 I915_WRITE(PIPE_DATA_M2(transcoder),
839 TU_SIZE(m_n->tu) | m_n->gmch_m);
840 I915_WRITE(PIPE_DATA_N2(transcoder), m_n->gmch_n);
841 I915_WRITE(PIPE_LINK_M2(transcoder), m_n->link_m);
842 I915_WRITE(PIPE_LINK_N2(transcoder), m_n->link_n);
843}
844
845bool 831bool
846intel_dp_compute_config(struct intel_encoder *encoder, 832intel_dp_compute_config(struct intel_encoder *encoder,
847 struct intel_crtc_config *pipe_config) 833 struct intel_crtc_config *pipe_config)
@@ -867,6 +853,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
867 pipe_config->has_pch_encoder = true; 853 pipe_config->has_pch_encoder = true;
868 854
869 pipe_config->has_dp_encoder = true; 855 pipe_config->has_dp_encoder = true;
856 pipe_config->has_drrs = false;
870 pipe_config->has_audio = intel_dp->has_audio; 857 pipe_config->has_audio = intel_dp->has_audio;
871 858
872 if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) { 859 if (is_edp(intel_dp) && intel_connector->panel.fixed_mode) {
@@ -970,6 +957,7 @@ found:
970 957
971 if (intel_connector->panel.downclock_mode != NULL && 958 if (intel_connector->panel.downclock_mode != NULL &&
972 intel_dp->drrs_state.type == SEAMLESS_DRRS_SUPPORT) { 959 intel_dp->drrs_state.type == SEAMLESS_DRRS_SUPPORT) {
960 pipe_config->has_drrs = true;
973 intel_link_compute_m_n(bpp, lane_count, 961 intel_link_compute_m_n(bpp, lane_count,
974 intel_connector->panel.downclock_mode->clock, 962 intel_connector->panel.downclock_mode->clock,
975 pipe_config->port_clock, 963 pipe_config->port_clock,
@@ -4389,7 +4377,7 @@ void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
4389 val = I915_READ(reg); 4377 val = I915_READ(reg);
4390 if (index > DRRS_HIGH_RR) { 4378 if (index > DRRS_HIGH_RR) {
4391 val |= PIPECONF_EDP_RR_MODE_SWITCH; 4379 val |= PIPECONF_EDP_RR_MODE_SWITCH;
4392 intel_dp_set_m2_n2(intel_crtc, &config->dp_m2_n2); 4380 intel_dp_set_m_n(intel_crtc);
4393 } else { 4381 } else {
4394 val &= ~PIPECONF_EDP_RR_MODE_SWITCH; 4382 val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
4395 } 4383 }
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4b2664bd5b81..7a3cac095afe 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -324,6 +324,7 @@ struct intel_crtc_config {
324 324
325 /* m2_n2 for eDP downclock */ 325 /* m2_n2 for eDP downclock */
326 struct intel_link_m_n dp_m2_n2; 326 struct intel_link_m_n dp_m2_n2;
327 bool has_drrs;
327 328
328 /* 329 /*
329 * Frequence the dpll for the port should run at. Differs from the 330 * Frequence the dpll for the port should run at. Differs from the
@@ -877,6 +878,7 @@ void hsw_enable_pc8(struct drm_i915_private *dev_priv);
877void hsw_disable_pc8(struct drm_i915_private *dev_priv); 878void hsw_disable_pc8(struct drm_i915_private *dev_priv);
878void intel_dp_get_m_n(struct intel_crtc *crtc, 879void intel_dp_get_m_n(struct intel_crtc *crtc,
879 struct intel_crtc_config *pipe_config); 880 struct intel_crtc_config *pipe_config);
881void intel_dp_set_m_n(struct intel_crtc *crtc);
880int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n); 882int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
881void 883void
882ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config, 884ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,
@@ -892,7 +894,6 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
892int intel_format_to_fourcc(int format); 894int intel_format_to_fourcc(int format);
893void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc); 895void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
894 896
895
896/* intel_dp.c */ 897/* intel_dp.c */
897void intel_dp_init(struct drm_device *dev, int output_reg, enum port port); 898void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
898bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, 899bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,