aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-17 19:35:55 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-02-18 12:14:14 -0500
commit7887ab3a274dc5f1d1d94ca0cd41ae495d01f94f (patch)
tree9182cd4d0c2c857688520a50f733d1c9f690039c
parent5a9f91ca7994bd6a7c696fd397716da3bb440921 (diff)
ASoC: Allow GPIO jack detection to be configured as a wake source
Some systems wish to use jacks as wake sources. Provide a wake flag in the GPIO configuration which causes the driver to enable the IRQ as a wake source. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--include/sound/soc.h3
-rw-r--r--sound/soc/soc-jack.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4ccf1e4e0dd0..fb57c33482e5 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -436,6 +436,7 @@ struct snd_soc_jack_zone {
436 * @report: value to report when jack detected 436 * @report: value to report when jack detected
437 * @invert: report presence in low state 437 * @invert: report presence in low state
438 * @debouce_time: debouce time in ms 438 * @debouce_time: debouce time in ms
439 * @wake: enable as wake source
439 */ 440 */
440#ifdef CONFIG_GPIOLIB 441#ifdef CONFIG_GPIOLIB
441struct snd_soc_jack_gpio { 442struct snd_soc_jack_gpio {
@@ -444,6 +445,8 @@ struct snd_soc_jack_gpio {
444 int report; 445 int report;
445 int invert; 446 int invert;
446 int debounce_time; 447 int debounce_time;
448 bool wake;
449
447 struct snd_soc_jack *jack; 450 struct snd_soc_jack *jack;
448 struct delayed_work work; 451 struct delayed_work work;
449 452
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 4579ee090bbf..1382251ed2a2 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -330,6 +330,14 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
330 if (ret) 330 if (ret)
331 goto err; 331 goto err;
332 332
333 if (gpios[i].wake) {
334 ret = set_irq_wake(gpio_to_irq(gpios[i].gpio), 1);
335 if (ret != 0)
336 printk(KERN_ERR
337 "Failed to mark GPIO %d as wake source: %d\n",
338 gpios[i].gpio, ret);
339 }
340
333#ifdef CONFIG_GPIO_SYSFS 341#ifdef CONFIG_GPIO_SYSFS
334 /* Expose GPIO value over sysfs for diagnostic purposes */ 342 /* Expose GPIO value over sysfs for diagnostic purposes */
335 gpio_export(gpios[i].gpio, false); 343 gpio_export(gpios[i].gpio, false);