[alsa-devel] [PATCH] ASoC: wm8903: disable IRQs during BIAS_OFF

Mark Brown broonie at kernel.org
Mon Sep 9 22:27:26 CEST 2013

On Mon, Sep 09, 2013 at 12:44:49PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren at nvidia.com>
> If the WM8903 IRQ is triggered after the device is suspended, or before
> it is resumed, the underlying I2C bus that the WM8903 is attached to may
> not be available. This may cause the IRQ handler to emit the following
> error:
>     wm8903 0-001a: Failed to read IRQ status: -16
> ... or perhaps even cause a failure inside the I2C driver.
> To prevent this, explicitly mask all interrupt sources when entering
> BIAS_OFF. Also, modify the IRQ handler to immediately return if the
> device is in BIAS_OFF, so that shared interrupt lines don't cause a
> similar problem. This requires that WM8903 interrupts be disabled to
> avoid interrupt storms.
> During resume (actually, the transition back to BIAS_STANDBY), restore
> the desired IRQ mask.

This should be being handled in at a framework level, there's a generic
problem here that affects essentially every device out there which might
need interrupts over suspend (and causes relatively frequent problems).
Your fix also won't help if someone has arranged for the wm8903 mic
detect to be a wake source which you normally want in phone or tablet
type applications but is where this sort of issue most frequently bites
since we'll never turn the device off the interrupt does need to be
asserted to kick off the wake.

Drivers usually work around this by disabling their interrupt with
disable_irq() between suspend() and suspend_late(), then doing the same
thing again between resume_noirq() and resume() covering both the
windows where this can happen.  This preserves the ability to wake from
the interrupt but it's not awesome; ideally genirq would be able to
understand that it can't deliver interrupts to a suspended device but
then of course at the minute genirq has no idea that a device is even
associated with the interrupt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130909/c95917c2/attachment.sig>

More information about the Alsa-devel mailing list