[alsa-devel] [PATCH 2/3] ASoC: mfld_machine: Add support for jack detection

Mark Brown broonie at opensource.wolfsonmicro.com
Wed Feb 9 14:55:06 CET 2011


On Wed, Feb 09, 2011 at 02:42:26PM +0530, Koul, Vinod wrote:

> +	sn95031_jack_detection(&jack_data);
> +	/* If american headest, program the gpio control registers */
> +	if (jack_data.micbias_vol >=  MFLD_MV_HP &&
> +		jack_data.micbias_vol <  MFLD_MV_HS)
> +		snd_soc_update_bits(mfld_jack.codec, SN95031_AUDIO_GPIO_CTRL,
> +				BIT(1), BIT(1));
> +	else
> +		snd_soc_update_bits(mfld_jack.codec, SN95031_AUDIO_GPIO_CTRL,
> +				BIT(1), BIT(0));

This looks like the CODEC driver should be exporting gpiolib support -
that'd make it much easier for others to reuse the GPIOs in their
designs (eg, powering external amplifiers).

> +static irqreturn_t snd_mfld_jack_intr_handler(int irq, void *dev)
> +{
> +	struct mfld_mc_private *mc_private = (struct mfld_mc_private *) dev;
> +
> +	memcpy_fromio(&mc_private->interrupt_status,
> +			((void *)(mc_private->int_base)),
> +			sizeof(u8));
> +	return IRQ_WAKE_THREAD;
> +}

Seems like it'd be as easy to do the copy in the main interrupt handler
rather than bothering with having a primary handler but it doesn't
really matter.


More information about the Alsa-devel mailing list