[alsa-devel] [PATCH 3/7] ASoC: WM8903: Handle micdet_cfg more safely
swarren at nvidia.com
Fri Feb 11 17:06:29 CET 2011
Mark Brown wrote at Friday, February 11, 2011 4:12 AM:
> 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.
Oh yes, of course.
Probably the best thing is to disable, then immediately re-enable the
relevant fields (micdet_ena) in the register during wm8903_mic_detect.
That will turn off the HW mic detection module, then start detection
afresh, hence causing the "initial" interrupt to fire when desired.
I'll take a crack at getting that working.
More information about the Alsa-devel