ASoC: jack: Add API report sock jack without DAPM sync
Currently snd_soc_jack_report() always acquires codec->mutex and
synchronize DAPM widgets. This automation is helpful if jack has defined
widget. However if codec driver doesn't have defined jack widget and
non-jack widget wants to synchronize with report_sock_jack's thread which
is usually irq handler, it can make dead-lock as all DAPM widget
call-backs are called after codec->mutex acquisition.
Add new API snd_soc_jack_report_no_dapm() so codec driver can have ability
of control DAPM synchronization part of snd_soc_jack_report()
Change-Id: Ifc6054cd8b6d8a6b52517cf84baca1e3949e09fe
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index fa31d9c..c1590ca 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -113,6 +113,23 @@
EXPORT_SYMBOL_GPL(snd_soc_jack_report);
/**
+ * snd_soc_jack_report_no_dapm - Report the current status for a jack
+ * without DAPM sync
+ * @jack: the jack
+ * @status: a bitmask of enum snd_jack_type values that are currently detected.
+ * @mask: a bitmask of enum snd_jack_type values that being reported.
+ */
+void snd_soc_jack_report_no_dapm(struct snd_soc_jack *jack, int status,
+ int mask)
+{
+ jack->status &= ~mask;
+ jack->status |= status & mask;
+
+ snd_jack_report(jack->jack, jack->status);
+}
+EXPORT_SYMBOL_GPL(snd_soc_jack_report_no_dapm);
+
+/**
* snd_soc_jack_add_zones - Associate voltage zones with jack
*
* @jack: ASoC jack