[alsa-devel] [PATCH 4/4] ASoC: mid-x86 add jack detect support

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Jan 19 19:54:03 CET 2011

On Wed, Jan 19, 2011 at 10:18:04PM +0530, Koul, Vinod wrote:

> > Since this is a common pattern we should ideally have some utility code
> > which can take any table of ADC values in conjunction with any ADC and
> > use those to do detection.

> Yes the codec reads into the ADC to measure the micbias voltage.
> It has map where we know based on micbais present what kind of accessory maybe
> connected. Since this is entirely codec domain it should be in codec.
> Let me know if you disagree.

Well, the ADC is clearly part of the CODEC but the logic surrounding
walking through the table and coming up with jack statuses to report
based off it isn't, that's a generic thing which should probably be
sitting along with soc-jack.c (possibly in there, possibly as a separate

> > > +static int sn95031_initialize_adc(struct snd_soc_codec *sn95031_codec)
> > > +{
> > > +	int base_addr, chnl_addr;
> > > +	int value;
> > > +	static int channel_index;

> > The functions added in this header look like they'd be better placed in
> > the source file?

> Typically ADC should be a separate driver but we don't have that yet so
> though of adding these as helpers.
> When we get a proper adc driver we can replace this with code calling adc.

I'd suggest putting the bodies of the function into the main CODEC
driver for now.

More information about the Alsa-devel mailing list