浏览代码

ALSA: Fix handling of multiple msbits constraints on the same runtime

If the sound card is made up of discrete components, each with their own
driver (e.g. like in the ASoC case), we might end up with multiple msbits
constraint rules installed. Currently this will result in msbits being set
to whatever the last rule set it to.

This patch updates the behavior of the rule to choose the minimum (other
than zero) of all the installed rules.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Lars-Peter Clausen 10 年之前
父节点
当前提交
19f52fae5a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      sound/core/pcm_lib.c

+ 1 - 1
sound/core/pcm_lib.c

@@ -1300,7 +1300,7 @@ static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params,
 	unsigned int msbits = l >> 16;
 	struct snd_interval *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
 	if (snd_interval_single(i) && snd_interval_value(i) == width)
-		params->msbits = msbits;
+		params->msbits = min_not_zero(params->msbits, msbits);
 	return 0;
 }