aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dapm.h3
-rw-r--r--sound/soc/soc-dapm.c35
2 files changed, 37 insertions, 1 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 5915fc059842..d5d6ba862dfe 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -339,6 +339,8 @@ int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
339int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); 339int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
340int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); 340int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
341int snd_soc_dapm_sync(struct snd_soc_codec *codec); 341int snd_soc_dapm_sync(struct snd_soc_codec *codec);
342int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec,
343 const char *pin);
342 344
343/* dapm widget types */ 345/* dapm widget types */
344enum snd_soc_dapm_type { 346enum snd_soc_dapm_type {
@@ -426,6 +428,7 @@ struct snd_soc_dapm_widget {
426 unsigned char new:1; /* cnew complete */ 428 unsigned char new:1; /* cnew complete */
427 unsigned char ext:1; /* has external widgets */ 429 unsigned char ext:1; /* has external widgets */
428 unsigned char suspend:1; /* was active before suspend */ 430 unsigned char suspend:1; /* was active before suspend */
431 unsigned char force:1; /* force state */
429 432
430 int (*power_check)(struct snd_soc_dapm_widget *w); 433 int (*power_check)(struct snd_soc_dapm_widget *w);
431 434
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