alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: vinod.koul@linux.intel.com, broonie@opensource.wolfsonmicro.com,
	lgirdwood@gmail.com, vaibhav.agarwal@intel.com,
	omair.m.abdullah@intel.com,
	Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
Subject: [PATCH] ASoC: Jack: add configurable option for irq_flag
Date: Tue, 12 Feb 2013 11:07:02 +0530	[thread overview]
Message-ID: <1360647422-12404-1-git-send-email-omair.m.abdullah@linux.intel.com> (raw)

From: Vaibhav Agarwal <vaibhav.agarwal@intel.com>

For a jack using GPIO based detection, the framework sets it to trigger on both
edges (rising and falling). Some codecs may provide only a falling or rising edge
interrupt but not both.

This patch provides a configurable option for irq_flag during
snd_soc_jack_add_gpios(). If not configured, it sets the interrupt line to
trigger on both edges.

Signed-off-by: Vaibhav Agarwal <vaibhav.agarwal@intel.com>
Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
---
 include/sound/soc.h  |    2 ++
 sound/soc/soc-jack.c |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index a6a059c..d0286ad 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -585,6 +585,7 @@ struct snd_soc_jack_zone {
  * @report:       value to report when jack detected
  * @invert:       report presence in low state
  * @debouce_time: debouce time in ms
+ * @irq_flag:     Interrupt flags for GPIO-Irq line
  * @wake:	  enable as wake source
  * @jack_status_check: callback function which overrides the detection
  *		       to provide more complex checks (eg, reading an
@@ -597,6 +598,7 @@ struct snd_soc_jack_gpio {
 	int report;
 	int invert;
 	int debounce_time;
+	unsigned long irq_flags;
 	bool wake;
 
 	struct snd_soc_jack *jack;
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 0bb5ccc..c9f7953 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -318,10 +318,13 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
 		INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
 		gpios[i].jack = jack;
 
+		if (!gpios[i].irq_flags)
+			gpios[i].irq_flags =
+				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
+
 		ret = request_any_context_irq(gpio_to_irq(gpios[i].gpio),
 					      gpio_handler,
-					      IRQF_TRIGGER_RISING |
-					      IRQF_TRIGGER_FALLING,
+					      gpios[i].irq_flags,
 					      gpios[i].name,
 					      &gpios[i]);
 		if (ret < 0)
-- 
1.7.4.1

             reply	other threads:[~2013-02-12  5:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  5:37 Omair Mohammed Abdullah [this message]
2013-02-12 11:47 ` [PATCH] ASoC: Jack: add configurable option for irq_flag Mark Brown
2013-02-13  5:39   ` Ramesh Babu
2013-02-13 13:19     ` Mark Brown
2013-02-15  7:10       ` Omair M. Abdullah
2013-02-15 12:17         ` Mark Brown
2013-02-17  6:37           ` Omair M. Abdullah
2013-02-17 18:11             ` Mark Brown
2013-02-18 12:55               ` Omair M. Abdullah
2013-02-18 13:29                 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360647422-12404-1-git-send-email-omair.m.abdullah@linux.intel.com \
    --to=omair.m.abdullah@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    --cc=omair.m.abdullah@intel.com \
    --cc=vaibhav.agarwal@intel.com \
    --cc=vinod.koul@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).