aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-07-26 13:05:00 -0400
committerMark Brown <broonie@kernel.org>2015-07-29 09:01:39 -0400
commite63bfd45aba4269811662de0954785622a2ac928 (patch)
tree8040968ee41870609cd6064d10ba2e4fc84a4273 /sound/soc/soc-dapm.c
parent1ce43acff0c078fd560ee0f2a4ae10b8da28e388 (diff)
ASoC: dapm: Add widget path iterators
Add helper iterator macros for iterating over the source and sink paths of widget. This will make it easier to change the implementation later on. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 4586f95c676b..ac506cfb9ed2 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -193,7 +193,7 @@ static void dapm_widget_invalidate_input_paths(struct snd_soc_dapm_widget *w)
193 list_add_tail(&w->work_list, &list); 193 list_add_tail(&w->work_list, &list);
194 194
195 list_for_each_entry(w, &list, work_list) { 195 list_for_each_entry(w, &list, work_list) {
196 list_for_each_entry(p, &w->sinks, list_source) { 196 snd_soc_dapm_widget_for_each_sink_path(w, p) {
197 if (p->is_supply || p->weak || !p->connect) 197 if (p->is_supply || p->weak || !p->connect)
198 continue; 198 continue;
199 sink = p->sink; 199 sink = p->sink;
@@ -232,7 +232,7 @@ static void dapm_widget_invalidate_output_paths(struct snd_soc_dapm_widget *w)
232 list_add_tail(&w->work_list, &list); 232 list_add_tail(&w->work_list, &list);
233 233
234 list_for_each_entry(w, &list, work_list) { 234 list_for_each_entry(w, &list, work_list) {
235 list_for_each_entry(p, &w->sources, list_sink) { 235 snd_soc_dapm_widget_for_each_source_path(w, p) {
236 if (p->is_supply || p->weak || !p->connect) 236 if (p->is_supply || p->weak || !p->connect)
237 continue; 237 continue;
238 source = p->source; 238 source = p->source;
@@ -894,7 +894,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
894 /* add kcontrol */ 894 /* add kcontrol */
895 for (i = 0; i < w->num_kcontrols; i++) { 895 for (i = 0; i < w->num_kcontrols; i++) {
896 /* match name */ 896 /* match name */
897 list_for_each_entry(path, &w->sources, list_sink) { 897 snd_soc_dapm_widget_for_each_source_path(w, path) {
898 /* mixer/mux paths name must match control name */ 898 /* mixer/mux paths name must match control name */
899 if (path->name != (char *)w->kcontrol_news[i].name) 899 if (path->name != (char *)w->kcontrol_news[i].name)
900 continue; 900 continue;
@@ -958,12 +958,12 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
958 return ret; 958 return ret;
959 959
960 if (w->id == snd_soc_dapm_mux) { 960 if (w->id == snd_soc_dapm_mux) {
961 list_for_each_entry(path, &w->sources, list_sink) { 961 snd_soc_dapm_widget_for_each_source_path(w, path) {
962 if (path->name) 962 if (path->name)
963 dapm_kcontrol_add_path(w->kcontrols[0], path); 963 dapm_kcontrol_add_path(w->kcontrols[0], path);
964 } 964 }
965 } else { 965 } else {
966 list_for_each_entry(path, &w->sinks, list_source) { 966 snd_soc_dapm_widget_for_each_sink_path(w, path) {
967 if (path->name) 967 if (path->name)
968 dapm_kcontrol_add_path(w->kcontrols[0], path); 968 dapm_kcontrol_add_path(w->kcontrols[0], path);
969 } 969 }
@@ -1079,7 +1079,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
1079 return widget->outputs; 1079 return widget->outputs;
1080 } 1080 }
1081 1081
1082 list_for_each_entry(path, &widget->sinks, list_source) { 1082 snd_soc_dapm_widget_for_each_sink_path(widget, path) {
1083 DAPM_UPDATE_STAT(widget, neighbour_checks); 1083 DAPM_UPDATE_STAT(widget, neighbour_checks);
1084 1084
1085 if (path->weak || path->is_supply) 1085 if (path->weak || path->is_supply)
@@ -1126,7 +1126,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
1126 return widget->inputs; 1126 return widget->inputs;
1127 } 1127 }
1128 1128
1129 list_for_each_entry(path, &widget->sources, list_sink) { 1129 snd_soc_dapm_widget_for_each_source_path(widget, path) {
1130 DAPM_UPDATE_STAT(widget, neighbour_checks); 1130 DAPM_UPDATE_STAT(widget, neighbour_checks);
1131 1131
1132 if (path->weak || path->is_supply) 1132 if (path->weak || path->is_supply)
@@ -1292,7 +1292,7 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w)
1292 DAPM_UPDATE_STAT(w, power_checks); 1292 DAPM_UPDATE_STAT(w, power_checks);
1293 1293
1294 /* Check if one of our outputs is connected */ 1294 /* Check if one of our outputs is connected */
1295 list_for_each_entry(path, &w->sinks, list_source) { 1295 snd_soc_dapm_widget_for_each_sink_path(w, path) {
1296 DAPM_UPDATE_STAT(w, neighbour_checks); 1296 DAPM_UPDATE_STAT(w, neighbour_checks);
1297 1297
1298 if (path->weak) 1298 if (path->weak)
@@ -1716,12 +1716,12 @@ static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power,
1716 /* If we changed our power state perhaps our neigbours changed 1716 /* If we changed our power state perhaps our neigbours changed
1717 * also. 1717 * also.
1718 */ 1718 */
1719 list_for_each_entry(path, &w->sources, list_sink) 1719 snd_soc_dapm_widget_for_each_source_path(w, path)
1720 dapm_widget_set_peer_power(path->source, power, path->connect); 1720 dapm_widget_set_peer_power(path->source, power, path->connect);
1721 1721
1722 /* Supplies can't affect their outputs, only their inputs */ 1722 /* Supplies can't affect their outputs, only their inputs */
1723 if (!w->is_supply) { 1723 if (!w->is_supply) {
1724 list_for_each_entry(path, &w->sinks, list_source) 1724 snd_soc_dapm_widget_for_each_sink_path(w, path)
1725 dapm_widget_set_peer_power(path->sink, power, 1725 dapm_widget_set_peer_power(path->sink, power,
1726 path->connect); 1726 path->connect);
1727 } 1727 }
@@ -1958,7 +1958,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1958 w->sname, 1958 w->sname,
1959 w->active ? "active" : "inactive"); 1959 w->active ? "active" : "inactive");
1960 1960
1961 list_for_each_entry(p, &w->sources, list_sink) { 1961 snd_soc_dapm_widget_for_each_source_path(w, p) {
1962 if (p->connected && !p->connected(w, p->source)) 1962 if (p->connected && !p->connected(w, p->source))
1963 continue; 1963 continue;
1964 1964
@@ -1968,7 +1968,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1968 p->name ? p->name : "static", 1968 p->name ? p->name : "static",
1969 p->source->name); 1969 p->source->name);
1970 } 1970 }
1971 list_for_each_entry(p, &w->sinks, list_source) { 1971 snd_soc_dapm_widget_for_each_sink_path(w, p) {
1972 if (p->connected && !p->connected(w, p->sink)) 1972 if (p->connected && !p->connected(w, p->sink))
1973 continue; 1973 continue;
1974 1974
@@ -2426,7 +2426,7 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2426 if (w->dapm->card->fully_routed) 2426 if (w->dapm->card->fully_routed)
2427 break; 2427 break;
2428 w->is_source = 1; 2428 w->is_source = 1;
2429 list_for_each_entry(p, &w->sources, list_sink) { 2429 snd_soc_dapm_widget_for_each_source_path(w, p) {
2430 if (p->source->id == snd_soc_dapm_micbias || 2430 if (p->source->id == snd_soc_dapm_micbias ||
2431 p->source->id == snd_soc_dapm_mic || 2431 p->source->id == snd_soc_dapm_mic ||
2432 p->source->id == snd_soc_dapm_line || 2432 p->source->id == snd_soc_dapm_line ||
@@ -2441,7 +2441,7 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2441 if (w->dapm->card->fully_routed) 2441 if (w->dapm->card->fully_routed)
2442 break; 2442 break;
2443 w->is_sink = 1; 2443 w->is_sink = 1;
2444 list_for_each_entry(p, &w->sinks, list_source) { 2444 snd_soc_dapm_widget_for_each_sink_path(w, p) {
2445 if (p->sink->id == snd_soc_dapm_spk || 2445 if (p->sink->id == snd_soc_dapm_spk ||
2446 p->sink->id == snd_soc_dapm_hp || 2446 p->sink->id == snd_soc_dapm_hp ||
2447 p->sink->id == snd_soc_dapm_line || 2447 p->sink->id == snd_soc_dapm_line ||
@@ -2841,7 +2841,7 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
2841 dev_warn(dapm->dev, "ASoC: Ignoring control for weak route %s->%s\n", 2841 dev_warn(dapm->dev, "ASoC: Ignoring control for weak route %s->%s\n",
2842 route->source, route->sink); 2842 route->source, route->sink);
2843 2843
2844 list_for_each_entry(path, &source->sinks, list_source) { 2844 snd_soc_dapm_widget_for_each_sink_path(source, path) {
2845 if (path->sink == sink) { 2845 if (path->sink == sink) {
2846 path->weak = 1; 2846 path->weak = 1;
2847 count++; 2847 count++;