From 5b2d15bbd1eeb3d787c8e6459a8cb2645f336050 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Sat, 10 Mar 2018 02:37:27 +0000 Subject: ASoC: dapm: add support to pinctrl dapm Purpose of having pinctrl dapm is to dynamically put the pins in low power state when they are not actively used by the audio and saving power. Without this each driver has to set the pinctrl states, either during probe or dynamically depending on the callbacks received from ASoC core. Signed-off-by: Srinivas Kandagatla Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/sound') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 344b96c206a3..a6ce2de4e20a 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -269,6 +269,13 @@ struct device; .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \ .on_val = wflags} +#define SND_SOC_DAPM_PINCTRL(wname, active, sleep) \ +{ .id = snd_soc_dapm_pinctrl, .name = wname, \ + .priv = (&(struct snd_soc_dapm_pinctrl_priv) \ + { .active_state = active, .sleep_state = sleep,}), \ + .reg = SND_SOC_NOPM, .event = dapm_pinctrl_event, \ + .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } + /* dapm kcontrol types */ @@ -374,6 +381,8 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); int dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); +int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event); /* dapm controls */ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, @@ -500,6 +509,7 @@ enum snd_soc_dapm_type { snd_soc_dapm_pre, /* machine specific pre widget - exec first */ snd_soc_dapm_post, /* machine specific post widget - exec last */ snd_soc_dapm_supply, /* power/clock supply */ + snd_soc_dapm_pinctrl, /* pinctrl */ snd_soc_dapm_regulator_supply, /* external regulator */ snd_soc_dapm_clock_supply, /* external clock */ snd_soc_dapm_aif_in, /* audio interface input */ @@ -581,6 +591,7 @@ struct snd_soc_dapm_widget { void *priv; /* widget specific data */ struct regulator *regulator; /* attached regulator */ + struct pinctrl *pinctrl; /* attached pinctrl */ const struct snd_soc_pcm_stream *params; /* params for dai links */ unsigned int num_params; /* number of params for dai links */ unsigned int params_select; /* currently selected param for dai link */ @@ -683,6 +694,11 @@ struct snd_soc_dapm_stats { int neighbour_checks; }; +struct snd_soc_dapm_pinctrl_priv { + const char *active_state; + const char *sleep_state; +}; + /** * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level * @dapm: The DAPM context to initialize -- cgit v1.2.3-59-g8ed1b