Commit a781ce79 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Jani Nikula

drm/i915: Clean up AUX power domain handling

Introduce intel_display_port_aux_power_domain() which simply returns
the appropriate AUX power domain for a specific port, and then replace
the intel_display_port_power_domain() with calls to the new function
in the DP code. As long as we're not actually enabling the port we don't
need the lane power domains, and those are handled now purely from
modeset_update_crtc_power_domains().

My initial motivation for this was to see if I could keep the DPIO power
wells powered down while doing AUX on CHV, but turns out I can't so this
doesn't change anything for CHV at least. But I think it's still a
worthwile change.

v2: Add case for PORT E. Default to POWER_DOMAIN_AUX_D for now. (Ville)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarPatrik Jakobsson <patrik.jakobsson@linux.intel.com>
[Cherry-picked from drm-intel-next-queued 25f78f58 (Imre)]
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1448643329-18675-2-git-send-email-imre.deak@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent bb6d1984
...@@ -5199,6 +5199,26 @@ static enum intel_display_power_domain port_to_power_domain(enum port port) ...@@ -5199,6 +5199,26 @@ static enum intel_display_power_domain port_to_power_domain(enum port port)
} }
} }
static enum intel_display_power_domain port_to_aux_power_domain(enum port port)
{
switch (port) {
case PORT_A:
return POWER_DOMAIN_AUX_A;
case PORT_B:
return POWER_DOMAIN_AUX_B;
case PORT_C:
return POWER_DOMAIN_AUX_C;
case PORT_D:
return POWER_DOMAIN_AUX_D;
case PORT_E:
/* FIXME: Check VBT for actual wiring of PORT E */
return POWER_DOMAIN_AUX_D;
default:
WARN_ON_ONCE(1);
return POWER_DOMAIN_AUX_A;
}
}
#define for_each_power_domain(domain, mask) \ #define for_each_power_domain(domain, mask) \
for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \ for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \
if ((1 << (domain)) & (mask)) if ((1 << (domain)) & (mask))
...@@ -5230,6 +5250,29 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder) ...@@ -5230,6 +5250,29 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder)
} }
} }
enum intel_display_power_domain
intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder)
{
struct drm_device *dev = intel_encoder->base.dev;
struct intel_digital_port *intel_dig_port;
switch (intel_encoder->type) {
case INTEL_OUTPUT_UNKNOWN:
/* Only DDI platforms should ever use this output type */
WARN_ON_ONCE(!HAS_DDI(dev));
case INTEL_OUTPUT_DISPLAYPORT:
case INTEL_OUTPUT_EDP:
intel_dig_port = enc_to_dig_port(&intel_encoder->base);
return port_to_aux_power_domain(intel_dig_port->port);
case INTEL_OUTPUT_DP_MST:
intel_dig_port = enc_to_mst(&intel_encoder->base)->primary;
return port_to_aux_power_domain(intel_dig_port->port);
default:
WARN_ON_ONCE(1);
return POWER_DOMAIN_AUX_A;
}
}
static unsigned long get_crtc_power_domains(struct drm_crtc *crtc) static unsigned long get_crtc_power_domains(struct drm_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
......
...@@ -277,7 +277,7 @@ static void pps_lock(struct intel_dp *intel_dp) ...@@ -277,7 +277,7 @@ static void pps_lock(struct intel_dp *intel_dp)
* See vlv_power_sequencer_reset() why we need * See vlv_power_sequencer_reset() why we need
* a power domain reference here. * a power domain reference here.
*/ */
power_domain = intel_display_port_power_domain(encoder); power_domain = intel_display_port_aux_power_domain(encoder);
intel_display_power_get(dev_priv, power_domain); intel_display_power_get(dev_priv, power_domain);
mutex_lock(&dev_priv->pps_mutex); mutex_lock(&dev_priv->pps_mutex);
...@@ -293,7 +293,7 @@ static void pps_unlock(struct intel_dp *intel_dp) ...@@ -293,7 +293,7 @@ static void pps_unlock(struct intel_dp *intel_dp)
mutex_unlock(&dev_priv->pps_mutex); mutex_unlock(&dev_priv->pps_mutex);
power_domain = intel_display_port_power_domain(encoder); power_domain = intel_display_port_aux_power_domain(encoder);
intel_display_power_put(dev_priv, power_domain); intel_display_power_put(dev_priv, power_domain);
} }
...@@ -816,8 +816,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, ...@@ -816,8 +816,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
intel_dp_check_edp(intel_dp); intel_dp_check_edp(intel_dp);
intel_aux_display_runtime_get(dev_priv);
/* Try to wait for any previous AUX channel activity */ /* Try to wait for any previous AUX channel activity */
for (try = 0; try < 3; try++) { for (try = 0; try < 3; try++) {
status = I915_READ_NOTRACE(ch_ctl); status = I915_READ_NOTRACE(ch_ctl);
...@@ -926,7 +924,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, ...@@ -926,7 +924,6 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
ret = recv_bytes; ret = recv_bytes;
out: out:
pm_qos_update_request(&dev_priv->pm_qos, PM_QOS_DEFAULT_VALUE); pm_qos_update_request(&dev_priv->pm_qos, PM_QOS_DEFAULT_VALUE);
intel_aux_display_runtime_put(dev_priv);
if (vdd) if (vdd)
edp_panel_vdd_off(intel_dp, false); edp_panel_vdd_off(intel_dp, false);
...@@ -1784,7 +1781,7 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp) ...@@ -1784,7 +1781,7 @@ static bool edp_panel_vdd_on(struct intel_dp *intel_dp)
if (edp_have_panel_vdd(intel_dp)) if (edp_have_panel_vdd(intel_dp))
return need_to_disable; return need_to_disable;
power_domain = intel_display_port_power_domain(intel_encoder); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_get(dev_priv, power_domain); intel_display_power_get(dev_priv, power_domain);
DRM_DEBUG_KMS("Turning eDP port %c VDD on\n", DRM_DEBUG_KMS("Turning eDP port %c VDD on\n",
...@@ -1874,7 +1871,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp) ...@@ -1874,7 +1871,7 @@ static void edp_panel_vdd_off_sync(struct intel_dp *intel_dp)
if ((pp & POWER_TARGET_ON) == 0) if ((pp & POWER_TARGET_ON) == 0)
intel_dp->last_power_cycle = jiffies; intel_dp->last_power_cycle = jiffies;
power_domain = intel_display_port_power_domain(intel_encoder); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_put(dev_priv, power_domain); intel_display_power_put(dev_priv, power_domain);
} }
...@@ -2025,7 +2022,7 @@ static void edp_panel_off(struct intel_dp *intel_dp) ...@@ -2025,7 +2022,7 @@ static void edp_panel_off(struct intel_dp *intel_dp)
wait_panel_off(intel_dp); wait_panel_off(intel_dp);
/* We got a reference when we enabled the VDD. */ /* We got a reference when we enabled the VDD. */
power_domain = intel_display_port_power_domain(intel_encoder); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_put(dev_priv, power_domain); intel_display_power_put(dev_priv, power_domain);
} }
...@@ -4765,26 +4762,6 @@ intel_dp_unset_edid(struct intel_dp *intel_dp) ...@@ -4765,26 +4762,6 @@ intel_dp_unset_edid(struct intel_dp *intel_dp)
intel_dp->has_audio = false; intel_dp->has_audio = false;
} }
static enum intel_display_power_domain
intel_dp_power_get(struct intel_dp *dp)
{
struct intel_encoder *encoder = &dp_to_dig_port(dp)->base;
enum intel_display_power_domain power_domain;
power_domain = intel_display_port_power_domain(encoder);
intel_display_power_get(to_i915(encoder->base.dev), power_domain);
return power_domain;
}
static void
intel_dp_power_put(struct intel_dp *dp,
enum intel_display_power_domain power_domain)
{
struct intel_encoder *encoder = &dp_to_dig_port(dp)->base;
intel_display_power_put(to_i915(encoder->base.dev), power_domain);
}
static enum drm_connector_status static enum drm_connector_status
intel_dp_detect(struct drm_connector *connector, bool force) intel_dp_detect(struct drm_connector *connector, bool force)
{ {
...@@ -4808,7 +4785,8 @@ intel_dp_detect(struct drm_connector *connector, bool force) ...@@ -4808,7 +4785,8 @@ intel_dp_detect(struct drm_connector *connector, bool force)
return connector_status_disconnected; return connector_status_disconnected;
} }
power_domain = intel_dp_power_get(intel_dp); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_get(to_i915(dev), power_domain);
/* Can't disconnect eDP, but you can close the lid... */ /* Can't disconnect eDP, but you can close the lid... */
if (is_edp(intel_dp)) if (is_edp(intel_dp))
...@@ -4853,7 +4831,7 @@ intel_dp_detect(struct drm_connector *connector, bool force) ...@@ -4853,7 +4831,7 @@ intel_dp_detect(struct drm_connector *connector, bool force)
} }
out: out:
intel_dp_power_put(intel_dp, power_domain); intel_display_power_put(to_i915(dev), power_domain);
return status; return status;
} }
...@@ -4862,6 +4840,7 @@ intel_dp_force(struct drm_connector *connector) ...@@ -4862,6 +4840,7 @@ intel_dp_force(struct drm_connector *connector)
{ {
struct intel_dp *intel_dp = intel_attached_dp(connector); struct intel_dp *intel_dp = intel_attached_dp(connector);
struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base;
struct drm_i915_private *dev_priv = to_i915(intel_encoder->base.dev);
enum intel_display_power_domain power_domain; enum intel_display_power_domain power_domain;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
...@@ -4871,11 +4850,12 @@ intel_dp_force(struct drm_connector *connector) ...@@ -4871,11 +4850,12 @@ intel_dp_force(struct drm_connector *connector)
if (connector->status != connector_status_connected) if (connector->status != connector_status_connected)
return; return;
power_domain = intel_dp_power_get(intel_dp); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_get(dev_priv, power_domain);
intel_dp_set_edid(intel_dp); intel_dp_set_edid(intel_dp);
intel_dp_power_put(intel_dp, power_domain); intel_display_power_put(dev_priv, power_domain);
if (intel_encoder->type != INTEL_OUTPUT_EDP) if (intel_encoder->type != INTEL_OUTPUT_EDP)
intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT; intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
...@@ -5091,7 +5071,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) ...@@ -5091,7 +5071,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp)
* indefinitely. * indefinitely.
*/ */
DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n"); DRM_DEBUG_KMS("VDD left on by BIOS, adjusting state tracking\n");
power_domain = intel_display_port_power_domain(&intel_dig_port->base); power_domain = intel_display_port_aux_power_domain(&intel_dig_port->base);
intel_display_power_get(dev_priv, power_domain); intel_display_power_get(dev_priv, power_domain);
edp_panel_vdd_schedule_off(intel_dp); edp_panel_vdd_schedule_off(intel_dp);
...@@ -5173,7 +5153,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) ...@@ -5173,7 +5153,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
port_name(intel_dig_port->port), port_name(intel_dig_port->port),
long_hpd ? "long" : "short"); long_hpd ? "long" : "short");
power_domain = intel_display_port_power_domain(intel_encoder); power_domain = intel_display_port_aux_power_domain(intel_encoder);
intel_display_power_get(dev_priv, power_domain); intel_display_power_get(dev_priv, power_domain);
if (long_hpd) { if (long_hpd) {
......
...@@ -1169,6 +1169,8 @@ void hsw_enable_ips(struct intel_crtc *crtc); ...@@ -1169,6 +1169,8 @@ void hsw_enable_ips(struct intel_crtc *crtc);
void hsw_disable_ips(struct intel_crtc *crtc); void hsw_disable_ips(struct intel_crtc *crtc);
enum intel_display_power_domain enum intel_display_power_domain
intel_display_port_power_domain(struct intel_encoder *intel_encoder); intel_display_port_power_domain(struct intel_encoder *intel_encoder);
enum intel_display_power_domain
intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder);
void intel_mode_from_pipe_config(struct drm_display_mode *mode, void intel_mode_from_pipe_config(struct drm_display_mode *mode,
struct intel_crtc_state *pipe_config); struct intel_crtc_state *pipe_config);
void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc); void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
......
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