[alsa-devel] [PATCH 3/7] ASoC: WM8903: Handle micdet_cfg more safely

Mark Brown broonie at opensource.wolfsonmicro.com
Fri Feb 11 12:11:44 CET 2011

On Thu, Feb 10, 2011 at 03:37:15PM -0700, Stephen Warren wrote:

> Specifically, if WM8903_MICDET_ENA and WM8903_MICBIAS_ENA are both part of
> micdet_cfg, and a mic is plugged in when the driver initializes, the interrupt
> will fire almost immediately. However, at that point, the micdet interrupt is
> probably still masked, and hence wm8903_irq does not handle it. However, the
> act of reading the interrupt status register in the ISR clears the micdet
> interrupt status, so it is lost.

> To avoid this, refuse to write any fields from micdet_cfg to the register
> except those simply configuring detection thresholds; actual enabling of mic
> detecion should always be implemented by calling wm8903_mic_detect().

As well as being detected via the main interrupt of the WM8903 the
detection signals can also be brought out to the WM8903 GPIOs directly,
allowing detection to operate without any I2C I/O.  That mode can be
configured via platform data only and the WM8903 microphone detection
functions will never be called so the user needs to be able to enable
detection via platform data.

I'll have a think and send something out later today; the easiest thing
is to add more documentation and possibly some sanity checking code in
the platform data parsing.

More information about the Alsa-devel mailing list