Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 270617
b: refs/heads/master
c: 7c81beb
h: refs/heads/master
i:
  270615: dd513b0
v: v3
  • Loading branch information
Mark Brown committed Sep 21, 2011
1 parent 0e05093 commit 65b0474
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 53 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: de02d0786d4075091f5b1860474cd21d85ff5862
refs/heads/master: 7c81beb048b49a9fe73254c6e6396e4b1937cdb9
112 changes: 60 additions & 52 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,65 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
}
}

static void dapm_power_one_widget(struct snd_soc_dapm_widget *w,
struct list_head *up_list,
struct list_head *down_list)
{
struct snd_soc_dapm_context *d;
int power;

switch (w->id) {
case snd_soc_dapm_pre:
dapm_seq_insert(w, down_list, false);
break;
case snd_soc_dapm_post:
dapm_seq_insert(w, up_list, true);
break;

default:
if (!w->power_check)
break;

if (!w->force)
power = w->power_check(w);
else
power = 1;

if (power) {
d = w->dapm;

/* Supplies and micbiases only bring the
* context up to STANDBY as unless something
* else is active and passing audio they
* generally don't require full power.
*/
switch (w->id) {
case snd_soc_dapm_supply:
case snd_soc_dapm_micbias:
if (d->target_bias_level < SND_SOC_BIAS_STANDBY)
d->target_bias_level = SND_SOC_BIAS_STANDBY;
break;
default:
d->target_bias_level = SND_SOC_BIAS_ON;
break;
}
}

if (w->power == power)
break;

trace_snd_soc_dapm_widget_power(w, power);

if (power)
dapm_seq_insert(w, up_list, true);
else
dapm_seq_insert(w, down_list, false);

w->power = power;
break;
}
}

/*
* Scan each dapm widget for complete audio path.
* A complete path is a route that has valid endpoints i.e.:-
Expand All @@ -1209,7 +1268,6 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
LIST_HEAD(down_list);
LIST_HEAD(async_domain);
enum snd_soc_bias_level bias;
int power;

trace_snd_soc_dapm_start(card);

Expand All @@ -1228,57 +1286,7 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
* lists indicating if they should be powered up or down.
*/
list_for_each_entry(w, &card->widgets, list) {
switch (w->id) {
case snd_soc_dapm_pre:
dapm_seq_insert(w, &down_list, false);
break;
case snd_soc_dapm_post:
dapm_seq_insert(w, &up_list, true);
break;

default:
if (!w->power_check)
continue;

if (!w->force)
power = w->power_check(w);
else
power = 1;

if (power) {
d = w->dapm;

/* Supplies and micbiases only bring
* the context up to STANDBY as unless
* something else is active and
* passing audio they generally don't
* require full power.
*/
switch (w->id) {
case snd_soc_dapm_supply:
case snd_soc_dapm_micbias:
if (d->target_bias_level < SND_SOC_BIAS_STANDBY)
d->target_bias_level = SND_SOC_BIAS_STANDBY;
break;
default:
d->target_bias_level = SND_SOC_BIAS_ON;
break;
}
}

if (w->power == power)
continue;

trace_snd_soc_dapm_widget_power(w, power);

if (power)
dapm_seq_insert(w, &up_list, true);
else
dapm_seq_insert(w, &down_list, false);

w->power = power;
break;
}
dapm_power_one_widget(w, &up_list, &down_list);
}

/* If there are no DAPM widgets then try to figure out power from the
Expand Down

0 comments on commit 65b0474

Please sign in to comment.