summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-04 00:07:02 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-11 09:54:31 -0500
commit84e909303dbd3c8d882f152c17d1319f2873e147 (patch)
tree6ee9db7f42423282bbe9b17233eff20b8cddacbc /sound/soc/soc-dapm.c
parenta8b1d34f3ee1bc139ac5fbe3f84f6d16c90136bb (diff)
ASoC: Add DAPM trace events
Trace events for DAPM allow us to monitor the performance and behaviour of DAPM with logging which can be built into the kernel permanantly, is more suited to automated analysis and display and less likely to suffer interference from other logging activity. Currently trace events are generated for: - Start and stop of DAPM processing - Start and stop of bias level changes - Power decisions for widgets - Widget event execution start and stop giving some view as to what is happening and where latencies occur. Actual changes in widget power can be seen via the register write trace in soc-core. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5a5db3f58f0f..8352430f4043 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -46,6 +46,8 @@
46#include <sound/soc-dapm.h> 46#include <sound/soc-dapm.h>
47#include <sound/initval.h> 47#include <sound/initval.h>
48 48
49#include <trace/events/asoc.h>
50
49/* dapm power sequences - make this per codec in the future */ 51/* dapm power sequences - make this per codec in the future */
50static int dapm_up_seq[] = { 52static int dapm_up_seq[] = {
51 [snd_soc_dapm_pre] = 0, 53 [snd_soc_dapm_pre] = 0,
@@ -151,6 +153,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_card *card,
151 return -EINVAL; 153 return -EINVAL;
152 } 154 }
153 155
156 trace_snd_soc_bias_level_start(card, level);
157
154 if (card && card->set_bias_level) 158 if (card && card->set_bias_level)
155 ret = card->set_bias_level(card, level); 159 ret = card->set_bias_level(card, level);
156 if (ret == 0) { 160 if (ret == 0) {
@@ -160,6 +164,8 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_card *card,
160 dapm->bias_level = level; 164 dapm->bias_level = level;
161 } 165 }
162 166
167 trace_snd_soc_bias_level_done(card, level);
168
163 return ret; 169 return ret;
164} 170}
165 171
@@ -761,7 +767,9 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
761 if (w->event && (w->event_flags & event)) { 767 if (w->event && (w->event_flags & event)) {
762 pop_dbg(dapm->dev, card->pop_time, "pop test : %s %s\n", 768 pop_dbg(dapm->dev, card->pop_time, "pop test : %s %s\n",
763 w->name, ev_name); 769 w->name, ev_name);
770 trace_snd_soc_dapm_widget_event_start(w, event);
764 ret = w->event(w, NULL, event); 771 ret = w->event(w, NULL, event);
772 trace_snd_soc_dapm_widget_event_done(w, event);
765 if (ret < 0) 773 if (ret < 0)
766 pr_err("%s: %s event failed: %d\n", 774 pr_err("%s: %s event failed: %d\n",
767 ev_name, w->name, ret); 775 ev_name, w->name, ret);
@@ -921,6 +929,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
921 int power; 929 int power;
922 int sys_power = 0; 930 int sys_power = 0;
923 931
932 trace_snd_soc_dapm_start(card);
933
924 /* Check which widgets we need to power and store them in 934 /* Check which widgets we need to power and store them in
925 * lists indicating if they should be powered up or down. 935 * lists indicating if they should be powered up or down.
926 */ 936 */
@@ -947,6 +957,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
947 if (w->power == power) 957 if (w->power == power)
948 continue; 958 continue;
949 959
960 trace_snd_soc_dapm_widget_power(w, power);
961
950 if (power) 962 if (power)
951 dapm_seq_insert(w, &up_list, dapm_up_seq); 963 dapm_seq_insert(w, &up_list, dapm_up_seq);
952 else 964 else
@@ -1037,6 +1049,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
1037 "DAPM sequencing finished, waiting %dms\n", card->pop_time); 1049 "DAPM sequencing finished, waiting %dms\n", card->pop_time);
1038 pop_wait(card->pop_time); 1050 pop_wait(card->pop_time);
1039 1051
1052 trace_snd_soc_dapm_done(card);
1053
1040 return 0; 1054 return 0;
1041} 1055}
1042 1056