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

Lopez Cruz, Misael x0052729 at ti.com
Fri Feb 27 11:52:35 CET 2009

> >  struct snd_soc_jack_pin {
> > +	struct snd_soc_jack *jack;
> > +	struct snd_soc_jack_gpio *gpio_pin;
> >  	struct list_head list;
> >  	const char *pin;
> >  	int mask;
> >  	bool invert;
> > +	/* GPIO */
> > +	unsigned int gpio;
> > +	unsigned int irq;
> > +	unsigned long irqflags;
> > +	irq_handler_t handler;
> > +	struct work_struct work;
> >  };
> This needs to be rethought - it breaks the abstraction layers.

Ok, I see. Here is the new plan:

* Create a new structure "snd_soc_jack_gpio" holding info specific for a
  gpio pin like: gpio, irq, irqflags, irqhandler, private data (to be
  passed to irqhandler).

* Create a new function "snd_soc_jack_add_gpios" to add all jack_gpios that
  belong to a specific jack. This function should add all gpio pin references
  in a linked list as it's done for dapm pins. The linked list will be
  useful to be able to release acquired resources in another function

* Machine driver will be responsible to call add_gpios function passing an
  array of gpios related to each jack.

* Machine driver will tie each jack_gpio with corresponding jack in a
  machine specific jack_data structure, one hook per jack_gpio in the jack.
  A handler will also be associated to the jack_data structure. This
  jack_data struct will be passed to the gpio irqhandler as private data.


More information about the Alsa-devel mailing list