Re: [Intel-gfx] [PATCH 04/10] drm/i915: add ibx_irq_postinstall

2013-02-09 Thread Daniel Vetter
On Sat, Feb 09, 2013 at 09:27:22AM -0800, Ben Widawsky wrote:
> On Fri,  8 Feb 2013 17:35:15 -0200
> Paulo Zanoni  wrote:
> 
> > From: Paulo Zanoni 
> > 
> > So we can remove duplicated code. Note that this function is used not
> > only on IBX, but also CPT and LPT.
> > 
> > Signed-off-by: Paulo Zanoni 
> Reviewed-by: Ben Widawsky 
> [snip]
Queued for -next, thanks for the patch. I've applied a tiny bikeshed on
top to rename the hotplug enable function for the pch to also use the ibx
prefix. My ocd simply couldn't resist ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 04/10] drm/i915: add ibx_irq_postinstall

2013-02-09 Thread Ben Widawsky
On Fri,  8 Feb 2013 17:35:15 -0200
Paulo Zanoni  wrote:

> From: Paulo Zanoni 
> 
> So we can remove duplicated code. Note that this function is used not
> only on IBX, but also CPT and LPT.
> 
> Signed-off-by: Paulo Zanoni 
Reviewed-by: Ben Widawsky 
[snip]
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 04/10] drm/i915: add ibx_irq_postinstall

2013-02-08 Thread Paulo Zanoni
From: Paulo Zanoni 

So we can remove duplicated code. Note that this function is used not
only on IBX, but also CPT and LPT.

Signed-off-by: Paulo Zanoni 
---
 drivers/gpu/drm/i915/i915_irq.c |   66 ++-
 1 file changed, 24 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index be5289b..f096ad9 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1926,6 +1926,28 @@ static void ironlake_enable_pch_hotplug(struct 
drm_device *dev)
I915_WRITE(PCH_PORT_HOTPLUG, hotplug);
 }
 
+static void ibx_irq_postinstall(struct drm_device *dev)
+{
+   drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+   u32 mask;
+
+   if (HAS_PCH_IBX(dev))
+   mask = SDE_HOTPLUG_MASK |
+  SDE_GMBUS |
+  SDE_AUX_MASK;
+   else
+   mask = SDE_HOTPLUG_MASK_CPT |
+  SDE_GMBUS_CPT |
+  SDE_AUX_MASK_CPT;
+
+   I915_WRITE(SDEIIR, I915_READ(SDEIIR));
+   I915_WRITE(SDEIMR, ~mask);
+   I915_WRITE(SDEIER, mask);
+   POSTING_READ(SDEIER);
+
+   ironlake_enable_pch_hotplug(dev);
+}
+
 static int ironlake_irq_postinstall(struct drm_device *dev)
 {
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -1934,8 +1956,6 @@ static int ironlake_irq_postinstall(struct drm_device 
*dev)
   DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE |
   DE_AUX_CHANNEL_A;
u32 render_irqs;
-   u32 hotplug_mask;
-   u32 pch_irq_mask;
 
dev_priv->irq_mask = ~display_mask;
 
@@ -1963,30 +1983,7 @@ static int ironlake_irq_postinstall(struct drm_device 
*dev)
I915_WRITE(GTIER, render_irqs);
POSTING_READ(GTIER);
 
-   if (HAS_PCH_CPT(dev)) {
-   hotplug_mask = (SDE_CRT_HOTPLUG_CPT |
-   SDE_PORTB_HOTPLUG_CPT |
-   SDE_PORTC_HOTPLUG_CPT |
-   SDE_PORTD_HOTPLUG_CPT |
-   SDE_GMBUS_CPT |
-   SDE_AUX_MASK_CPT);
-   } else {
-   hotplug_mask = (SDE_CRT_HOTPLUG |
-   SDE_PORTB_HOTPLUG |
-   SDE_PORTC_HOTPLUG |
-   SDE_PORTD_HOTPLUG |
-   SDE_GMBUS |
-   SDE_AUX_MASK);
-   }
-
-   pch_irq_mask = ~hotplug_mask;
-
-   I915_WRITE(SDEIIR, I915_READ(SDEIIR));
-   I915_WRITE(SDEIMR, pch_irq_mask);
-   I915_WRITE(SDEIER, hotplug_mask);
-   POSTING_READ(SDEIER);
-
-   ironlake_enable_pch_hotplug(dev);
+   ibx_irq_postinstall(dev);
 
if (IS_IRONLAKE_M(dev)) {
/* Clear & enable PCU event interrupts */
@@ -2009,8 +2006,6 @@ static int ivybridge_irq_postinstall(struct drm_device 
*dev)
DE_PLANEA_FLIP_DONE_IVB |
DE_AUX_CHANNEL_A_IVB;
u32 render_irqs;
-   u32 hotplug_mask;
-   u32 pch_irq_mask;
 
dev_priv->irq_mask = ~display_mask;
 
@@ -2034,20 +2029,7 @@ static int ivybridge_irq_postinstall(struct drm_device 
*dev)
I915_WRITE(GTIER, render_irqs);
POSTING_READ(GTIER);
 
-   hotplug_mask = (SDE_CRT_HOTPLUG_CPT |
-   SDE_PORTB_HOTPLUG_CPT |
-   SDE_PORTC_HOTPLUG_CPT |
-   SDE_PORTD_HOTPLUG_CPT |
-   SDE_GMBUS_CPT |
-   SDE_AUX_MASK_CPT);
-   pch_irq_mask = ~hotplug_mask;
-
-   I915_WRITE(SDEIIR, I915_READ(SDEIIR));
-   I915_WRITE(SDEIMR, pch_irq_mask);
-   I915_WRITE(SDEIER, hotplug_mask);
-   POSTING_READ(SDEIER);
-
-   ironlake_enable_pch_hotplug(dev);
+   ibx_irq_postinstall(dev);
 
return 0;
 }
-- 
1.7.10.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx