aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-08-18 15:16:06 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-09-04 08:58:52 -0400
commit6491ab27caa2d802b02bfa620a53476ffae5fa3e (patch)
tree6a057f6b185a9814c2dc3019ee33392fcf41ec8d
parent773538e86081d146e0020435d614f4b96996c1f9 (diff)
drm/i915: Be more careful when picking the initial power sequencer pipe
Try to make sure we find the power sequencer that the BIOS used by first looking for one which has the panel power enabled, then fall back to one with VDD force bit enabled, and finally look at just the port select bits. This should make us pick the correct power sequencer when the BIOS has already enabled the panel. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> [danvet: Shorten the vlv_intial_pps_pipe to make lines fit into 80 chars.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 83d2f76cf3e2..b036465e3aa2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -375,9 +375,31 @@ vlv_power_sequencer_pipe(struct intel_dp *intel_dp)
375 return intel_dp->pps_pipe; 375 return intel_dp->pps_pipe;
376} 376}
377 377
378typedef bool (*vlv_pipe_check)(struct drm_i915_private *dev_priv,
379 enum pipe pipe);
380
381static bool vlv_pipe_has_pp_on(struct drm_i915_private *dev_priv,
382 enum pipe pipe)
383{
384 return I915_READ(VLV_PIPE_PP_STATUS(pipe)) & PP_ON;
385}
386
387static bool vlv_pipe_has_vdd_on(struct drm_i915_private *dev_priv,
388 enum pipe pipe)
389{
390 return I915_READ(VLV_PIPE_PP_CONTROL(pipe)) & EDP_FORCE_VDD;
391}
392
393static bool vlv_pipe_any(struct drm_i915_private *dev_priv,
394 enum pipe pipe)
395{
396 return true;
397}
398
378static enum pipe 399static enum pipe
379vlv_initial_power_sequencer_pipe(struct drm_i915_private *dev_priv, 400vlv_initial_pps_pipe(struct drm_i915_private *dev_priv,
380 enum port port) 401 enum port port,
402 vlv_pipe_check pipe_check)
381{ 403{
382 enum pipe pipe; 404 enum pipe pipe;
383 405
@@ -388,6 +410,9 @@ vlv_initial_power_sequencer_pipe(struct drm_i915_private *dev_priv,
388 if (port_sel != PANEL_PORT_SELECT_VLV(port)) 410 if (port_sel != PANEL_PORT_SELECT_VLV(port))
389 continue; 411 continue;
390 412
413 if (!pipe_check(dev_priv, pipe))
414 continue;
415
391 return pipe; 416 return pipe;
392 } 417 }
393 418
@@ -406,7 +431,17 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp)
406 lockdep_assert_held(&dev_priv->pps_mutex); 431 lockdep_assert_held(&dev_priv->pps_mutex);
407 432
408 /* try to find a pipe with this port selected */ 433 /* try to find a pipe with this port selected */
409 intel_dp->pps_pipe = vlv_initial_power_sequencer_pipe(dev_priv, port); 434 /* first pick one where the panel is on */
435 intel_dp->pps_pipe = vlv_initial_pps_pipe(dev_priv, port,
436 vlv_pipe_has_pp_on);
437 /* didn't find one? pick one where vdd is on */
438 if (intel_dp->pps_pipe == INVALID_PIPE)
439 intel_dp->pps_pipe = vlv_initial_pps_pipe(dev_priv, port,
440 vlv_pipe_has_vdd_on);
441 /* didn't find one? pick one with just the correct port */
442 if (intel_dp->pps_pipe == INVALID_PIPE)
443 intel_dp->pps_pipe = vlv_initial_pps_pipe(dev_priv, port,
444 vlv_pipe_any);
410 445
411 /* didn't find one? just let vlv_power_sequencer_pipe() pick one when needed */ 446 /* didn't find one? just let vlv_power_sequencer_pipe() pick one when needed */
412 if (intel_dp->pps_pipe == INVALID_PIPE) { 447 if (intel_dp->pps_pipe == INVALID_PIPE) {