Commit 093e3f13 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Hold the pps mutex across the whole panel power enable sequence

Just grab the pps_mutex once and do all the pps panel startup operations
while holding the mutex instead of grabbing the mutex separately for
each individual step.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 9f0fb5be
...@@ -113,6 +113,7 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector) ...@@ -113,6 +113,7 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
static void intel_dp_link_down(struct intel_dp *intel_dp); static void intel_dp_link_down(struct intel_dp *intel_dp);
static bool edp_panel_vdd_on(struct intel_dp *intel_dp); static bool edp_panel_vdd_on(struct intel_dp *intel_dp);
static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync); static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp);
int int
intel_dp_max_link_bw(struct intel_dp *intel_dp) intel_dp_max_link_bw(struct intel_dp *intel_dp)
...@@ -1539,22 +1540,6 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) ...@@ -1539,22 +1540,6 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
edp_panel_vdd_schedule_off(intel_dp); edp_panel_vdd_schedule_off(intel_dp);
} }
/*
* Must be paired with intel_edp_panel_vdd_on().
* Nested calls to these functions are not allowed since
* we drop the lock. Caller must use some higher level
* locking to prevent nested calls from other threads.
*/
static void intel_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
{
if (!is_edp(intel_dp))
return;
pps_lock(intel_dp);
edp_panel_vdd_off(intel_dp, sync);
pps_unlock(intel_dp);
}
static void edp_panel_on(struct intel_dp *intel_dp) static void edp_panel_on(struct intel_dp *intel_dp)
{ {
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct drm_device *dev = intel_dp_to_dev(intel_dp);
...@@ -2552,10 +2537,19 @@ static void intel_enable_dp(struct intel_encoder *encoder) ...@@ -2552,10 +2537,19 @@ static void intel_enable_dp(struct intel_encoder *encoder)
if (WARN_ON(dp_reg & DP_PORT_EN)) if (WARN_ON(dp_reg & DP_PORT_EN))
return; return;
pps_lock(intel_dp);
if (IS_VALLEYVIEW(dev))
vlv_init_panel_power_sequencer(intel_dp);
intel_dp_enable_port(intel_dp); intel_dp_enable_port(intel_dp);
intel_edp_panel_vdd_on(intel_dp);
intel_edp_panel_on(intel_dp); edp_panel_vdd_on(intel_dp);
intel_edp_panel_vdd_off(intel_dp, true); edp_panel_on(intel_dp);
edp_panel_vdd_off(intel_dp, true);
pps_unlock(intel_dp);
intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON); intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
intel_dp_start_link_train(intel_dp); intel_dp_start_link_train(intel_dp);
intel_dp_complete_link_train(intel_dp); intel_dp_complete_link_train(intel_dp);
...@@ -2633,6 +2627,9 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp) ...@@ -2633,6 +2627,9 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp)
lockdep_assert_held(&dev_priv->pps_mutex); lockdep_assert_held(&dev_priv->pps_mutex);
if (!is_edp(intel_dp))
return;
if (intel_dp->pps_pipe == crtc->pipe) if (intel_dp->pps_pipe == crtc->pipe)
return; return;
...@@ -2687,12 +2684,6 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder) ...@@ -2687,12 +2684,6 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder)
mutex_unlock(&dev_priv->dpio_lock); mutex_unlock(&dev_priv->dpio_lock);
if (is_edp(intel_dp)) {
pps_lock(intel_dp);
vlv_init_panel_power_sequencer(intel_dp);
pps_unlock(intel_dp);
}
intel_enable_dp(encoder); intel_enable_dp(encoder);
vlv_wait_port_ready(dev_priv, dport); vlv_wait_port_ready(dev_priv, dport);
...@@ -2787,12 +2778,6 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder) ...@@ -2787,12 +2778,6 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder)
mutex_unlock(&dev_priv->dpio_lock); mutex_unlock(&dev_priv->dpio_lock);
if (is_edp(intel_dp)) {
pps_lock(intel_dp);
vlv_init_panel_power_sequencer(intel_dp);
pps_unlock(intel_dp);
}
intel_enable_dp(encoder); intel_enable_dp(encoder);
vlv_wait_port_ready(dev_priv, dport); vlv_wait_port_ready(dev_priv, dport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment