diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-22 12:48:15 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-25 08:51:22 -0500 |
commit | 8af294b472067e9034fe288d912455cc0961d1b9 (patch) | |
tree | b066db8681e6220a3b8ddbc83d2f820a7450fb4e /sound/soc/soc-dapm.c | |
parent | 19f949f52599ba7c3f67a5897ac6be14bfcb1200 (diff) |
ASoC: dapm: Fix handling of loops
Currently if a path loops back on itself we correctly skip over it to
avoid going into an infinite loop but this causes us to ignore the need
to power up the path as we don't count the loop for the purposes of
counting inputs and outputs. This means that internal loopbacks within a
device that have powered devices on them won't be powered up.
Fix this by treating any path that is currently in the process of being
recursed as having a single input or output so that it is counted for
the purposes of power decisions.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 258acadb9e7d..f3255517de79 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -821,6 +821,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
821 | (widget->id == snd_soc_dapm_line && | 821 | (widget->id == snd_soc_dapm_line && |
822 | !list_empty(&widget->sources))) { | 822 | !list_empty(&widget->sources))) { |
823 | widget->outputs = snd_soc_dapm_suspend_check(widget); | 823 | widget->outputs = snd_soc_dapm_suspend_check(widget); |
824 | path->walking = 0; | ||
824 | return widget->outputs; | 825 | return widget->outputs; |
825 | } | 826 | } |
826 | } | 827 | } |
@@ -831,6 +832,9 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
831 | if (path->weak) | 832 | if (path->weak) |
832 | continue; | 833 | continue; |
833 | 834 | ||
835 | if (path->walking) | ||
836 | return 1; | ||
837 | |||
834 | if (path->walked) | 838 | if (path->walked) |
835 | continue; | 839 | continue; |
836 | 840 | ||
@@ -838,6 +842,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
838 | 842 | ||
839 | if (path->sink && path->connect) { | 843 | if (path->sink && path->connect) { |
840 | path->walked = 1; | 844 | path->walked = 1; |
845 | path->walking = 1; | ||
841 | 846 | ||
842 | /* do we need to add this widget to the list ? */ | 847 | /* do we need to add this widget to the list ? */ |
843 | if (list) { | 848 | if (list) { |
@@ -847,11 +852,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, | |||
847 | dev_err(widget->dapm->dev, | 852 | dev_err(widget->dapm->dev, |
848 | "ASoC: could not add widget %s\n", | 853 | "ASoC: could not add widget %s\n", |
849 | widget->name); | 854 | widget->name); |
855 | path->walking = 0; | ||
850 | return con; | 856 | return con; |
851 | } | 857 | } |
852 | } | 858 | } |
853 | 859 | ||
854 | con += is_connected_output_ep(path->sink, list); | 860 | con += is_connected_output_ep(path->sink, list); |
861 | |||
862 | path->walking = 0; | ||
855 | } | 863 | } |
856 | } | 864 | } |
857 | 865 | ||
@@ -931,6 +939,9 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
931 | if (path->weak) | 939 | if (path->weak) |
932 | continue; | 940 | continue; |
933 | 941 | ||
942 | if (path->walking) | ||
943 | return 1; | ||
944 | |||
934 | if (path->walked) | 945 | if (path->walked) |
935 | continue; | 946 | continue; |
936 | 947 | ||
@@ -938,6 +949,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
938 | 949 | ||
939 | if (path->source && path->connect) { | 950 | if (path->source && path->connect) { |
940 | path->walked = 1; | 951 | path->walked = 1; |
952 | path->walking = 1; | ||
941 | 953 | ||
942 | /* do we need to add this widget to the list ? */ | 954 | /* do we need to add this widget to the list ? */ |
943 | if (list) { | 955 | if (list) { |
@@ -947,11 +959,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, | |||
947 | dev_err(widget->dapm->dev, | 959 | dev_err(widget->dapm->dev, |
948 | "ASoC: could not add widget %s\n", | 960 | "ASoC: could not add widget %s\n", |
949 | widget->name); | 961 | widget->name); |
962 | path->walking = 0; | ||
950 | return con; | 963 | return con; |
951 | } | 964 | } |
952 | } | 965 | } |
953 | 966 | ||
954 | con += is_connected_input_ep(path->source, list); | 967 | con += is_connected_input_ep(path->source, list); |
968 | |||
969 | path->walking = 0; | ||
955 | } | 970 | } |
956 | } | 971 | } |
957 | 972 | ||