diff mbox

[08/11] drm/i915: Add port A HPD support for IVB/HSW

Message ID 1439394260-15137-9-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Aug. 12, 2015, 3:44 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

As with ILK/SNB wire up the port A HPD on IVB/HSW.

This might be more important on HSW with PSR. BSpec tells us that if the
automagic link training performed by the hardware fails for some reason,
we're going to get a short HPD and are supposed to re-train the link
manyally.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

Comments

Daniel Vetter Aug. 14, 2015, 9:17 a.m. UTC | #1
On Wed, Aug 12, 2015 at 06:44:17PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> As with ILK/SNB wire up the port A HPD on IVB/HSW.
> 
> This might be more important on HSW with PSR. BSpec tells us that if the
> automagic link training performed by the hardware fails for some reason,
> we're going to get a short HPD and are supposed to re-train the link
> manyally.

Rodrigo, could this be the cause behind our frozen screens? If we get out
of PSR and the hw link train fails then the screen will indeed freeze ...
-Daniel

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c | 34 +++++++++++++++++++++++++++-------
>  1 file changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 152be8b..d994b80 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -49,6 +49,10 @@ static const u32 hpd_ilk[HPD_NUM_PINS] = {
>  	[HPD_PORT_A] = DE_DP_A_HOTPLUG,
>  };
>  
> +static const u32 hpd_ivb[HPD_NUM_PINS] = {
> +	[HPD_PORT_A] = DE_DP_A_HOTPLUG_IVB,
> +};
> +
>  static const u32 hpd_ibx[HPD_NUM_PINS] = {
>  	[HPD_CRT] = SDE_CRT_HOTPLUG,
>  	[HPD_SDVO_B] = SDE_SDVOB_HOTPLUG,
> @@ -1940,6 +1944,19 @@ static void ivb_display_irq_handler(struct drm_device *dev, u32 de_iir)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	enum pipe pipe;
> +	u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG_IVB;
> +
> +	if (hotplug_trigger) {
> +		u32 dig_hotplug_reg, pin_mask, long_mask;
> +
> +		dig_hotplug_reg = I915_READ(DIGITAL_PORT_HOTPLUG_CNTRL);
> +		I915_WRITE(DIGITAL_PORT_HOTPLUG_CNTRL, dig_hotplug_reg);
> +
> +		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
> +				   dig_hotplug_reg, hpd_ivb,
> +				   ilk_port_hotplug_long_detect);
> +		intel_hpd_irq_handler(dev, pin_mask, long_mask);
> +	}
>  
>  	if (de_iir & DE_ERR_INT_IVB)
>  		ivb_err_int_handler(dev);
> @@ -3137,8 +3154,13 @@ static void ilk_hpd_irq_setup(struct drm_device *dev)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u32 hotplug_irqs, hotplug, enabled_irqs;
>  
> -	hotplug_irqs = DE_DP_A_HOTPLUG;
> -	enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
> +	if (INTEL_INFO(dev)->gen >= 7) {
> +		hotplug_irqs = DE_DP_A_HOTPLUG_IVB;
> +		enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ivb);
> +	} else {
> +		hotplug_irqs = DE_DP_A_HOTPLUG;
> +		enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
> +	}
>  
>  	ilk_update_display_irq(dev_priv, hotplug_irqs, enabled_irqs);
>  
> @@ -3245,7 +3267,8 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
>  				DE_PLANEB_FLIP_DONE_IVB |
>  				DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB);
>  		extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB |
> -			      DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB);
> +			      DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB |
> +			      DE_DP_A_HOTPLUG_IVB);
>  	} else {
>  		display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
>  				DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE |
> @@ -4270,10 +4293,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>  		dev->driver->irq_uninstall = ironlake_irq_uninstall;
>  		dev->driver->enable_vblank = ironlake_enable_vblank;
>  		dev->driver->disable_vblank = ironlake_disable_vblank;
> -		if (INTEL_INFO(dev)->gen >= 7)
> -			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
> -		else
> -			dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
> +		dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
>  	} else {
>  		if (INTEL_INFO(dev_priv)->gen == 2) {
>  			dev->driver->irq_preinstall = i8xx_irq_preinstall;
> -- 
> 2.4.6
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Paulo Zanoni Aug. 27, 2015, 6:30 p.m. UTC | #2
2015-08-12 12:44 GMT-03:00  <ville.syrjala@linux.intel.com>:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> As with ILK/SNB wire up the port A HPD on IVB/HSW.
>
> This might be more important on HSW with PSR. BSpec tells us that if the
> automagic link training performed by the hardware fails for some reason,
> we're going to get a short HPD and are supposed to re-train the link
> manyally.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_irq.c | 34 +++++++++++++++++++++++++++-------
>  1 file changed, 27 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 152be8b..d994b80 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -49,6 +49,10 @@ static const u32 hpd_ilk[HPD_NUM_PINS] = {
>         [HPD_PORT_A] = DE_DP_A_HOTPLUG,
>  };
>
> +static const u32 hpd_ivb[HPD_NUM_PINS] = {
> +       [HPD_PORT_A] = DE_DP_A_HOTPLUG_IVB,
> +};
> +
>  static const u32 hpd_ibx[HPD_NUM_PINS] = {
>         [HPD_CRT] = SDE_CRT_HOTPLUG,
>         [HPD_SDVO_B] = SDE_SDVOB_HOTPLUG,
> @@ -1940,6 +1944,19 @@ static void ivb_display_irq_handler(struct drm_device *dev, u32 de_iir)
>  {
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         enum pipe pipe;
> +       u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG_IVB;
> +
> +       if (hotplug_trigger) {
> +               u32 dig_hotplug_reg, pin_mask, long_mask;
> +
> +               dig_hotplug_reg = I915_READ(DIGITAL_PORT_HOTPLUG_CNTRL);
> +               I915_WRITE(DIGITAL_PORT_HOTPLUG_CNTRL, dig_hotplug_reg);
> +
> +               intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
> +                                  dig_hotplug_reg, hpd_ivb,
> +                                  ilk_port_hotplug_long_detect);
> +               intel_hpd_irq_handler(dev, pin_mask, long_mask);
> +       }
>
>         if (de_iir & DE_ERR_INT_IVB)
>                 ivb_err_int_handler(dev);
> @@ -3137,8 +3154,13 @@ static void ilk_hpd_irq_setup(struct drm_device *dev)
>         struct drm_i915_private *dev_priv = dev->dev_private;
>         u32 hotplug_irqs, hotplug, enabled_irqs;
>
> -       hotplug_irqs = DE_DP_A_HOTPLUG;
> -       enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
> +       if (INTEL_INFO(dev)->gen >= 7) {
> +               hotplug_irqs = DE_DP_A_HOTPLUG_IVB;
> +               enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ivb);
> +       } else {
> +               hotplug_irqs = DE_DP_A_HOTPLUG;
> +               enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
> +       }
>
>         ilk_update_display_irq(dev_priv, hotplug_irqs, enabled_irqs);
>
> @@ -3245,7 +3267,8 @@ static int ironlake_irq_postinstall(struct drm_device *dev)
>                                 DE_PLANEB_FLIP_DONE_IVB |
>                                 DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB);
>                 extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB |
> -                             DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB);
> +                             DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB |
> +                             DE_DP_A_HOTPLUG_IVB);
>         } else {
>                 display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
>                                 DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE |
> @@ -4270,10 +4293,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
>                 dev->driver->irq_uninstall = ironlake_irq_uninstall;
>                 dev->driver->enable_vblank = ironlake_enable_vblank;
>                 dev->driver->disable_vblank = ironlake_disable_vblank;
> -               if (INTEL_INFO(dev)->gen >= 7)
> -                       dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
> -               else
> -                       dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
> +               dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
>         } else {
>                 if (INTEL_INFO(dev_priv)->gen == 2) {
>                         dev->driver->irq_preinstall = i8xx_irq_preinstall;
> --
> 2.4.6
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 152be8b..d994b80 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -49,6 +49,10 @@  static const u32 hpd_ilk[HPD_NUM_PINS] = {
 	[HPD_PORT_A] = DE_DP_A_HOTPLUG,
 };
 
+static const u32 hpd_ivb[HPD_NUM_PINS] = {
+	[HPD_PORT_A] = DE_DP_A_HOTPLUG_IVB,
+};
+
 static const u32 hpd_ibx[HPD_NUM_PINS] = {
 	[HPD_CRT] = SDE_CRT_HOTPLUG,
 	[HPD_SDVO_B] = SDE_SDVOB_HOTPLUG,
@@ -1940,6 +1944,19 @@  static void ivb_display_irq_handler(struct drm_device *dev, u32 de_iir)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum pipe pipe;
+	u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG_IVB;
+
+	if (hotplug_trigger) {
+		u32 dig_hotplug_reg, pin_mask, long_mask;
+
+		dig_hotplug_reg = I915_READ(DIGITAL_PORT_HOTPLUG_CNTRL);
+		I915_WRITE(DIGITAL_PORT_HOTPLUG_CNTRL, dig_hotplug_reg);
+
+		intel_get_hpd_pins(&pin_mask, &long_mask, hotplug_trigger,
+				   dig_hotplug_reg, hpd_ivb,
+				   ilk_port_hotplug_long_detect);
+		intel_hpd_irq_handler(dev, pin_mask, long_mask);
+	}
 
 	if (de_iir & DE_ERR_INT_IVB)
 		ivb_err_int_handler(dev);
@@ -3137,8 +3154,13 @@  static void ilk_hpd_irq_setup(struct drm_device *dev)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 hotplug_irqs, hotplug, enabled_irqs;
 
-	hotplug_irqs = DE_DP_A_HOTPLUG;
-	enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
+	if (INTEL_INFO(dev)->gen >= 7) {
+		hotplug_irqs = DE_DP_A_HOTPLUG_IVB;
+		enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ivb);
+	} else {
+		hotplug_irqs = DE_DP_A_HOTPLUG;
+		enabled_irqs = intel_hpd_enabled_irqs(dev, hpd_ilk);
+	}
 
 	ilk_update_display_irq(dev_priv, hotplug_irqs, enabled_irqs);
 
@@ -3245,7 +3267,8 @@  static int ironlake_irq_postinstall(struct drm_device *dev)
 				DE_PLANEB_FLIP_DONE_IVB |
 				DE_PLANEA_FLIP_DONE_IVB | DE_AUX_CHANNEL_A_IVB);
 		extra_mask = (DE_PIPEC_VBLANK_IVB | DE_PIPEB_VBLANK_IVB |
-			      DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB);
+			      DE_PIPEA_VBLANK_IVB | DE_ERR_INT_IVB |
+			      DE_DP_A_HOTPLUG_IVB);
 	} else {
 		display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
 				DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE |
@@ -4270,10 +4293,7 @@  void intel_irq_init(struct drm_i915_private *dev_priv)
 		dev->driver->irq_uninstall = ironlake_irq_uninstall;
 		dev->driver->enable_vblank = ironlake_enable_vblank;
 		dev->driver->disable_vblank = ironlake_disable_vblank;
-		if (INTEL_INFO(dev)->gen >= 7)
-			dev_priv->display.hpd_irq_setup = ibx_hpd_irq_setup;
-		else
-			dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
+		dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
 	} else {
 		if (INTEL_INFO(dev_priv)->gen == 2) {
 			dev->driver->irq_preinstall = i8xx_irq_preinstall;