summaryrefslogtreecommitdiff
path: root/sound/core/pcm_native.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2017-06-07 08:46:43 +0900
committerTakashi Iwai <tiwai@suse.de>2017-06-07 10:48:56 +0200
commitbe4e31dab0e14c1f6fa5c03b33056058b93316e2 (patch)
treeb959f6ae7e69de8948fa1c2536d6aea6bd2a57ed /sound/core/pcm_native.c
parentd7f910bfedd863d13ea320030fe98e42d0938ed5 (diff)
ALSA: pcm: tracepoints for refining PCM parameters
When working for devices which support configurable modes for its data transmission or which consists of several components, developers are likely to use rules of parameters of PCM substream. However, there's no infrastructure to assist their work. In old days, ALSA PCM core got a local 'RULES_DEBUG' macro to debug refinement of parameters for PCM substream. Although this is merely a makeshift. With some modifications, we get the infrastructure. This commit is for the purpose. Refinement of mask/interval type of PCM parameters is probed as tracepoint events as 'hw_mask_param' and 'hw_interval_param' on existent 'snd_pcm' subsystem. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_native.c')
-rw-r--r--sound/core/pcm_native.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index bf5d0f2acfb9..b98b3ccde4f0 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -39,6 +39,9 @@
#include "pcm_local.h"
+#define CREATE_TRACE_POINTS
+#include "pcm_param_trace.h"
+
/*
* Compatibility
*/
@@ -279,6 +282,9 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
unsigned int stamp = 2;
int changed, again;
+ struct snd_mask __maybe_unused old_mask;
+ struct snd_interval __maybe_unused old_interval;
+
params->info = 0;
params->fifo_size = 0;
if (params->rmask & (1 << SNDRV_PCM_HW_PARAM_SAMPLE_BITS))
@@ -294,6 +300,9 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
return -EINVAL;
if (!(params->rmask & (1 << k)))
continue;
+
+ if (trace_hw_mask_param_enabled())
+ old_mask = *m;
#ifdef RULES_DEBUG
pr_debug("%s = ", snd_pcm_hw_param_names[k]);
pr_cont("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
@@ -302,6 +311,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
#ifdef RULES_DEBUG
pr_cont("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
#endif
+ trace_hw_mask_param(substream, k, 0, &old_mask, m);
+
if (changed)
params->cmask |= 1 << k;
if (changed < 0)
@@ -314,6 +325,9 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
return -EINVAL;
if (!(params->rmask & (1 << k)))
continue;
+
+ if (trace_hw_interval_param_enabled())
+ old_interval = *i;
#ifdef RULES_DEBUG
pr_debug("%s = ", snd_pcm_hw_param_names[k]);
if (i->empty)
@@ -333,6 +347,8 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
i->openmin ? '(' : '[', i->min,
i->max, i->openmax ? ')' : ']');
#endif
+ trace_hw_interval_param(substream, k, 0, &old_interval, i);
+
if (changed)
params->cmask |= 1 << k;
if (changed < 0)
@@ -359,6 +375,15 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
}
if (!doit)
continue;
+
+ if (trace_hw_mask_param_enabled()) {
+ if (hw_is_mask(r->var))
+ old_mask = *hw_param_mask(params, r->var);
+ }
+ if (trace_hw_interval_param_enabled()) {
+ if (hw_is_interval(r->var))
+ old_interval = *hw_param_interval(params, r->var);
+ }
#ifdef RULES_DEBUG
pr_debug("Rule %d [%p]: ", k, r->func);
if (r->var >= 0) {
@@ -394,6 +419,14 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
}
pr_cont("\n");
#endif
+ if (hw_is_mask(r->var)) {
+ trace_hw_mask_param(substream, r->var, k + 1,
+ &old_mask, hw_param_mask(params, r->var));
+ }
+ if (hw_is_interval(r->var)) {
+ trace_hw_interval_param(substream, r->var, k + 1,
+ &old_interval, hw_param_interval(params, r->var));
+ }
rstamps[k] = stamp;
if (changed && r->var >= 0) {
params->cmask |= (1 << r->var);