ASoC: soc-cache: Add trace event for snd_soc_cache_sync()
[deliverable/linux.git] / sound / soc / soc-cache.c
index f834839637915499fb87f57f2df039797796ae12..db66dc44add2ceba748a5027295907bc240cd869 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/bitmap.h>
 #include <linux/rbtree.h>
 
+#include <trace/events/asoc.h>
+
 static unsigned int snd_soc_4_12_read(struct snd_soc_codec *codec,
                                     unsigned int reg)
 {
@@ -1601,18 +1603,26 @@ EXPORT_SYMBOL_GPL(snd_soc_cache_write);
 int snd_soc_cache_sync(struct snd_soc_codec *codec)
 {
        int ret;
+       const char *name;
 
        if (!codec->cache_sync) {
                return 0;
        }
 
+       if (codec->cache_ops->name)
+               name = codec->cache_ops->name;
+       else
+               name = "unknown";
+
        if (codec->cache_ops && codec->cache_ops->sync) {
                if (codec->cache_ops->name)
                        dev_dbg(codec->dev, "Syncing %s cache for %s codec\n",
                                codec->cache_ops->name, codec->name);
+               trace_snd_soc_cache_sync(codec, name, "start");
                ret = codec->cache_ops->sync(codec);
                if (!ret)
                        codec->cache_sync = 0;
+               trace_snd_soc_cache_sync(codec, name, "end");
                return ret;
        }
 
This page took 0.025972 seconds and 5 git commands to generate.