Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193341
b: refs/heads/master
c: da34183
h: refs/heads/master
i:
  193339: 5b75dda
v: v3
  • Loading branch information
Mark Brown committed Mar 16, 2010
1 parent c185d7f commit d26a7e4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e82f5cfa6389893e3e17f928d4c4f402b10c79eb
refs/heads/master: da34183e640ed380f708bf9ebcd592afda619028
3 changes: 3 additions & 0 deletions trunk/include/sound/soc-dapm.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
int snd_soc_dapm_sync(struct snd_soc_codec *codec);
int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec,
const char *pin);

/* dapm widget types */
enum snd_soc_dapm_type {
Expand Down Expand Up @@ -426,6 +428,7 @@ struct snd_soc_dapm_widget {
unsigned char new:1; /* cnew complete */
unsigned char ext:1; /* has external widgets */
unsigned char suspend:1; /* was active before suspend */
unsigned char force:1; /* force state */

int (*power_check)(struct snd_soc_dapm_widget *w);

Expand Down
35 changes: 34 additions & 1 deletion trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,10 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
break;

default:
power = w->power_check(w);
if (!w->force)
power = w->power_check(w);
else
power = 1;
if (power)
sys_power = 1;
break;
Expand Down Expand Up @@ -2133,6 +2136,36 @@ int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin)
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin);

/**
* snd_soc_dapm_force_enable_pin - force a pin to be enabled
* @codec: SoC codec
* @pin: pin name
*
* Enables input/output pin regardless of any other state. This is
* intended for use with microphone bias supplies used in microphone
* jack detection.
*
* NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
* do any widget power switching.
*/
int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, const char *pin)
{
struct snd_soc_dapm_widget *w;

list_for_each_entry(w, &codec->dapm_widgets, list) {
if (!strcmp(w->name, pin)) {
pr_debug("dapm: %s: pin %s\n", codec->name, pin);
w->connected = 1;
w->force = 1;
return 0;
}
}

pr_err("dapm: %s: configuring unknown pin %s\n", codec->name, pin);
return -EINVAL;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);

/**
* snd_soc_dapm_disable_pin - disable pin.
* @codec: SoC codec
Expand Down

0 comments on commit d26a7e4

Please sign in to comment.