Skip to contentSkip to conversation

ASoC: Add jack_status_check callback function

PATCH Applied Joonyoung Shim 2 participants 2 messages Nov 12, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Add jack_status_check callback function

The jack_status_check callback function is the interface to check the status of the jack. Some target provides the method to distinguish what is the jack inserted - headphone jack, microphone jack, tvout jack, etc, so we can implement it using the jack_status_check function.

---
 include/sound/soc.h  |    2 ++
 sound/soc/soc-jack.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
include/sound/soc.h +2 -0
index 9323dcb..f66773b 100644
@@ -333,6 +333,8 @@ struct snd_soc_jack_gpio {
 	int debounce_time;
 	struct snd_soc_jack *jack;
 	struct work_struct work;
+
+	int (*jack_status_check)(void);
 };
 #endif
 
sound/soc/soc-jack.c +3 -0
index 1212414..3c07a94 100644
@@ -163,6 +163,9 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio)
 	else
 		report = 0;
 
+	if (gpio->jack_status_check)
+		report = gpio->jack_status_check();
+
 	snd_soc_jack_report(jack, report, gpio->report);
 }
 
Signature · 1 line
1.6.0.4
Applied
#1 lore raw
Quoted 4 lines · Joonyoung Shim

The jack_status_check callback function is the interface to check the status of the jack. Some target provides the method to distinguish what is the jack inserted - headphone jack, microphone jack, tvout jack, etc, so we can implement it using the jack_status_check function.

Applied, thanks.

Obviously with some jack detection methods you'd just be using multiple GPIOs but that's not going to work for everything. If someone needs platform data of some kind passing into the jack that could be added later.