From 73548dd316adec41172c31d63a0c35a97bf9577f Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 21 Mar 2017 16:50:43 -0700 Subject: ASoC: jack - check status of GPIO-based pins on resume For GPIO-backed pins that are not configured as wakeup sources, we may miss change in their state that happens while system is suspended. Let's use PM notifier to refresh their state upon resume. Signed-off-by: Dmitry Torokhov Signed-off-by: Mark Brown --- include/sound/soc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/sound') diff --git a/include/sound/soc.h b/include/sound/soc.h index 2b502f6cc6d0..1d20abec4995 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -722,6 +722,7 @@ struct snd_soc_jack_gpio { /* private: */ struct snd_soc_jack *jack; struct delayed_work work; + struct notifier_block pm_notifier; struct gpio_desc *desc; void *data; -- cgit From d7344010d183ad62d1ababca3beb9553cf5e1546 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Fri, 7 Apr 2017 11:26:41 +0800 Subject: 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 Signed-off-by: Mark Brown --- include/sound/soc.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/sound') diff --git a/include/sound/soc.h b/include/sound/soc.h index 1d20abec4995..a6d589c340df 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -434,6 +434,8 @@ int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source, unsigned int freq, int dir); int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, unsigned int freq_in, unsigned int freq_out); +int snd_soc_codec_set_jack(struct snd_soc_codec *codec, + struct snd_soc_jack *jack, void *data); int snd_soc_register_card(struct snd_soc_card *card); int snd_soc_unregister_card(struct snd_soc_card *card); @@ -908,6 +910,8 @@ struct snd_soc_codec_driver { int clk_id, int source, unsigned int freq, int dir); int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source, unsigned int freq_in, unsigned int freq_out); + int (*set_jack)(struct snd_soc_codec *codec, + struct snd_soc_jack *jack, void *data); /* codec IO */ struct regmap *(*get_regmap)(struct device *); -- cgit