Skip to content

Commit 96a85cc

Browse files
vsyrjalarodrigovivi
authored andcommitted
drm/i915: Fix hotplug irq ack on i965/g4x
Just like with PIPESTAT, the edge triggered IIR on i965/g4x also causes problems for hotplug interrupts. To make sure we don't get the IIR port interrupt bit stuck low with the ISR bit high we must force an edge in ISR. Unfortunately we can't borrow the PIPESTAT trick and toggle the enable bits in PORT_HOTPLUG_EN as that act itself generates hotplug interrupts. Instead we just have to loop until we've cleared PORT_HOTPLUG_STAT, or we just give up and WARN. v2: Don't frob with PORT_HOTPLUG_EN Cc: stable@vger.kernel.org Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180614175625.1615-1-ville.syrjala@linux.intel.com Reviewed-by: Imre Deak <imre.deak@intel.com> (cherry picked from commit 0ba7c51) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 1e4b044 commit 96a85cc

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

‎drivers/gpu/drm/i915/i915_irq.c‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,10 +1998,38 @@ static void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv,
19981998

19991999
static u32 i9xx_hpd_irq_ack(struct drm_i915_private *dev_priv)
20002000
{
2001-
u32 hotplug_status = I915_READ(PORT_HOTPLUG_STAT);
2001+
u32 hotplug_status = 0, hotplug_status_mask;
2002+
int i;
2003+
2004+
if (IS_G4X(dev_priv) ||
2005+
IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
2006+
hotplug_status_mask = HOTPLUG_INT_STATUS_G4X |
2007+
DP_AUX_CHANNEL_MASK_INT_STATUS_G4X;
2008+
else
2009+
hotplug_status_mask = HOTPLUG_INT_STATUS_I915;
20022010

2003-
if (hotplug_status)
2011+
/*
2012+
* We absolutely have to clear all the pending interrupt
2013+
* bits in PORT_HOTPLUG_STAT. Otherwise the ISR port
2014+
* interrupt bit won't have an edge, and the i965/g4x
2015+
* edge triggered IIR will not notice that an interrupt
2016+
* is still pending. We can't use PORT_HOTPLUG_EN to
2017+
* guarantee the edge as the act of toggling the enable
2018+
* bits can itself generate a new hotplug interrupt :(
2019+
*/
2020+
for (i = 0; i < 10; i++) {
2021+
u32 tmp = I915_READ(PORT_HOTPLUG_STAT) & hotplug_status_mask;
2022+
2023+
if (tmp == 0)
2024+
return hotplug_status;
2025+
2026+
hotplug_status |= tmp;
20042027
I915_WRITE(PORT_HOTPLUG_STAT, hotplug_status);
2028+
}
2029+
2030+
WARN_ONCE(1,
2031+
"PORT_HOTPLUG_STAT did not clear (0x%08x)\n",
2032+
I915_READ(PORT_HOTPLUG_STAT));
20052033

20062034
return hotplug_status;
20072035
}

0 commit comments

Comments
 (0)