aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-15 15:23:37 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-03-16 11:56:10 -0400
commitda34183e640ed380f708bf9ebcd592afda619028 (patch)
treea5c5b3026abd8776ba1491612f6864eb09763f8c /sound/soc/soc-dapm.c
parente82f5cfa6389893e3e17f928d4c4f402b10c79eb (diff)
ASoC: Allow pins to be force enabled
Allow pins to be forced on regardless of their power state. This is intended for use with microphone bias supplies which need to be enabled in order to support microphone detection - in systems without appropriate hardware leaving the microphone unbiased when not in use saves power. The force done at power check time in order to avoid disrupting other power detection logic. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 86ded22e36af..bbb2135a0b21 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -979,7 +979,10 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
979 break; 979 break;
980 980
981 default: 981 default:
982 power = w->power_check(w); 982 if (!w->force)
983 power = w->power_check(w);
984 else
985 power = 1;
983 if (power) 986 if (power)
984 sys_power = 1; 987 sys_power = 1;
985 break; 988 break;
@@ -2134,6 +2137,36 @@ int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin)
2134EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); 2137EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);
2135 2138
2136/** 2139/**
2140 * snd_soc_dapm_force_enable_pin - force a pin to be enabled
2141 * @codec: SoC codec
2142 * @pin: pin name
2143 *
2144 * Enables input/output pin regardless of any other state. This is
2145 * intended for use with microphone bias supplies used in microphone
2146 * jack detection.
2147 *
2148 * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
2149 * do any widget power switching.
2150 */
2151int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, const char *pin)
2152{
2153 struct snd_soc_dapm_widget *w;
2154
2155 list_for_each_entry(w, &codec->dapm_widgets, list) {
2156 if (!strcmp(w->name, pin)) {
2157 pr_debug("dapm: %s: pin %s\n", codec->name, pin);
2158 w->connected = 1;
2159 w->force = 1;
2160 return 0;
2161 }
2162 }
2163
2164 pr_err("dapm: %s: configuring unknown pin %s\n", codec->name, pin);
2165 return -EINVAL;
2166}
2167EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
2168
2169/**
2137 * snd_soc_dapm_disable_pin - disable pin. 2170 * snd_soc_dapm_disable_pin - disable pin.
2138 * @codec: SoC codec 2171 * @codec: SoC codec
2139 * @pin: pin name 2172 * @pin: pin name