[alsa-devel] [PATCH] ASoC: Add GPIO support for jack reporting interface

Mark Brown broonie at sirena.org.uk
Tue Mar 3 12:14:41 CET 2009

On Mon, Mar 02, 2009 at 07:05:28PM -0600, Lopez Cruz, Misael wrote:

This is much better than last time, thanks!  Some issues do remain,
though (as well as those that Takashi mentioned):

> +int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
> +			  struct snd_soc_jack_gpio *gpios);
> +void snd_soc_jack_free_gpios(struct snd_soc_jack *jack);

snd_soc_jack_free_gpios() shouild take the same arguments as the add...

>  struct snd_soc_jack {
>  	struct snd_jack *jack;
>  	struct snd_soc_card *card;
>  	struct list_head pins;
> +	struct snd_soc_jack_gpio *gpios;
> +	int gpio_count;
>  	int status;
>  };

...so (as previously discussed) you don't have this.  The jack shouldn't
need this information and it's only used to free things at the minute.

Consider how this will scale: if the jack detection method for every
codec were to add back pointers to the snd_soc_jack structure then you'd
rapidly find that the bulk of the structure is taken up with these back

> +	enable = gpio_get_value(gpio->gpio);
> +	if (gpio->invert)
> +		enable != enable;

I think you mean enable = !enable here (I'm surprised the compiler
doesn't warn about this).

More information about the Alsa-devel mailing list