aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
authorLopez Cruz, Misael <x0052729@ti.com>2009-03-03 16:25:04 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-03-04 09:47:38 -0500
commitec67624d33d5639bcc6ee6918cb1fc0bd1bac3a8 (patch)
tree301f1d4ae2f47cca1c7412ce49e7574de8b0dfd2 /include/sound/soc.h
parent5f2a9384a9291d898b4bf85c4fbf497eef582977 (diff)
ASoC: Add GPIO support for jack reporting interface
Add GPIO support to jack reporting framework in ASoC using gpiolib calls. The gpio support exports two new functions: snd_soc_jack_add_gpios and snd_soc_jack_free_gpios. Client drivers using gpio feature must pass an array of jack_gpio pins belonging to a specific jack to the snd_soc_jack_add_gpios function. The framework will request the gpios, set the data direction and request irq. The framework will update power status of related jack_pins when an event on the gpio pins comes according to the reporting bits defined for each gpio. All gpio resources allocated when adding jack_gpio pins can be released using snd_soc_jack_free_gpios function. Signed-off-by: Misael Lopez Cruz <x0052729@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0e7735264169..a40bc6f316fc 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -16,6 +16,8 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <linux/interrupt.h>
20#include <linux/kernel.h>
19#include <sound/core.h> 21#include <sound/core.h>
20#include <sound/pcm.h> 22#include <sound/pcm.h>
21#include <sound/control.h> 23#include <sound/control.h>
@@ -168,6 +170,9 @@ struct soc_enum;
168struct snd_soc_ac97_ops; 170struct snd_soc_ac97_ops;
169struct snd_soc_jack; 171struct snd_soc_jack;
170struct snd_soc_jack_pin; 172struct snd_soc_jack_pin;
173#ifdef CONFIG_GPIOLIB
174struct snd_soc_jack_gpio;
175#endif
171 176
172typedef int (*hw_write_t)(void *,const char* ,int); 177typedef int (*hw_write_t)(void *,const char* ,int);
173typedef int (*hw_read_t)(void *,char* ,int); 178typedef int (*hw_read_t)(void *,char* ,int);
@@ -194,6 +199,12 @@ int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
194void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 199void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
195int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 200int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
196 struct snd_soc_jack_pin *pins); 201 struct snd_soc_jack_pin *pins);
202#ifdef CONFIG_GPIOLIB
203int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
204 struct snd_soc_jack_gpio *gpios);
205void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
206 struct snd_soc_jack_gpio *gpios);
207#endif
197 208
198/* codec IO */ 209/* codec IO */
199#define snd_soc_read(codec, reg) codec->read(codec, reg) 210#define snd_soc_read(codec, reg) codec->read(codec, reg)
@@ -264,6 +275,27 @@ struct snd_soc_jack_pin {
264 bool invert; 275 bool invert;
265}; 276};
266 277
278/**
279 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
280 *
281 * @gpio: gpio number
282 * @name: gpio name
283 * @report: value to report when jack detected
284 * @invert: report presence in low state
285 * @debouce_time: debouce time in ms
286 */
287#ifdef CONFIG_GPIOLIB
288struct snd_soc_jack_gpio {
289 unsigned int gpio;
290 const char *name;
291 int report;
292 int invert;
293 int debounce_time;
294 struct snd_soc_jack *jack;
295 struct work_struct work;
296};
297#endif
298
267struct snd_soc_jack { 299struct snd_soc_jack {
268 struct snd_jack *jack; 300 struct snd_jack *jack;
269 struct snd_soc_card *card; 301 struct snd_soc_card *card;