diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2011-01-21 10:29:02 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-01-21 13:30:51 -0500 |
commit | c358e640a669b528b32af5442c92b856de623e1c (patch) | |
tree | c40ceac6b635e6fdb00ee8eb4c5ab96044ca7503 | |
parent | 67b22517d8e48a97e1d2ab10d095c538bbb2374c (diff) |
ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
This patch makes it easy to see when the syncing process begins and
ends. You can also enable the snd_soc_reg_write tracepoint to see
which registers are being synced.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/trace/events/asoc.h | 25 | ||||
-rw-r--r-- | sound/soc/soc-cache.c | 10 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h index 186e84db4b54..ae973d2e27a1 100644 --- a/include/trace/events/asoc.h +++ b/include/trace/events/asoc.h | |||
@@ -229,6 +229,31 @@ TRACE_EVENT(snd_soc_jack_notify, | |||
229 | TP_printk("jack=%s %x", __get_str(name), (int)__entry->val) | 229 | TP_printk("jack=%s %x", __get_str(name), (int)__entry->val) |
230 | ); | 230 | ); |
231 | 231 | ||
232 | TRACE_EVENT(snd_soc_cache_sync, | ||
233 | |||
234 | TP_PROTO(struct snd_soc_codec *codec, const char *type, | ||
235 | const char *status), | ||
236 | |||
237 | TP_ARGS(codec, type, status), | ||
238 | |||
239 | TP_STRUCT__entry( | ||
240 | __string( name, codec->name ) | ||
241 | __string( status, status ) | ||
242 | __string( type, type ) | ||
243 | __field( int, id ) | ||
244 | ), | ||
245 | |||
246 | TP_fast_assign( | ||
247 | __assign_str(name, codec->name); | ||
248 | __assign_str(status, status); | ||
249 | __assign_str(type, type); | ||
250 | __entry->id = codec->id; | ||
251 | ), | ||
252 | |||
253 | TP_printk("codec=%s.%d type=%s status=%s", __get_str(name), | ||
254 | (int)__entry->id, __get_str(type), __get_str(status)) | ||
255 | ); | ||
256 | |||
232 | #endif /* _TRACE_ASOC_H */ | 257 | #endif /* _TRACE_ASOC_H */ |
233 | 258 | ||
234 | /* This part must be outside protection */ | 259 | /* This part must be outside protection */ |
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index f83483963791..db66dc44add2 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/bitmap.h> | 18 | #include <linux/bitmap.h> |
19 | #include <linux/rbtree.h> | 19 | #include <linux/rbtree.h> |
20 | 20 | ||
21 | #include <trace/events/asoc.h> | ||
22 | |||
21 | static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, | 23 | static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec, |
22 | unsigned int reg) | 24 | unsigned int reg) |
23 | { | 25 | { |
@@ -1601,18 +1603,26 @@ EXPORT_SYMBOL_GPL(snd_soc_cache_write); | |||
1601 | int snd_soc_cache_sync(struct snd_soc_codec *codec) | 1603 | int snd_soc_cache_sync(struct snd_soc_codec *codec) |
1602 | { | 1604 | { |
1603 | int ret; | 1605 | int ret; |
1606 | const char *name; | ||
1604 | 1607 | ||
1605 | if (!codec->cache_sync) { | 1608 | if (!codec->cache_sync) { |
1606 | return 0; | 1609 | return 0; |
1607 | } | 1610 | } |
1608 | 1611 | ||
1612 | if (codec->cache_ops->name) | ||
1613 | name = codec->cache_ops->name; | ||
1614 | else | ||
1615 | name = "unknown"; | ||
1616 | |||
1609 | if (codec->cache_ops && codec->cache_ops->sync) { | 1617 | if (codec->cache_ops && codec->cache_ops->sync) { |
1610 | if (codec->cache_ops->name) | 1618 | if (codec->cache_ops->name) |
1611 | dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", | 1619 | dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", |
1612 | codec->cache_ops->name, codec->name); | 1620 | codec->cache_ops->name, codec->name); |
1621 | trace_snd_soc_cache_sync(codec, name, "start"); | ||
1613 | ret = codec->cache_ops->sync(codec); | 1622 | ret = codec->cache_ops->sync(codec); |
1614 | if (!ret) | 1623 | if (!ret) |
1615 | codec->cache_sync = 0; | 1624 | codec->cache_sync = 0; |
1625 | trace_snd_soc_cache_sync(codec, name, "end"); | ||
1616 | return ret; | 1626 | return ret; |
1617 | } | 1627 | } |
1618 | 1628 | ||