Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 157499
b: refs/heads/master
c: 163cac0
h: refs/heads/master
i:
  157497: 55bb8fc
  157495: c722ed6
v: v3
  • Loading branch information
Mark Brown committed Jun 7, 2009
1 parent 973f0b9 commit 25cecd9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 62 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: 38357ab2c83631728afa37a783c9b1bd474a0739
refs/heads/master: 163cac061c97394d4ef9c89efe5921dac937ddb8
122 changes: 61 additions & 61 deletions trunk/sound/soc/soc-dapm.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,55 +707,6 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
return power;
}

/*
* Scan a single DAPM widget for a complete audio path and update the
* power status appropriately.
*/
static int dapm_power_widget(struct snd_soc_codec *codec, int event,
struct snd_soc_dapm_widget *w)
{
int ret;

switch (w->id) {
case snd_soc_dapm_pre:
if (!w->event)
return 0;

if (event == SND_SOC_DAPM_STREAM_START) {
ret = w->event(w,
NULL, SND_SOC_DAPM_PRE_PMU);
if (ret < 0)
return ret;
} else if (event == SND_SOC_DAPM_STREAM_STOP) {
ret = w->event(w,
NULL, SND_SOC_DAPM_PRE_PMD);
if (ret < 0)
return ret;
}
return 0;

case snd_soc_dapm_post:
if (!w->event)
return 0;

if (event == SND_SOC_DAPM_STREAM_START) {
ret = w->event(w,
NULL, SND_SOC_DAPM_POST_PMU);
if (ret < 0)
return ret;
} else if (event == SND_SOC_DAPM_STREAM_STOP) {
ret = w->event(w,
NULL, SND_SOC_DAPM_POST_PMD);
if (ret < 0)
return ret;
}
return 0;

default:
return dapm_generic_apply_power(w);
}
}

static int dapm_seq_compare(struct snd_soc_dapm_widget *a,
struct snd_soc_dapm_widget *b,
int sort[])
Expand All @@ -782,6 +733,65 @@ static void dapm_seq_insert(struct snd_soc_dapm_widget *new_widget,
list_add_tail(&new_widget->power_list, list);
}

/* Apply a DAPM power sequence */
static void dapm_seq_run(struct snd_soc_codec *codec, struct list_head *list,
int event)
{
struct snd_soc_dapm_widget *w;
int ret;

list_for_each_entry(w, list, power_list) {
switch (w->id) {
case snd_soc_dapm_pre:
if (!w->event)
list_for_each_entry_continue(w, list,
power_list);

if (event == SND_SOC_DAPM_STREAM_START) {
ret = w->event(w,
NULL, SND_SOC_DAPM_PRE_PMU);
if (ret < 0)
pr_err("PRE widget failed: %d\n",
ret);
} else if (event == SND_SOC_DAPM_STREAM_STOP) {
ret = w->event(w,
NULL, SND_SOC_DAPM_PRE_PMD);
if (ret < 0)
pr_err("PRE widget failed: %d\n",
ret);
}
break;

case snd_soc_dapm_post:
if (!w->event)
list_for_each_entry_continue(w, list,
power_list);

if (event == SND_SOC_DAPM_STREAM_START) {
ret = w->event(w,
NULL, SND_SOC_DAPM_POST_PMU);
if (ret < 0)
pr_err("POST widget failed: %d\n",
ret);
} else if (event == SND_SOC_DAPM_STREAM_STOP) {
ret = w->event(w,
NULL, SND_SOC_DAPM_POST_PMD);
if (ret < 0)
pr_err("POST widget failed: %d\n",
ret);
}
break;

default:
ret = dapm_generic_apply_power(w);
if (ret < 0)
pr_err("Failed to apply widget power: %d\n",
ret);
break;
}
}
}

/*
* Scan each dapm widget for complete audio path.
* A complete path is a route that has valid endpoints i.e.:-
Expand Down Expand Up @@ -847,20 +857,10 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event)
}

/* Power down widgets first; try to avoid amplifying pops. */
list_for_each_entry(w, &codec->down_list, power_list) {
ret = dapm_power_widget(codec, event, w);
if (ret != 0)
pr_err("Failed to power down %s: %d\n",
w->name, ret);
}
dapm_seq_run(codec, &codec->down_list, event);

/* Now power up. */
list_for_each_entry(w, &codec->up_list, power_list) {
ret = dapm_power_widget(codec, event, w);
if (ret != 0)
pr_err("Failed to power up %s: %d\n",
w->name, ret);
}
dapm_seq_run(codec, &codec->up_list, event);

/* If we just powered the last thing off drop to standby bias */
if (codec->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
Expand Down

0 comments on commit 25cecd9

Please sign in to comment.