diff options
author | Mark Brown <broonie@linaro.org> | 2013-06-05 14:36:11 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-07 10:54:50 -0400 |
commit | 4616274d3382fa7698536d61b351e63cf0ce27f0 (patch) | |
tree | 8e95ffc206ad5f33eacfd19539e4ba0b16b48f25 /sound | |
parent | 056790923e1c4eed5d8cc502e1092944a2b23025 (diff) |
ASoC: dapm: Treat DAI widgets like AIF widgets for power
Even though they are virtual widgets DAI widgets still get counted for the
DAPM context power management so we can't just use the active state to
check if they should be powered as they may not be part of a complete path.
Instead split them into input and output widgets and do the same power
checks as we perform on AIFs.
Reported-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-dapm.c | 49 | ||||
-rw-r--r-- | sound/soc/soc-pcm.c | 7 |
2 files changed, 32 insertions, 24 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a80c883bb8be..c7051c457b75 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -55,7 +55,8 @@ static int dapm_up_seq[] = { | |||
55 | [snd_soc_dapm_clock_supply] = 1, | 55 | [snd_soc_dapm_clock_supply] = 1, |
56 | [snd_soc_dapm_micbias] = 2, | 56 | [snd_soc_dapm_micbias] = 2, |
57 | [snd_soc_dapm_dai_link] = 2, | 57 | [snd_soc_dapm_dai_link] = 2, |
58 | [snd_soc_dapm_dai] = 3, | 58 | [snd_soc_dapm_dai_in] = 3, |
59 | [snd_soc_dapm_dai_out] = 3, | ||
59 | [snd_soc_dapm_aif_in] = 3, | 60 | [snd_soc_dapm_aif_in] = 3, |
60 | [snd_soc_dapm_aif_out] = 3, | 61 | [snd_soc_dapm_aif_out] = 3, |
61 | [snd_soc_dapm_mic] = 4, | 62 | [snd_soc_dapm_mic] = 4, |
@@ -92,7 +93,8 @@ static int dapm_down_seq[] = { | |||
92 | [snd_soc_dapm_value_mux] = 9, | 93 | [snd_soc_dapm_value_mux] = 9, |
93 | [snd_soc_dapm_aif_in] = 10, | 94 | [snd_soc_dapm_aif_in] = 10, |
94 | [snd_soc_dapm_aif_out] = 10, | 95 | [snd_soc_dapm_aif_out] = 10, |
95 | [snd_soc_dapm_dai] = 10, | 96 | [snd_soc_dapm_dai_in] = 10, |
97 | [snd_soc_dapm_dai_out] = 10, | ||
96 | [snd_soc_dapm_dai_link] = 11, | 98 | [snd_soc_dapm_dai_link] = 11, |
97 | [snd_soc_dapm_clock_supply] = 12, | 99 | [snd_soc_dapm_clock_supply] = 12, |
98 | [snd_soc_dapm_regulator_supply] = 12, | 100 | [snd_soc_dapm_regulator_supply] = 12, |
@@ -419,7 +421,8 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
419 | case snd_soc_dapm_clock_supply: | 421 | case snd_soc_dapm_clock_supply: |
420 | case snd_soc_dapm_aif_in: | 422 | case snd_soc_dapm_aif_in: |
421 | case snd_soc_dapm_aif_out: | 423 | case snd_soc_dapm_aif_out: |
422 | case snd_soc_dapm_dai: | 424 | case snd_soc_dapm_dai_in: |
425 | case snd_soc_dapm_dai_out: | ||
423 | case snd_soc_dapm_hp: | 426 | case snd_soc_dapm_hp: |
424 | case snd_soc_dapm_mic: | 427 | case snd_soc_dapm_mic: |
425 | case snd_soc_dapm_spk: | 428 | case snd_soc_dapm_spk: |
@@ -820,7 +823,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
820 | switch (widget->id) { | 823 | switch (widget->id) { |
821 | case snd_soc_dapm_adc: | 824 | case snd_soc_dapm_adc: |
822 | case snd_soc_dapm_aif_out: | 825 | case snd_soc_dapm_aif_out: |
823 | case snd_soc_dapm_dai: | 826 | case snd_soc_dapm_dai_out: |
824 | if (widget->active) { | 827 | if (widget->active) { |
825 | widget->outputs = snd_soc_dapm_suspend_check(widget); | 828 | widget->outputs = snd_soc_dapm_suspend_check(widget); |
826 | return widget->outputs; | 829 | return widget->outputs; |
@@ -916,7 +919,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
916 | switch (widget->id) { | 919 | switch (widget->id) { |
917 | case snd_soc_dapm_dac: | 920 | case snd_soc_dapm_dac: |
918 | case snd_soc_dapm_aif_in: | 921 | case snd_soc_dapm_aif_in: |
919 | case snd_soc_dapm_dai: | 922 | case snd_soc_dapm_dai_in: |
920 | if (widget->active) { | 923 | if (widget->active) { |
921 | widget->inputs = snd_soc_dapm_suspend_check(widget); | 924 | widget->inputs = snd_soc_dapm_suspend_check(widget); |
922 | return widget->inputs; | 925 | return widget->inputs; |
@@ -1135,16 +1138,6 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) | |||
1135 | return out != 0 && in != 0; | 1138 | return out != 0 && in != 0; |
1136 | } | 1139 | } |
1137 | 1140 | ||
1138 | static int dapm_dai_check_power(struct snd_soc_dapm_widget *w) | ||
1139 | { | ||
1140 | DAPM_UPDATE_STAT(w, power_checks); | ||
1141 | |||
1142 | if (w->active) | ||
1143 | return w->active; | ||
1144 | |||
1145 | return dapm_generic_check_power(w); | ||
1146 | } | ||
1147 | |||
1148 | /* Check to see if an ADC has power */ | 1141 | /* Check to see if an ADC has power */ |
1149 | static int dapm_adc_check_power(struct snd_soc_dapm_widget *w) | 1142 | static int dapm_adc_check_power(struct snd_soc_dapm_widget *w) |
1150 | { | 1143 | { |
@@ -2318,7 +2311,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, | |||
2318 | case snd_soc_dapm_clock_supply: | 2311 | case snd_soc_dapm_clock_supply: |
2319 | case snd_soc_dapm_aif_in: | 2312 | case snd_soc_dapm_aif_in: |
2320 | case snd_soc_dapm_aif_out: | 2313 | case snd_soc_dapm_aif_out: |
2321 | case snd_soc_dapm_dai: | 2314 | case snd_soc_dapm_dai_in: |
2315 | case snd_soc_dapm_dai_out: | ||
2322 | case snd_soc_dapm_dai_link: | 2316 | case snd_soc_dapm_dai_link: |
2323 | list_add(&path->list, &dapm->card->paths); | 2317 | list_add(&path->list, &dapm->card->paths); |
2324 | list_add(&path->list_sink, &wsink->sources); | 2318 | list_add(&path->list_sink, &wsink->sources); |
@@ -3129,10 +3123,12 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3129 | break; | 3123 | break; |
3130 | case snd_soc_dapm_adc: | 3124 | case snd_soc_dapm_adc: |
3131 | case snd_soc_dapm_aif_out: | 3125 | case snd_soc_dapm_aif_out: |
3126 | case snd_soc_dapm_dai_out: | ||
3132 | w->power_check = dapm_adc_check_power; | 3127 | w->power_check = dapm_adc_check_power; |
3133 | break; | 3128 | break; |
3134 | case snd_soc_dapm_dac: | 3129 | case snd_soc_dapm_dac: |
3135 | case snd_soc_dapm_aif_in: | 3130 | case snd_soc_dapm_aif_in: |
3131 | case snd_soc_dapm_dai_in: | ||
3136 | w->power_check = dapm_dac_check_power; | 3132 | w->power_check = dapm_dac_check_power; |
3137 | break; | 3133 | break; |
3138 | case snd_soc_dapm_pga: | 3134 | case snd_soc_dapm_pga: |
@@ -3152,9 +3148,6 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3152 | case snd_soc_dapm_clock_supply: | 3148 | case snd_soc_dapm_clock_supply: |
3153 | w->power_check = dapm_supply_check_power; | 3149 | w->power_check = dapm_supply_check_power; |
3154 | break; | 3150 | break; |
3155 | case snd_soc_dapm_dai: | ||
3156 | w->power_check = dapm_dai_check_power; | ||
3157 | break; | ||
3158 | default: | 3151 | default: |
3159 | w->power_check = dapm_always_on_check_power; | 3152 | w->power_check = dapm_always_on_check_power; |
3160 | break; | 3153 | break; |
@@ -3375,7 +3368,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3375 | template.reg = SND_SOC_NOPM; | 3368 | template.reg = SND_SOC_NOPM; |
3376 | 3369 | ||
3377 | if (dai->driver->playback.stream_name) { | 3370 | if (dai->driver->playback.stream_name) { |
3378 | template.id = snd_soc_dapm_dai; | 3371 | template.id = snd_soc_dapm_dai_in; |
3379 | template.name = dai->driver->playback.stream_name; | 3372 | template.name = dai->driver->playback.stream_name; |
3380 | template.sname = dai->driver->playback.stream_name; | 3373 | template.sname = dai->driver->playback.stream_name; |
3381 | 3374 | ||
@@ -3393,7 +3386,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | |||
3393 | } | 3386 | } |
3394 | 3387 | ||
3395 | if (dai->driver->capture.stream_name) { | 3388 | if (dai->driver->capture.stream_name) { |
3396 | template.id = snd_soc_dapm_dai; | 3389 | template.id = snd_soc_dapm_dai_out; |
3397 | template.name = dai->driver->capture.stream_name; | 3390 | template.name = dai->driver->capture.stream_name; |
3398 | template.sname = dai->driver->capture.stream_name; | 3391 | template.sname = dai->driver->capture.stream_name; |
3399 | 3392 | ||
@@ -3423,8 +3416,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) | |||
3423 | 3416 | ||
3424 | /* For each DAI widget... */ | 3417 | /* For each DAI widget... */ |
3425 | list_for_each_entry(dai_w, &card->widgets, list) { | 3418 | list_for_each_entry(dai_w, &card->widgets, list) { |
3426 | if (dai_w->id != snd_soc_dapm_dai) | 3419 | switch (dai_w->id) { |
3420 | case snd_soc_dapm_dai_in: | ||
3421 | case snd_soc_dapm_dai_out: | ||
3422 | break; | ||
3423 | default: | ||
3427 | continue; | 3424 | continue; |
3425 | } | ||
3428 | 3426 | ||
3429 | dai = dai_w->priv; | 3427 | dai = dai_w->priv; |
3430 | 3428 | ||
@@ -3433,8 +3431,13 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) | |||
3433 | if (w->dapm != dai_w->dapm) | 3431 | if (w->dapm != dai_w->dapm) |
3434 | continue; | 3432 | continue; |
3435 | 3433 | ||
3436 | if (w->id == snd_soc_dapm_dai) | 3434 | switch (w->id) { |
3435 | case snd_soc_dapm_dai_in: | ||
3436 | case snd_soc_dapm_dai_out: | ||
3437 | continue; | 3437 | continue; |
3438 | default: | ||
3439 | break; | ||
3440 | } | ||
3438 | 3441 | ||
3439 | if (!w->sname) | 3442 | if (!w->sname) |
3440 | continue; | 3443 | continue; |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index a9fddf0fea19..ccb6be4d658d 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -928,8 +928,13 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream, | |||
928 | /* Create any new FE <--> BE connections */ | 928 | /* Create any new FE <--> BE connections */ |
929 | for (i = 0; i < list->num_widgets; i++) { | 929 | for (i = 0; i < list->num_widgets; i++) { |
930 | 930 | ||
931 | if (list->widgets[i]->id != snd_soc_dapm_dai) | 931 | switch (list->widgets[i]->id) { |
932 | case snd_soc_dapm_dai_in: | ||
933 | case snd_soc_dapm_dai_out: | ||
934 | break; | ||
935 | default: | ||
932 | continue; | 936 | continue; |
937 | } | ||
933 | 938 | ||
934 | /* is there a valid BE rtd for this widget */ | 939 | /* is there a valid BE rtd for this widget */ |
935 | be = dpcm_get_be(card, list->widgets[i], stream); | 940 | be = dpcm_get_be(card, list->widgets[i], stream); |