summaryrefslogtreecommitdiff
path: root/sound/soc/soc-jack.c
diff options
context:
space:
mode:
authorBard Liao <bardliao@realtek.com>2017-04-07 11:26:41 +0800
committerMark Brown <broonie@kernel.org>2017-04-10 19:46:09 +0100
commitd7344010d183ad62d1ababca3beb9553cf5e1546 (patch)
treeec8bb158f07de78d0a469040d149837de3982480 /sound/soc/soc-jack.c
parent73548dd316adec41172c31d63a0c35a97bf9577f (diff)
ASoC: jack: add snd_soc_codec_set_jack
There are many codecs with the capability of jack detection. Usually, we create a jack on machine driver but there is no common function for machine driver to deliver the jack pointer to codec driver. snd_soc_codec_set_jack can be used for delivering the jack pointer to codec driver and enable the jack detection function. To make it work, codec driver need to define a callback function to receive the jack pointer and do all necessary procedure for enabling jack detection. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-jack.c')
-rw-r--r--sound/soc/soc-jack.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index a03dcbb94baf..7daf21fee355 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -23,6 +23,24 @@
#include <trace/events/asoc.h>
/**
+ * snd_soc_codec_set_jack - configure codec jack.
+ * @codec: CODEC
+ * @jack: structure to use for the jack
+ * @data: can be used if codec driver need extra data for configuring jack
+ *
+ * Configures and enables jack detection function.
+ */
+int snd_soc_codec_set_jack(struct snd_soc_codec *codec,
+ struct snd_soc_jack *jack, void *data)
+{
+ if (codec->driver->set_jack)
+ return codec->driver->set_jack(codec, jack, data);
+ else
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_codec_set_jack);
+
+/**
* snd_soc_card_jack_new - Create a new jack
* @card: ASoC card
* @id: an identifying string for this jack