Commit 7b8a54af authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: pcm: add tracepoints for final selection process of hardware parameters

Results of ioctl(2) with SNDRV_PCM_IOCTL_HW_REFINE and
SNDRV_PCM_IOCTL_HW_PARAMS are different, because the latter has single
value for several parameters; e.g. channels of PCM substream. Selection
of the single value is done independently of application of constraints.
It's helpful for developers to trace the selection process.

This commit adds tracepoints to snd_pcm_hw_params_choose() for the
Signed-off-by: default avatarTakashi Sakamoto <>
Signed-off-by: default avatarTakashi Iwai <>
parent 60f96aae
......@@ -598,16 +598,38 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
const int *v;
struct snd_mask old_mask;
struct snd_interval old_interval;
int err;
for (v = vars; *v != -1; v++) {
/* Keep old parameter to trace. */
if (trace_hw_mask_param_enabled()) {
if (hw_is_mask(*v))
old_mask = *hw_param_mask(params, *v);
if (trace_hw_interval_param_enabled()) {
if (hw_is_interval(*v))
old_interval = *hw_param_interval(params, *v);
err = snd_pcm_hw_param_first(pcm, params, *v, NULL);
err = snd_pcm_hw_param_last(pcm, params, *v, NULL);
if (snd_BUG_ON(err < 0))
return err;
/* Trace the parameter. */
if (hw_is_mask(*v)) {
trace_hw_mask_param(pcm, *v, 0, &old_mask,
hw_param_mask(params, *v));
if (hw_is_interval(*v)) {
trace_hw_interval_param(pcm, *v, 0, &old_interval,
hw_param_interval(params, *v));
return 0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment