aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-04 17:28:08 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-05 06:22:14 -0400
commit75c1f891b4c394c607532fdcea294c2556e410c4 (patch)
tree4eff7b77eb9b0fcc145e048b54fe3c067385e72c /sound/soc/soc-dapm.c
parentfe4fda5d8f28d06ae8f1482f4bde8a83be16e44b (diff)
ASoC: Add verbose debugging showing why widgets get marked dirty
Help diagnose why we're checking widgets by providing some logging when we first dirty them. This should possibly be a trace point if it's useful but can be absurdly verbose if enabled, we can always change it later if desired. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 214a709128d2..e6a08822227e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -124,10 +124,13 @@ static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)
124 return !list_empty(&w->dirty); 124 return !list_empty(&w->dirty);
125} 125}
126 126
127static void dapm_mark_dirty(struct snd_soc_dapm_widget *w) 127static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason)
128{ 128{
129 if (!dapm_dirty_widget(w)) 129 if (!dapm_dirty_widget(w)) {
130 dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n",
131 w->name, reason);
130 list_add_tail(&w->dirty, &w->dapm->card->dapm_dirty); 132 list_add_tail(&w->dirty, &w->dapm->card->dapm_dirty);
133 }
131} 134}
132 135
133/* create a new dapm widget */ 136/* create a new dapm widget */
@@ -1227,7 +1230,7 @@ static void dapm_widget_set_peer_power(struct snd_soc_dapm_widget *peer,
1227 /* If the peer is already in the state we're moving to then we 1230 /* If the peer is already in the state we're moving to then we
1228 * won't have an impact on it. */ 1231 * won't have an impact on it. */
1229 if (power != peer->power) 1232 if (power != peer->power)
1230 dapm_mark_dirty(peer); 1233 dapm_mark_dirty(peer, "peer state change");
1231} 1234}
1232 1235
1233static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power, 1236static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power,
@@ -1624,16 +1627,17 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1624 /* we now need to match the string in the enum to the path */ 1627 /* we now need to match the string in the enum to the path */
1625 if (!(strcmp(path->name, e->texts[mux]))) { 1628 if (!(strcmp(path->name, e->texts[mux]))) {
1626 path->connect = 1; /* new connection */ 1629 path->connect = 1; /* new connection */
1627 dapm_mark_dirty(path->source); 1630 dapm_mark_dirty(path->source, "mux connection");
1628 } else { 1631 } else {
1629 if (path->connect) 1632 if (path->connect)
1630 dapm_mark_dirty(path->source); 1633 dapm_mark_dirty(path->source,
1634 "mux disconnection");
1631 path->connect = 0; /* old connection must be powered down */ 1635 path->connect = 0; /* old connection must be powered down */
1632 } 1636 }
1633 } 1637 }
1634 1638
1635 if (found) { 1639 if (found) {
1636 dapm_mark_dirty(widget); 1640 dapm_mark_dirty(widget, "mux change");
1637 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP); 1641 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP);
1638 } 1642 }
1639 1643
@@ -1660,11 +1664,11 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1660 /* found, now check type */ 1664 /* found, now check type */
1661 found = 1; 1665 found = 1;
1662 path->connect = connect; 1666 path->connect = connect;
1663 dapm_mark_dirty(path->source); 1667 dapm_mark_dirty(path->source, "mixer connection");
1664 } 1668 }
1665 1669
1666 if (found) { 1670 if (found) {
1667 dapm_mark_dirty(widget); 1671 dapm_mark_dirty(widget, "mixer update");
1668 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP); 1672 dapm_power_widgets(widget->dapm, SND_SOC_DAPM_STREAM_NOP);
1669 } 1673 }
1670 1674
@@ -1810,7 +1814,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
1810 w->connected = status; 1814 w->connected = status;
1811 if (status == 0) 1815 if (status == 0)
1812 w->force = 0; 1816 w->force = 0;
1813 dapm_mark_dirty(w); 1817 dapm_mark_dirty(w, "pin configuration");
1814 1818
1815 return 0; 1819 return 0;
1816} 1820}
@@ -2699,7 +2703,7 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
2699 dev_vdbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n", 2703 dev_vdbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n",
2700 w->name, w->sname, stream, event); 2704 w->name, w->sname, stream, event);
2701 if (strstr(w->sname, stream)) { 2705 if (strstr(w->sname, stream)) {
2702 dapm_mark_dirty(w); 2706 dapm_mark_dirty(w, "stream event");
2703 switch(event) { 2707 switch(event) {
2704 case SND_SOC_DAPM_STREAM_START: 2708 case SND_SOC_DAPM_STREAM_START:
2705 w->active = 1; 2709 w->active = 1;
@@ -2789,7 +2793,7 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
2789 dev_dbg(w->dapm->dev, "dapm: force enable pin %s\n", pin); 2793 dev_dbg(w->dapm->dev, "dapm: force enable pin %s\n", pin);
2790 w->connected = 1; 2794 w->connected = 1;
2791 w->force = 1; 2795 w->force = 1;
2792 dapm_mark_dirty(w); 2796 dapm_mark_dirty(w, "force enable");
2793 2797
2794 return 0; 2798 return 0;
2795} 2799}