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

drm/i915: Factor out ilk_update_display_irq()

Extract the core of ironlake_{enable,disable}_display_irq() into a new
function. We'll have further use for it later.

v2: Warn about invalid mask vs. enable bits (Paulo)
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 87a02106
...@@ -154,35 +154,46 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = { ...@@ -154,35 +154,46 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir); static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir);
/* For display hotplug interrupt */ /**
void * ilk_update_display_irq - update DEIMR
ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask) * @dev_priv: driver private
* @interrupt_mask: mask of interrupt bits to update
* @enabled_irq_mask: mask of interrupt bits to enable
*/
static void ilk_update_display_irq(struct drm_i915_private *dev_priv,
uint32_t interrupt_mask,
uint32_t enabled_irq_mask)
{ {
uint32_t new_val;
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
WARN_ON(enabled_irq_mask & ~interrupt_mask);
if (WARN_ON(!intel_irqs_enabled(dev_priv))) if (WARN_ON(!intel_irqs_enabled(dev_priv)))
return; return;
if ((dev_priv->irq_mask & mask) != 0) { new_val = dev_priv->irq_mask;
dev_priv->irq_mask &= ~mask; new_val &= ~interrupt_mask;
new_val |= (~enabled_irq_mask & interrupt_mask);
if (new_val != dev_priv->irq_mask) {
dev_priv->irq_mask = new_val;
I915_WRITE(DEIMR, dev_priv->irq_mask); I915_WRITE(DEIMR, dev_priv->irq_mask);
POSTING_READ(DEIMR); POSTING_READ(DEIMR);
} }
} }
void void
ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask) ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask)
{ {
assert_spin_locked(&dev_priv->irq_lock); ilk_update_display_irq(dev_priv, mask, mask);
}
if (WARN_ON(!intel_irqs_enabled(dev_priv)))
return;
if ((dev_priv->irq_mask & mask) != mask) { void
dev_priv->irq_mask |= mask; ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask)
I915_WRITE(DEIMR, dev_priv->irq_mask); {
POSTING_READ(DEIMR); ilk_update_display_irq(dev_priv, mask, 0);
}
} }
/** /**
......
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