drm/i915/skl: Use alternate aux power domain for port E

Submitted by Patrik Jakobsson on Nov. 27, 2015, 12:10 p.m.

Details

Message ID 1448626223-8777-1-git-send-email-patrik.jakobsson@linux.intel.com
State New
Headers show
Series "drm/i915/skl: Use alternate aux power domain for port E" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Patrik Jakobsson Nov. 27, 2015, 12:10 p.m.
There is no dedicated aux channel for port E on SKL. Instead the VBT
describes which of the other aux channels to use. When grabbing an aux
power domain for port E we need to take this into account.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++++++----
 drivers/gpu/drm/i915/intel_dp.c      |  2 +-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 17 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0743337..86c89d4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5212,8 +5212,11 @@  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)
+static enum intel_display_power_domain port_to_aux_power_domain(
+			struct drm_i915_private *dev_priv, enum port port)
 {
+	enum port alternate_port;
+
 	switch (port) {
 	case PORT_A:
 		return POWER_DOMAIN_AUX_A;
@@ -5224,7 +5227,14 @@  static enum intel_display_power_domain port_to_aux_power_domain(enum port port)
 	case PORT_D:
 		return POWER_DOMAIN_AUX_D;
 	case PORT_E:
-		/* FIXME: Check VBT for actual wiring of PORT E */
+		if (IS_SKYLAKE(dev_priv)) {
+			alternate_port = skl_porte_aux_port(dev_priv);
+			if (alternate_port != PORT_E)
+				return port_to_aux_power_domain(dev_priv,
+								alternate_port);
+			WARN_ON_ONCE(alternate_port == PORT_E);
+		}
+
 		return POWER_DOMAIN_AUX_D;
 	default:
 		MISSING_CASE(port);
@@ -5263,6 +5273,7 @@  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 drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 
 	switch (intel_encoder->type) {
@@ -5279,10 +5290,10 @@  intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder)
 	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);
+		return port_to_aux_power_domain(dev_priv, 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);
+		return port_to_aux_power_domain(dev_priv, intel_dig_port->port);
 	default:
 		MISSING_CASE(intel_encoder->type);
 		return POWER_DOMAIN_AUX_A;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f2bfca0..81eb558 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1070,7 +1070,7 @@  static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
  * On SKL we don't have Aux for port E so we rely
  * on VBT to set a proper alternate aux channel.
  */
-static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
+enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
 {
 	const struct ddi_vbt_port_info *info =
 		&dev_priv->vbt.ddi_port_info[PORT_E];
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8fae824..1ef2c0e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1248,6 +1248,7 @@  void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
 void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
 uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
 void intel_plane_destroy(struct drm_plane *plane);
+enum port skl_porte_aux_port(struct drm_i915_private *dev_priv);
 void intel_edp_drrs_enable(struct intel_dp *intel_dp);
 void intel_edp_drrs_disable(struct intel_dp *intel_dp);
 void intel_edp_drrs_invalidate(struct drm_device *dev,

Comments

On Fri, Nov 27, 2015 at 01:10:23PM +0100, Patrik Jakobsson wrote:
> There is no dedicated aux channel for port E on SKL. Instead the VBT
> describes which of the other aux channels to use. When grabbing an aux
> power domain for port E we need to take this into account.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++++++----
>  drivers/gpu/drm/i915/intel_dp.c      |  2 +-
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  3 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 0743337..86c89d4 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -5212,8 +5212,11 @@ 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)
> +static enum intel_display_power_domain port_to_aux_power_domain(
> +			struct drm_i915_private *dev_priv, enum port port)
>  {
> +	enum port alternate_port;
> +
>  	switch (port) {
>  	case PORT_A:
>  		return POWER_DOMAIN_AUX_A;
> @@ -5224,7 +5227,14 @@ static enum intel_display_power_domain port_to_aux_power_domain(enum port port)
>  	case PORT_D:
>  		return POWER_DOMAIN_AUX_D;
>  	case PORT_E:
> -		/* FIXME: Check VBT for actual wiring of PORT E */
> +		if (IS_SKYLAKE(dev_priv)) {
> +			alternate_port = skl_porte_aux_port(dev_priv);
> +				return port_to_aux_power_domain(dev_priv,
> +								alternate_port);
> +			WARN_ON_ONCE(alternate_port == PORT_E);
> +		}
> +
>  		return POWER_DOMAIN_AUX_D;
>  	default:
>  		MISSING_CASE(port);
> @@ -5263,6 +5273,7 @@ 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 drm_i915_private *dev_priv = dev->dev_private;
>  	struct intel_digital_port *intel_dig_port;
>  
>  	switch (intel_encoder->type) {
> @@ -5279,10 +5290,10 @@ intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder)
>  	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);
> +		return port_to_aux_power_domain(dev_priv, intel_dig_port->port);

I was rather thinking we'd add an intel_dp->aux_port (or something along
those lines), and then the intel_display_power_domain() would actually
take the "aux port" as the parameter and we don't have to sprinkle
any IS_SKL checks in there. All the port->aux_port logic would be in one
place in the aux_init.

>  	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);
> +		return port_to_aux_power_domain(dev_priv, intel_dig_port->port);
>  	default:
>  		MISSING_CASE(intel_encoder->type);
>  		return POWER_DOMAIN_AUX_A;
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f2bfca0..81eb558 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1070,7 +1070,7 @@ static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
>   * On SKL we don't have Aux for port E so we rely
>   * on VBT to set a proper alternate aux channel.
>   */
> -static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
> +enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
>  {
>  	const struct ddi_vbt_port_info *info =
>  		&dev_priv->vbt.ddi_port_info[PORT_E];
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 8fae824..1ef2c0e 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1248,6 +1248,7 @@ void intel_dp_hot_plug(struct intel_encoder *intel_encoder);
>  void vlv_power_sequencer_reset(struct drm_i915_private *dev_priv);
>  uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes);
>  void intel_plane_destroy(struct drm_plane *plane);
> +enum port skl_porte_aux_port(struct drm_i915_private *dev_priv);
>  void intel_edp_drrs_enable(struct intel_dp *intel_dp);
>  void intel_edp_drrs_disable(struct intel_dp *intel_dp);
>  void intel_edp_drrs_invalidate(struct drm_device *dev,
> -- 
> 2.5.0