Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1381610
| From | Xing Zheng <zhengxing@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/3] ASoC: jack: Add an export of a function that calls the codec jack detection |
| Date | 2016-04-18 13:30 +0200 |
| Message-ID | <rpfxp-4Gt-39@gated-at.bofh.it> (permalink) |
| References | <rpfxo-4Gt-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch add an export of a function. We can fill the detect_jack
function in the struct snd_soc_codec_driver, and to tell sound machine
driver (simple-card) that the codec supports the jack detection feature.
Then, the machine driver (simple-card) call the export function of the
sound framework to initialize jack detection via the codec.
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
---
Changes in v1:
- clean up the commit message and notes
include/sound/soc.h | 7 +++++++
sound/soc/soc-jack.c | 17 +++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 02b4a21..64e3f4a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -547,6 +547,10 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
}
#endif
+/* call and init jack detect via the codec */
+void snd_soc_jack_codec_detect(struct snd_soc_codec *codec,
+ struct snd_soc_jack *jack);
+
/* codec register bit access */
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
unsigned int mask, unsigned int value);
@@ -920,6 +924,9 @@ struct snd_soc_codec_driver {
enum snd_soc_dapm_type, int);
bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
+
+ /* fill this function if the codec supports jack detection */
+ void (*detect_jack)(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
};
/* SoC platform interface */
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index fbaa1bb..ccaf546 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -436,3 +436,20 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
}
EXPORT_SYMBOL_GPL(snd_soc_jack_free_gpios);
#endif /* CONFIG_GPIOLIB */
+
+/**
+ * snd_soc_jack_codec_detect - Call and init jack detection if the codec support it
+ *
+ * @codec: ASoC codec
+ * @jack: ASoC jack
+ *
+ * Call and initialize the codec jack detection if the codec supports it and fills
+ * the detect_jack function in the struct snd_soc_codec_driver.
+ */
+void snd_soc_jack_codec_detect(struct snd_soc_codec *codec,
+ struct snd_soc_jack *jack)
+{
+ if (codec && codec->driver && codec->driver->detect_jack)
+ codec->driver->detect_jack(codec, jack);
+}
+EXPORT_SYMBOL_GPL(snd_soc_jack_codec_detect);
--
1.7.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 0/3] Add support simple-card parse jack detection via external codec Xing Zheng <zhengxing@rock-chips.com> - 2016-04-18 13:30 +0200 [PATCH v2 2/3] ASoC: simple-card: Add support call the codec jack detection after parse dts Xing Zheng <zhengxing@rock-chips.com> - 2016-04-18 13:30 +0200 [PATCH v2 1/3] ASoC: jack: Add an export of a function that calls the codec jack detection Xing Zheng <zhengxing@rock-chips.com> - 2016-04-18 13:30 +0200
csiph-web