diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-07 08:57:11 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-09-26 15:29:59 +0400 |
commit | c05b84d14b230a96e3f782c9d87ab18d82df8bd2 (patch) | |
tree | 8eeac5a8e43a35f399402b9ee84b7e39a31f6d60 /sound | |
parent | 8f6862d4bd6a7f936273d94ba58a25946365eac9 (diff) | |
download | linux-c05b84d14b230a96e3f782c9d87ab18d82df8bd2.tar.xz |
ASoC: dapm: Allow regulators to bypass as well as disable when idle
Allow regulators managed via DAPM to make use of the bypass support that
has recently been added to the regulator API by setting a flag
SND_SOC_DAPM_REGULATOR_BYPASS. When this flag is set the regulator will
be put into bypass mode before being disabled, allowing the regulator to
fall into bypass mode if it can't be disabled due to other users.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-dapm.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 873e6e76ee87..d0a4be38dc0f 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -1017,10 +1017,29 @@ EXPORT_SYMBOL_GPL(dapm_reg_event); int dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { - if (SND_SOC_DAPM_EVENT_ON(event)) + int ret; + + if (SND_SOC_DAPM_EVENT_ON(event)) { + if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { + ret = regulator_allow_bypass(w->regulator, true); + if (ret != 0) + dev_warn(w->dapm->dev, + "Failed to bypass %s: %d\n", + w->name, ret); + } + return regulator_enable(w->regulator); - else + } else { + if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { + ret = regulator_allow_bypass(w->regulator, false); + if (ret != 0) + dev_warn(w->dapm->dev, + "Failed to unbypass %s: %d\n", + w->name, ret); + } + return regulator_disable_deferred(w->regulator, w->shift); + } } EXPORT_SYMBOL_GPL(dapm_regulator_event); |